QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RListView.h
Go to the documentation of this file.
1 
20 #ifndef RLISTVIEW_H_
21 #define RLISTVIEW_H_
22 
23 #include "gui_global.h"
24 
25 #include <QWidget>
26 #include <QListView>
27 #include <QEvent>
28 #include <QHelpEvent>
29 
35 class QCADGUI_EXPORT RListView: public QListView {
36 
37 Q_OBJECT
38 
39 public:
40  RListView(QWidget* parent = 0) :
41  QListView(parent) {
42  }
43  virtual ~RListView() {
44  }
45 
46 signals:
47  void signalContextMenuEvent(QContextMenuEvent* e);
48  void signalMouseMoveEvent(QMouseEvent* e);
49  void signalMousePressEvent(QMouseEvent* e);
50  void signalMouseReleaseEvent(QMouseEvent* e);
51  void signalDragEnterEvent(QDragEnterEvent* e);
52  void signalDragMoveEvent(QDragMoveEvent* e);
53  void signalDropEvent(QDropEvent* e);
54  void signalStartDrag(Qt::DropActions supportedActions);
55  void signalSelectionChanged(const QItemSelection& selected,
56  const QItemSelection& deselected);
57  void signalCurrentChanged(const QModelIndex& current,
58  const QModelIndex& previous);
59  void signalToolTipRequested(QHelpEvent* e);
60 
61 protected:
62  virtual void contextMenuEvent(QContextMenuEvent* e) {
63  QListView::contextMenuEvent(e);
64  emit signalContextMenuEvent(e);
65  }
66  virtual void mousePressEvent(QMouseEvent* e) {
67  QListView::mousePressEvent(e);
68  emit signalMousePressEvent(e);
69  }
70  virtual void mouseReleaseEvent(QMouseEvent* e) {
71  QListView::mouseReleaseEvent(e);
72  emit signalMouseReleaseEvent(e);
73  }
74  virtual void mouseMoveEvent(QMouseEvent* e) {
75  QListView::mouseMoveEvent(e);
76  emit signalMouseMoveEvent(e);
77  }
78  virtual void dragEnterEvent(QDragEnterEvent* e) {
79  QListView::dragEnterEvent(e);
80  emit signalDragEnterEvent(e);
81  }
82  virtual void dragMoveEvent(QDragMoveEvent* e) {
83  QListView::dragMoveEvent(e);
84  emit signalDragMoveEvent(e);
85  }
86  virtual void dropEvent(QDropEvent* e) {
87  QListView::dropEvent(e);
88  emit signalDropEvent(e);
89  }
90  virtual void startDrag(Qt::DropActions supportedActions) {
91  QListView::startDrag(supportedActions);
92  emit signalStartDrag(supportedActions);
93  }
94  virtual void selectionChanged(const QItemSelection& selected, const QItemSelection& deselected) {
95  QListView::selectionChanged(selected, deselected);
96  emit signalSelectionChanged(selected, deselected);
97  }
98  virtual void currentChanged(const QModelIndex& current, const QModelIndex& previous) {
99  QListView::currentChanged(current, previous);
100  emit signalCurrentChanged(current, previous);
101  }
102 
106  virtual bool event(QEvent* event) {
107  QHelpEvent* helpEvent = dynamic_cast<QHelpEvent*>(event);
108  if (event->type()==QEvent::ToolTip && helpEvent!=NULL) {
109  emit signalToolTipRequested(helpEvent);
110  event->accept();
111  return true;
112  }
113  return QListView::event(event);
114  }
115 };
116 
118 
119 #endif