- Timestamp:
- Sep 30, 2016 1:16:49 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/QITreeWidget.cpp
r62493 r64109 20 20 #else /* !VBOX_WITH_PRECOMPILED_HEADERS */ 21 21 22 /* Global includes*/22 /* Qt includes: */ 23 23 # include <QPainter> 24 24 # include <QResizeEvent> 25 25 26 /* Local includes*/26 /* GUI includes: */ 27 27 # include "QITreeWidget.h" 28 28 … … 30 30 31 31 32 QITreeWidget::QITreeWidget 33 : QTreeWidget 32 QITreeWidget::QITreeWidget(QWidget *aParent) 33 : QTreeWidget(aParent) 34 34 { 35 35 } … … 37 37 void QITreeWidget::setSizeHintForItems(const QSize &sizeHint) 38 38 { 39 /* Pass the sizeHint to all the top-level items: */ 39 40 for (int i = 0; i < topLevelItemCount(); ++i) 40 41 topLevelItem(i)->setSizeHint(0, sizeHint); 41 42 } 42 43 43 void QITreeWidget::paintEvent (QPaintEvent *aEvent)44 void QITreeWidget::paintEvent(QPaintEvent *pEvent) 44 45 { 45 /* Opens Items Painter*/46 /* Create item painter: */ 46 47 QPainter painter; 47 painter.begin 48 painter.begin(viewport()); 48 49 49 /* Notify connected objects about painting*/50 QTreeWidgetItemIterator it 50 /* Notify listeners about painting: */ 51 QTreeWidgetItemIterator it(this); 51 52 while (*it) 52 53 { 53 emit painted 54 ++ 54 emit painted(*it, &painter); 55 ++it; 55 56 } 56 57 57 /* Close Items Painter*/58 /* Close item painter: */ 58 59 painter.end(); 59 60 60 /* Base-class paint-event*/61 QTreeWidget::paintEvent (aEvent);61 /* Call to base-class: */ 62 QTreeWidget::paintEvent(pEvent); 62 63 } 63 64 64 void QITreeWidget::resizeEvent (QResizeEvent *aEvent)65 void QITreeWidget::resizeEvent(QResizeEvent *pEvent) 65 66 { 66 /* Base-class resize-event*/67 QTreeWidget::resizeEvent (aEvent);67 /* Call to base-class: */ 68 QTreeWidget::resizeEvent(pEvent); 68 69 69 /* Notify connected objects about resize*/70 emit resized (aEvent->size(), aEvent->oldSize());70 /* Notify listeners about resizing: */ 71 emit resized(pEvent->size(), pEvent->oldSize()); 71 72 } 72 73 -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QITreeWidget.h
r62493 r64109 16 16 */ 17 17 18 #ifndef __ QITreeWidget_h__19 #define __ QITreeWidget_h__18 #ifndef ___QITreeWidget_h___ 19 #define ___QITreeWidget_h___ 20 20 21 /* Global includes*/21 /* Qt includes: */ 22 22 #include <QTreeWidget> 23 23 24 /* 25 * QTreeWidget class which extends standard QTreeWidget's functionality. 26 */ 27 class QITreeWidget: public QTreeWidget 24 25 /** QTreeWidget subclass extending standard functionality. */ 26 class QITreeWidget : public QTreeWidget 28 27 { 29 28 Q_OBJECT; 30 29 30 signals: 31 32 /** Notifies about particular tree-widget @a pItem is painted with @a pPainter. */ 33 void painted(QTreeWidgetItem *pItem, QPainter *pPainter); 34 /** Notifies about tree-widget being resized from @a oldSize to @a size. */ 35 void resized(const QSize &size, const QSize &oldSize); 36 31 37 public: 32 38 33 QITreeWidget (QWidget *aParent = 0); 39 /** Constructs tree-widget passing @a pParent to the base-class. */ 40 QITreeWidget(QWidget *pParent = 0); 34 41 42 /** Defines @a sizeHint for tree-widget items. */ 35 43 void setSizeHintForItems(const QSize &sizeHint); 36 37 signals:38 39 void painted (QTreeWidgetItem *aItem, QPainter *aPainter);40 void resized (const QSize &aSize, const QSize &aOldSize);41 44 42 45 protected: 43 46 44 void paintEvent (QPaintEvent *aEvent); 45 void resizeEvent (QResizeEvent *aEvent); 47 /** Handles paint @a pEvent. */ 48 void paintEvent(QPaintEvent *pEvent); 49 /** Handles resize @a pEvent. */ 50 void resizeEvent(QResizeEvent *pEvent); 46 51 }; 47 52 48 #endif /* __QITreeWidget_h__ */53 #endif /* !___QITreeWidget_h___ */ 49 54
Note:
See TracChangeset
for help on using the changeset viewer.