Choreonoid  1.8
TreeWidget.h
Go to the documentation of this file.
1 
5 #ifndef CNOID_BASE_TREE_WIDGET_H
6 #define CNOID_BASE_TREE_WIDGET_H
7 
8 #include <cnoid/Signal>
9 #include <QTreeWidget>
10 #include <QHeaderView>
11 #include "exportdecl.h"
12 
13 namespace cnoid {
14 
15 class CNOID_EXPORT TreeWidget : public QTreeWidget
16 {
17  Q_OBJECT
18 
19 public:
20  TreeWidget(QWidget* parent = nullptr);
21  ~TreeWidget();
22 
23  void setHeaderSectionResizeMode(int column, QHeaderView::ResizeMode mode);
24  void setVerticalGridLineShown(bool on);
25 
26  SignalProxy<void(QTreeWidgetItem* current, QTreeWidgetItem* previous)> sigCurrentItemChanged();
27  SignalProxy<void(QTreeWidgetItem* item, int column)> sigItemActivated();
28  SignalProxy<void(QTreeWidgetItem* item, int column)> sigItemChanged();
29  SignalProxy<void(QTreeWidgetItem* item, int column)> sigItemClicked();
30  SignalProxy<void(QTreeWidgetItem* item)> sigItemCollapsed();
31  SignalProxy<void(QTreeWidgetItem* item, int column)> sigItemDoubleClicked();
32  SignalProxy<void(QTreeWidgetItem* item, int column)> sigItemEntered();
33  SignalProxy<void(QTreeWidgetItem* item)> sigItemExpanded();
34  SignalProxy<void(QTreeWidgetItem* item, int column)> sigItemPressed();
35  SignalProxy<void()> sigItemSelectionChanged();
36 
37  // Signals of QAbstractItemModel owned by TreeWidget
38  SignalProxy<void(const QModelIndex &parent, int first, int last)> sigRowsAboutToBeRemoved();
39  SignalProxy<void(const QModelIndex &parent, int first, int last)> sigRowsRemoved();
40  SignalProxy<void(const QModelIndex &parent, int first, int last)> sigRowsInserted();
41 
42  // Signal of QHeaderView owned by TreeWidget
43  SignalProxy<void(int logicalIndex, int oldSize, int newSize)> sigSectionResized();
44 
45 protected:
46  virtual void paintEvent(QPaintEvent* event);
47  virtual void scrollContentsBy(int dx, int dy);
48 
49 private Q_SLOTS:
50  void onCurrentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous);
51  void onItemActivated(QTreeWidgetItem* item, int column);
52  void onItemChanged(QTreeWidgetItem* item, int column);
53  void onItemClicked(QTreeWidgetItem* item, int column);
54  void onItemCollapsed(QTreeWidgetItem* item);
55  void onItemDoubleClicked(QTreeWidgetItem* item, int column);
56  void onItemEntered(QTreeWidgetItem* item, int column);
57  void onItemExpanded(QTreeWidgetItem* item);
58  void onItemPressed(QTreeWidgetItem* item, int column);
59  void onItemSelectionChanged(void);
60  void onRowsAboutToBeRemoved(const QModelIndex &parent, int first, int last);
61  void onRowsRemoved(const QModelIndex &parent, int first, int last);
62  void onRowsInserted(const QModelIndex &parent, int first, int last);
63  void onSectionResized(int logicalIndex, int oldSize, int newSize);
64 
65 private:
66  class Impl;
67  Impl* impl;
68 };
69 
70 }
71 
72 #endif
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::TreeWidget
Definition: TreeWidget.h:15
cnoid::SignalProxy
Definition: Signal.h:470