![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /********************************************************************* 00002 ** Copyright (c) 2007 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: dtTreeWidget.h,v $ $Revision: 1.7 $ $State: Exp $ 00007 *********************************************************************/ 00008 00011 00012 #ifndef DTTREEWIDGET_H_ 00013 #define DTTREEWIDGET_H_ 00014 00015 #include "tmqt/tmqtDefines.h" 00016 #include "symbolMapper/modelKey.h" 00017 00018 #include <QtGui/QTreeWidget> 00019 #include <QtGui/QKeyEvent> 00020 00021 class QMimeData; 00022 class DtModelData; 00023 00025 class DT_DLL_tmqt DtTreeWidget : public QTreeWidget 00026 { 00027 Q_OBJECT 00028 00029 public: 00031 DtTreeWidget(QWidget* parent); 00032 00034 virtual QTreeWidgetItem* lastItem() const; 00035 00037 QTreeWidgetItem* itemFromIndex(const QModelIndex& idx) { return QTreeWidget::itemFromIndex(idx); }; 00038 00040 QModelIndex indexFromItem(QTreeWidgetItem *item, int column = 0) const 00041 { 00042 return QTreeWidget::indexFromItem(item, column); 00043 } 00044 00046 virtual int indexOfChild(QTreeWidgetItem*) const; 00047 00049 unsigned int depth(QTreeWidgetItem*) const; 00050 00052 QTreeWidgetItem* nextSibling(QTreeWidgetItem*) const; 00053 00055 void setAllowEmptySelection(bool); 00056 00058 bool allowEmptySelection() const; 00059 00060 signals: 00061 00064 void mouseLeftPressed(QTreeWidgetItem*, QMouseEvent*, int col); 00065 00067 void rightClickOnItem(QTreeWidgetItem*, QMouseEvent*, int col); 00068 00070 void contentsMoving(int, int); 00071 00072 protected: 00073 00075 virtual void mousePressEvent(QMouseEvent *event); 00076 00078 virtual void mouseReleaseEvent(QMouseEvent *event); 00079 00081 virtual void scrollContentsBy(int, int); 00082 00084 virtual QSize sizeHint() const; 00085 00087 virtual QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex &index, 00088 const QEvent *event = 0) const; 00089 00091 virtual QItemSelectionModel::SelectionFlags selectionBehaviorFlags() const; 00092 00093 protected: 00094 00095 bool myMouseRightClick; 00096 bool myAllowEmptySelection; 00097 }; 00098 00099 inline void DtTreeWidget::setAllowEmptySelection(bool b) 00100 { 00101 myAllowEmptySelection = b; 00102 } 00103 00104 inline bool DtTreeWidget::allowEmptySelection() const 00105 { 00106 return myAllowEmptySelection; 00107 } 00108 00109 #endif //OverlayListView_H