swift
namevariantpairlistmodel.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_GUI_NAMEVARIANTLISTMODEL_H
7 #define SWIFT_GUI_NAMEVARIANTLISTMODEL_H
8 
9 #include <QString>
10 
12 #include "gui/swiftguiexport.h"
14 #include "misc/variant.h"
15 
16 class QObject;
17 
18 namespace swift::misc
19 {
20  class CIcon;
21  class CNameVariantPair;
22 } // namespace swift::misc
23 
24 namespace swift::gui::models
25 {
26 
28  class SWIFT_GUI_EXPORT CNameVariantPairModel : public CListModelBase<swift::misc::CNameVariantPairList>
29  {
30  Q_OBJECT
31 
32  public:
34  explicit CNameVariantPairModel(bool withIcon, QObject *parent = nullptr);
35 
38 
40  void setIconMode(bool withIcon);
41 
43  void removeByName(const QString &name);
44 
46  bool containsName(const QString &name) const;
47 
49  bool containsNameValue(const QString &name, const swift::misc::CVariant &value) const;
50 
52  bool addOrUpdateByName(const QString &name, const swift::misc::CVariant &value, const swift::misc::CIcon &icon,
53  bool skipEqualValues);
54 
56  int getRowIndexForName(const QString &name) const;
57  };
58 } // namespace swift::gui::models
59 #endif // SWIFT_GUI_NAMEVARIANTLISTMODEL_H
Simple model displaying name / variant values.
Value object for icons. An icon is stored in the global icon repository and identified by its index....
Definition: icon.h:39
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
Definition: variant.h:66
Models to be used with views, mainly QTableView.
Free functions in swift::misc.
#define SWIFT_GUI_EXPORT
Export a class or function from the library.