Loading...
Searching...
No Matches
DeviceExplorerView.hpp
1#pragma once
2
3#include <QAbstractItemModel>
4#include <QList>
5#include <QTreeView>
6
7#include <score_plugin_deviceexplorer_export.h>
8
9#include <verdigris>
10class QAction;
11class QItemSelection;
12class QPoint;
13class QWidget;
14
15namespace Explorer
16{
17class DeviceExplorerFilterProxyModel;
18class DeviceExplorerModel;
19class SCORE_PLUGIN_DEVICEEXPLORER_EXPORT DeviceExplorerView final : public QTreeView
20{
21 W_OBJECT(DeviceExplorerView)
22
23public:
24 explicit DeviceExplorerView(QWidget* parent = nullptr);
25 ~DeviceExplorerView() override;
26
27 void setModel(QAbstractItemModel* model) override;
28 void setModel(DeviceExplorerFilterProxyModel* model);
29
30 DeviceExplorerModel* model();
31 const DeviceExplorerModel* model() const;
32
33 void setSelectedIndex(const QModelIndex& index);
34
35 QModelIndexList selectedIndexes() const override;
36 QModelIndex selectedIndex() const;
37
38 bool hasProxy() const;
39
40public:
41 void selectionChanged() W_SIGNAL(selectionChanged, ());
42 void created(QModelIndex parent, int start, int end)
43 W_SIGNAL(created, parent, start, end);
44
45private:
46 void selectionChanged(
47 const QItemSelection& selected, const QItemSelection& deselected) override;
48 W_SLOT(selectionChanged, (const QItemSelection&, const QItemSelection&));
49
50 void headerMenuRequested(const QPoint& pos);
51 W_SLOT(headerMenuRequested);
52 void columnVisibilityChanged(bool shown);
53 W_SLOT(columnVisibilityChanged);
54
55private:
56 void keyPressEvent(QKeyEvent*) override;
57
58 QModelIndexList selectedDraggableIndexes() const;
59 void startDrag(Qt::DropActions supportedActions) override;
60 void rowsInserted(const QModelIndex& parent, int start, int end) override;
61 void saveSettings();
62 void restoreSettings();
63 void setInitialColumnsSizes();
64
65 void initActions();
66
67 QList<QAction*> m_actions;
68
69 bool m_hasProxy{};
70
71 // QWidget interface
72protected:
73 void paintEvent(QPaintEvent* event) override;
74};
75}
Definition DeviceExplorerFilterProxyModel.hpp:13
Definition DeviceExplorerModel.hpp:67
Definition DeviceExplorerView.hpp:20