Changeset 74088 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Sep 5, 2018 4:34:53 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/extensions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QISplitter.cpp
r74087 r74088 33 33 34 34 35 /** QSplitterHandle subclass representing flat line. */ 36 class QIFlatSplitterHandle : public QSplitterHandle 37 { 38 Q_OBJECT; 39 40 public: 41 42 /** Constructs flat splitter handle passing @a enmOrientation and @a pParent to the base-class. */ 43 QIFlatSplitterHandle(Qt::Orientation enmOrientation, QISplitter *pParent); 44 45 /** Defines @a color. */ 46 void configureColor(const QColor &color); 47 48 protected: 49 50 /** Handles paint @a pEvent. */ 51 virtual void paintEvent(QPaintEvent *pEvent) /* override */; 52 53 private: 54 55 /** Holds the main color. */ 56 QColor m_color; 57 }; 58 59 35 60 /** QSplitterHandle subclass representing shaded line. */ 36 61 class QIShadeSplitterHandle : public QSplitterHandle … … 82 107 }; 83 108 #endif /* VBOX_WS_MAC */ 109 110 111 /********************************************************************************************************************************* 112 * Class QIFlatSplitterHandle implementation. * 113 *********************************************************************************************************************************/ 114 115 QIFlatSplitterHandle::QIFlatSplitterHandle(Qt::Orientation enmOrientation, QISplitter *pParent) 116 : QSplitterHandle(enmOrientation, pParent) 117 { 118 } 119 120 void QIFlatSplitterHandle::configureColor(const QColor &color) 121 { 122 m_color = color; 123 update(); 124 } 125 126 void QIFlatSplitterHandle::paintEvent(QPaintEvent *pEvent) 127 { 128 QPainter painter(this); 129 painter.fillRect(pEvent->rect(), m_color); 130 } 84 131 85 132 … … 205 252 { 206 253 qApp->installEventFilter(this); 254 } 255 256 void QISplitter::configureColor(const QColor &color) 257 { 258 m_color = color; 259 QIFlatSplitterHandle *pHandle = qobject_cast<QIFlatSplitterHandle*>(handle(1)); 260 if (pHandle && m_color.isValid()) 261 pHandle->configureColor(m_color); 207 262 } 208 263 … … 332 387 switch (m_enmType) 333 388 { 389 case Flat: 390 { 391 QIFlatSplitterHandle *pHandle = new QIFlatSplitterHandle(orientation(), this); 392 if (m_color.isValid()) 393 pHandle->configureColor(m_color); 394 return pHandle; 395 } 334 396 case Shade: 335 397 { -
trunk/src/VBox/Frontends/VirtualBox/src/extensions/QISplitter.h
r74087 r74088 36 36 37 37 /** Handle types. */ 38 enum Type { Shade, Native };38 enum Type { Flat, Shade, Native }; 39 39 40 40 /** Constructs splitter passing @a pParent to the base-class. */ … … 44 44 QISplitter(Qt::Orientation enmOrientation, Type enmType, QWidget *pParent = 0); 45 45 46 /** Configure custom color defined as @a color. */ 47 void configureColor(const QColor &color); 46 48 /** Configure custom colors defined as @a color1 and @a color2. */ 47 49 void configureColors(const QColor &color1, const QColor &color2); … … 73 75 #endif 74 76 77 /** Holds color. */ 78 QColor m_color; 75 79 /** Holds color1. */ 76 80 QColor m_color1;
Note:
See TracChangeset
for help on using the changeset viewer.