Changeset 64401 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Oct 24, 2016 4:35:58 PM (8 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/extensions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QITreeView.cpp
r62493 r64401 20 20 #else /* !VBOX_WITH_PRECOMPILED_HEADERS */ 21 21 22 /* Global includes*/22 /* Qt includes: */ 23 23 # include <QMouseEvent> 24 24 # include <QPainter> 25 25 26 /* Local includes*/26 /* GUI includes: */ 27 27 # include "QITreeView.h" 28 28 … … 33 33 : QTreeView (aParent) 34 34 { 35 /* Mark header hidden: */ 35 36 setHeaderHidden (true); 37 /* Mark root hidden: */ 36 38 setRootIsDecorated (false); 37 39 } … … 39 41 void QITreeView::currentChanged (const QModelIndex &aCurrent, const QModelIndex &aPrevious) 40 42 { 43 /* Notify listeners about it: */ 41 44 emit currentItemChanged (aCurrent, aPrevious); 45 /* Call to base-class: */ 42 46 QTreeView::currentChanged (aCurrent, aPrevious); 43 47 } … … 45 49 void QITreeView::drawBranches (QPainter *aPainter, const QRect &aRect, const QModelIndex &aIndex) const 46 50 { 51 /* Notify listeners about it: */ 47 52 emit drawItemBranches (aPainter, aRect, aIndex); 53 /* Call to base-class: */ 48 54 QTreeView::drawBranches (aPainter, aRect, aIndex); 49 55 } … … 51 57 void QITreeView::mouseMoveEvent (QMouseEvent *aEvent) 52 58 { 59 /* Reject event initially: */ 53 60 aEvent->setAccepted (false); 61 /* Notify listeners about event allowing them to handle it: */ 54 62 emit mouseMoved (aEvent); 63 /* Call to base-class only if event was not yet accepted: */ 55 64 if (!aEvent->isAccepted()) 56 65 QTreeView::mouseMoveEvent (aEvent); … … 59 68 void QITreeView::mousePressEvent (QMouseEvent *aEvent) 60 69 { 70 /* Reject event initially: */ 61 71 aEvent->setAccepted (false); 72 /* Notify listeners about event allowing them to handle it: */ 62 73 emit mousePressed (aEvent); 74 /* Call to base-class only if event was not yet accepted: */ 63 75 if (!aEvent->isAccepted()) 64 76 QTreeView::mousePressEvent (aEvent); … … 67 79 void QITreeView::mouseDoubleClickEvent (QMouseEvent *aEvent) 68 80 { 81 /* Reject event initially: */ 69 82 aEvent->setAccepted (false); 83 /* Notify listeners about event allowing them to handle it: */ 70 84 emit mouseDoubleClicked (aEvent); 85 /* Call to base-class only if event was not yet accepted: */ 71 86 if (!aEvent->isAccepted()) 72 87 QTreeView::mouseDoubleClickEvent (aEvent); -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QITreeView.h
r62493 r64401 19 19 #define __QITreeView_h__ 20 20 21 /* Global includes*/21 /* Qt includes: */ 22 22 #include <QTreeView> 23 23 24 /* 25 * QITreeView class which extends standard QITreeView's functionality. 26 */ 24 25 /** QTreeView subclass extending standard functionality. */ 27 26 class QITreeView: public QTreeView 28 27 { … … 31 30 public: 32 31 32 /** Constructs table-view passing @a aParent to the base-class. */ 33 33 QITreeView (QWidget *aParent = 0); 34 34 35 35 signals: 36 36 37 /** Notifies listeners about index changed from @a aPrevious to @a aCurrent.*/ 37 38 void currentItemChanged (const QModelIndex &aCurrent, const QModelIndex &aPrevious); 39 40 /** Notifies listeners about painting of item branches. 41 * @param aPainter Brings the painter to draw branches. 42 * @param aRect Brings the rectangle embedding branches. 43 * @param aIndex Brings the index of the item for which branches will be painted. */ 38 44 void drawItemBranches (QPainter *aPainter, const QRect &aRect, const QModelIndex &aIndex) const; 45 46 /** Notifies listeners about mouse moved @a aEvent. */ 39 47 void mouseMoved (QMouseEvent *aEvent); 48 /** Notifies listeners about mouse pressed @a aEvent. */ 40 49 void mousePressed (QMouseEvent *aEvent); 50 /** Notifies listeners about mouse double-clicked @a aEvent. */ 41 51 void mouseDoubleClicked (QMouseEvent *aEvent); 42 52 43 53 protected slots: 44 54 55 /** Handles index changed from @a aPrevious to @a aCurrent.*/ 45 56 void currentChanged (const QModelIndex &aCurrent, const QModelIndex &aPrevious); 46 57 47 58 protected: 48 59 60 /** Handles painting of item branches. 61 * @param aPainter Brings the painter to draw branches. 62 * @param aRect Brings the rectangle embedding branches. 63 * @param aIndex Brings the index of the item for which branches will be painted. */ 49 64 void drawBranches (QPainter *aPainter, const QRect &aRect, const QModelIndex &aIndex) const; 65 66 /** Handles mouse move @a aEvent. */ 50 67 void mouseMoveEvent (QMouseEvent *aEvent); 68 /** Handles mouse press @a aEvent. */ 51 69 void mousePressEvent (QMouseEvent *aEvent); 70 /** Handles mouse double-click @a aEvent. */ 52 71 void mouseDoubleClickEvent (QMouseEvent *aEvent); 53 72 }; 54 73 55 #endif /* __QITreeView_h__ */74 #endif /* !__QITreeView_h__ */ 56 75
Note:
See TracChangeset
for help on using the changeset viewer.