![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /********************************************************************* 00002 ** Copyright (c) 2007 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: qtTreeWidgetExtensions.h,v $ $Revision: 1.7 $ $State: Exp $ 00007 *********************************************************************/ 00008 00011 00012 #pragma once 00013 00016 00017 #include <vrfGuiCoreQt/vrfGuiCoreQt.h> 00018 00019 #include <QtGui/QTreeWidget> 00020 #include <QtGui/QKeyEvent> 00021 00022 class QMimeData; 00023 00024 namespace makVrf 00025 { 00026 class DT_DLL_VRFGUICOREQT DtTreeWidget : public QTreeWidget 00027 { 00028 Q_OBJECT 00029 00030 public: 00032 DtTreeWidget(QWidget* parent); 00033 00035 virtual QTreeWidgetItem* lastItem() const; 00036 00038 QTreeWidgetItem* itemFromIndex(const QModelIndex& idx) { return QTreeWidget::itemFromIndex(idx); }; 00039 00041 QModelIndex indexFromItem(QTreeWidgetItem *item, int column = 0) const 00042 { 00043 return QTreeWidget::indexFromItem(item, column); 00044 } 00045 00047 virtual int indexOfChild(QTreeWidgetItem*) const; 00048 00050 unsigned int depth(QTreeWidgetItem*) const; 00051 00053 QTreeWidgetItem* nextSibling(QTreeWidgetItem*) const; 00054 00056 void setAllowEmptySelection(bool); 00057 00059 bool allowEmptySelection() const; 00060 00061 signals: 00062 00065 void mouseLeftPressed(QTreeWidgetItem*, QMouseEvent*, int col); 00066 00068 void rightClickOnItem(QTreeWidgetItem*, QMouseEvent*, int col); 00069 00071 void contentsMoving(int, int); 00072 00073 protected: 00074 00076 virtual void mousePressEvent(QMouseEvent *event); 00077 00079 virtual void mouseReleaseEvent(QMouseEvent *event); 00080 00082 virtual void scrollContentsBy(int, int); 00083 00085 virtual QSize sizeHint() const; 00086 00088 virtual QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex &index, 00089 const QEvent *event = 0) const; 00090 00092 virtual QItemSelectionModel::SelectionFlags selectionBehaviorFlags() const; 00093 00094 protected: 00095 00096 bool myMouseRightClick; 00097 bool myAllowEmptySelection; 00098 }; 00099 00100 inline void DtTreeWidget::setAllowEmptySelection(bool b) 00101 { 00102 myAllowEmptySelection = b; 00103 } 00104 00105 inline bool DtTreeWidget::allowEmptySelection() const 00106 { 00107 return myAllowEmptySelection; 00108 } 00109 }