swift
checkboxdelegate.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_CCOLUMNCHECKBOXDELEGATE_H
7 #define SWIFT_GUI_CCOLUMNCHECKBOXDELEGATE_H
8 
9 #include <QItemDelegate>
10 #include <QObject>
11 #include <QString>
12 #include <QStyleOptionViewItem>
13 
14 #include "gui/swiftguiexport.h"
15 
16 class QAbstractItemModel;
17 class QModelIndex;
18 class QStyleOptionViewItem;
19 class QWidget;
20 
21 namespace swift::gui::views
22 {
24  class SWIFT_GUI_EXPORT CCheckBoxDelegate : public QItemDelegate
25  {
26  Q_OBJECT
27 
28  public:
30  CCheckBoxDelegate(QObject *parent = nullptr);
31 
33  CCheckBoxDelegate(const QString &iconCheckedUrl, const QString &iconUncheckedUrl, QObject *parent = nullptr);
34 
37 
39  virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
40  const QModelIndex &index) const override;
41 
43  virtual void setEditorData(QWidget *editor, const QModelIndex &index) const override;
44 
46  virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
47 
49  virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
50  const QModelIndex &index) const override;
51 
52  private:
53  QString m_iconCheckedUrl;
54  QString m_iconUncheckedUrl;
55  };
56 } // namespace swift::gui::views
57 
58 #endif // SWIFT_GUI_CCOLUMNCHECKBOXDELEGATE_H
CheckBox for single column.
Views, mainly QTableView.
#define SWIFT_GUI_EXPORT
Export a class or function from the library.