LeechCraft 0.6.70-14794-g33744ae6ce
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
rolenamesmixin.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include <utility>
12#include <QHash>
13
14namespace LC::Util
15{
29 template<typename Model>
30 class RoleNamesMixin : public Model
31 {
32 QHash<int, QByteArray> RoleNames_;
33 protected:
39 RoleNamesMixin () = default;
40
49 template<typename... Args>
50 explicit RoleNamesMixin (Args&&... args)
51 : Model { std::forward<Args> (args)... }
52 {
53 }
54
61 void setRoleNames (const QHash<int, QByteArray>& roleNames)
62 {
63 RoleNames_ = roleNames;
64 }
65
75 QHash<int, QByteArray> roleNames () const override
76 {
77 return RoleNames_;
78 }
79 };
80}
Wraps differences between role names handling in Qt4 and Qt5.
RoleNamesMixin(Args &&... args)
Constructs the base Model type with the given args.
void setRoleNames(const QHash< int, QByteArray > &roleNames)
Sets the role names to roleNames.
QHash< int, QByteArray > roleNames() const override
Returns the role names.
RoleNamesMixin()=default
Default constructor.
@ Model
The human-readable name of the device model (QString).
Definition: deviceroles.h:97
STL namespace.