QCAD
Open Source 2D CAD
RTreeWidget.h
Go to the documentation of this file.
1 
20 #ifndef RTREEWIDGET_H_
21 #define RTREEWIDGET_H_
22 
23 #include "gui_global.h"
24 
25 #include <QWidget>
26 #include <QTreeWidget>
27 #include <QTreeWidgetItem>
28 #include <QtDebug>
29 
37 class QCADGUI_EXPORT RTreeWidget: public QTreeWidget {
38 
39  Q_OBJECT
40 
41 public:
42  RTreeWidget(QWidget* parent=0);
43  virtual ~RTreeWidget();
44 
45  void setSelectableColumn(int c) {
46  selectableColumn = c;
47  }
48 
49  QModelIndex getIndex(QTreeWidgetItem* item, int column = 0) {
50  return indexFromItem(item, column);
51  }
52 
53  QTreeWidgetItem* getActiveItem();
54 
55 protected:
56  virtual void contextMenuEvent(QContextMenuEvent* e);
57  virtual void mousePressEvent(QMouseEvent* e);
58  virtual void mouseReleaseEvent(QMouseEvent* e);
59  virtual void mouseMoveEvent(QMouseEvent* e);
60  virtual void resizeEvent(QResizeEvent* event);
61 
62 signals:
63  void itemColumnClicked(QTreeWidgetItem* item, int column);
64  void contextMenuRequested(QTreeWidgetItem* item, int column);
65 
66 private:
67  QVariant itemPressedData;
69  // selectable column or -1 for all:
71 };
72 
74 
75 #endif
#define QCADGUI_EXPORT
Definition: gui_global.h:10
int indexPressed
Definition: RTreeWidget.h:68
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RTreeWidget.h:37
QVariant itemPressedData
Definition: RTreeWidget.h:67
QModelIndex getIndex(QTreeWidgetItem *item, int column=0)
Definition: RTreeWidget.h:49
void setSelectableColumn(int c)
Definition: RTreeWidget.h:45
Q_DECLARE_METATYPE(RMath *)
int selectableColumn
Definition: RTreeWidget.h:70