KanoopGuiQt 1.3.0
Qt GUI utility library
Loading...
Searching...
No Matches
treeselectionmodel.h
1#ifndef TREESELECTIONMODEL_H
2#define TREESELECTIONMODEL_H
3#include <Kanoop/gui/libkanoopgui.h>
4
5#include <QItemSelectionModel>
6
7#include <Kanoop/utility/loggingbaseclass.h>
8
9/**
10 * @brief QItemSelectionModel subclass with logging support for tree views.
11 *
12 * Overrides select() to allow subclasses or debug instrumentation to intercept
13 * selection changes made on a tree view.
14 */
15class LIBKANOOPGUI_EXPORT TreeSelectionModel : public QItemSelectionModel,
16 public LoggingBaseClass
17{
18 Q_OBJECT
19public:
20 /**
21 * @brief Construct with a model and optional parent.
22 * @param model The item model this selection model operates on
23 * @param parent Optional QObject parent
24 */
25 TreeSelectionModel(QAbstractItemModel *model, QObject *parent = nullptr);
26
27public slots:
28 /**
29 * @brief Select a single index with the given selection flags.
30 * @param index Index to select
31 * @param command Selection flags controlling how the selection is modified
32 */
33 virtual void select(const QModelIndex& index, QItemSelectionModel::SelectionFlags command) override;
34
35 /**
36 * @brief Apply a selection change described by a QItemSelection.
37 * @param selection The selection to apply
38 * @param command Selection flags controlling how the selection is modified
39 */
40 virtual void select(const QItemSelection& selection, QItemSelectionModel::SelectionFlags command) override;
41};
42
43#endif // TREESELECTIONMODEL_H
QItemSelectionModel subclass with logging support for tree views.
virtual void select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command) override
Apply a selection change described by a QItemSelection.
virtual void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command) override
Select a single index with the given selection flags.
TreeSelectionModel(QAbstractItemModel *model, QObject *parent=nullptr)
Construct with a model and optional parent.