navigationwidget.hh 1.75 KB
Newer Older
1
2
3
4
5
6
7
8
#ifndef RADIX_RADIXWIDGETS_NAVIGATIONWIDGET_HH_
#define RADIX_RADIXWIDGETS_NAVIGATIONWIDGET_HH_

#include <QSortFilterProxyModel>
#include <QStandardItemModel>
#include <QStyledItemDelegate>
#include <QWidget>

9
10
#include "radixcore/visibility.hh"

11
12
13
14
15
16
17
18
19
#include <memory>

QT_BEGIN_NAMESPACE
class QStandardItem;
class QTreeView;
QT_END_NAMESPACE

namespace radix
{
20
// Forward declaration
21
class NavigationItem;
22
class NavigationModel;
23
class NavigationActionManager;
24

Huff, Israel's avatar
Huff, Israel committed
25
26
class RADIX_PUBLIC NavigationItemSortFilterProxyModel
    : public QSortFilterProxyModel
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{
  Q_OBJECT

 public:
  NavigationItemSortFilterProxyModel(QObject* parent = nullptr);

 public slots:
  void clearCache();

 protected:
  bool filterAcceptsRow(int row, const QModelIndex& parent) const;

 private:
  bool accepts(const QModelIndex& index) const;
  class PImpl;
  std::unique_ptr<PImpl, void (*)(PImpl*)> p;
Huff, Israel's avatar
Huff, Israel committed
43
  static void deleter(PImpl* impl);
44
45
};

46
class RADIX_PUBLIC NavigationWidget : public QWidget
47
48
49
50
51
52
53
54
55
{
  Q_OBJECT

 public:
  NavigationWidget(QWidget* parent = nullptr);

  void collapse(QStandardItem* item);

  void expand(QStandardItem* item);
56
  NavigationModel* navigationModel();
57
  NavigationActionManager* navigationActionManager();
58
59

  QTreeView* navigationTree() const;
60
61
 private slots:
  void contextMenuRequested(QPoint);
62
63
64
 public slots:
  void filterModel(const QString& pattern);

65
 signals:
66
67
  void itemDoubleClicked(const QModelIndex& index);
  void itemClicked(const QModelIndex& index);
68
69
  void itemChecked(const QModelIndex& index);
  void itemUnchecked(const QModelIndex& index);
70
71
72
73
74
75
76
77

 private:
  void initLayout();

  void initMembers();

  class PImpl;
  std::unique_ptr<PImpl, void (*)(PImpl*)> p;
Huff, Israel's avatar
Huff, Israel committed
78
  static void deleter(PImpl* impl);
79
80
81
82
};
}  // namespace radix

#endif /** RADIX_RADIXWIDGETS_NAVIGATIONWIDGET_HH_ */