Changeset 88272 in vbox
- Timestamp:
- Mar 24, 2021 12:06:05 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIToolBox.cpp
r88266 r88272 31 31 #include "UIWizardNewVM.h" 32 32 33 /********************************************************************************************************************************* 34 * UIToolPageButton definition. * 35 *********************************************************************************************************************************/ 36 /** A QAbstractButton extension used to show collapse/expand icons. More importantly 37 * it is buddy to the title label which may include some mnemonics. This makes it possible 38 * to expand pages via keyboard. */ 33 39 class UIToolPageButton : public QAbstractButton 34 40 { 41 35 42 Q_OBJECT; 43 36 44 public: 45 37 46 UIToolPageButton(QWidget *pParent = 0); 38 47 void setPixmap(const QPixmap &pixmap); 48 39 49 protected: 50 40 51 virtual void paintEvent(QPaintEvent *pEvent) /* override */; 41 52 virtual QSize sizeHint() const /* override */; 53 42 54 private: 55 56 /** Holds the pixmap of the expand/collapser icon. We keep 57 * QPixmap instead of QIcon since it is rotated when the 58 * the page is expanded and end product of rotation is a pixmap. 59 * and we use QPainter to draw pixmap.*/ 43 60 QPixmap m_pixmap; 44 61 }; 45 46 UIToolPageButton::UIToolPageButton(QWidget *pParent /* = 0 */)47 :QAbstractButton(pParent)48 {49 }50 51 void UIToolPageButton::paintEvent(QPaintEvent *pEvent)52 {53 Q_UNUSED(pEvent);54 if (!m_pixmap.isNull())55 {56 QPainter painter(this);57 painter.drawPixmap(0, 0, m_pixmap.width(), m_pixmap.height(), m_pixmap);58 }59 }60 61 void UIToolPageButton::setPixmap(const QPixmap &pixmap)62 {63 m_pixmap = pixmap;64 update();65 }66 67 QSize UIToolPageButton::sizeHint() const68 {69 if (m_pixmap.isNull())70 return QSize (0,0);71 return m_pixmap.size();72 }73 62 74 63 /********************************************************************************************************************************* … … 128 117 129 118 /********************************************************************************************************************************* 119 * UIToolPageButton implementation. * 120 *********************************************************************************************************************************/ 121 122 UIToolPageButton::UIToolPageButton(QWidget *pParent /* = 0 */) 123 :QAbstractButton(pParent) 124 { 125 } 126 127 void UIToolPageButton::paintEvent(QPaintEvent *pEvent) 128 { 129 Q_UNUSED(pEvent); 130 if (!m_pixmap.isNull()) 131 { 132 QPainter painter(this); 133 painter.drawPixmap(0, 0, m_pixmap.width(), m_pixmap.height(), m_pixmap); 134 } 135 } 136 137 void UIToolPageButton::setPixmap(const QPixmap &pixmap) 138 { 139 m_pixmap = pixmap; 140 update(); 141 } 142 143 QSize UIToolPageButton::sizeHint() const 144 { 145 if (m_pixmap.isNull()) 146 return QSize (0,0); 147 return m_pixmap.size(); 148 } 149 150 /********************************************************************************************************************************* 130 151 * UIToolBoxPage implementation. * 131 152 *********************************************************************************************************************************/
Note:
See TracChangeset
for help on using the changeset viewer.