Changeset 52708 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Sep 11, 2014 4:29:54 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIStatusBarEditorWindow.cpp
r52649 r52708 96 96 /** Holds the button pixmap. */ 97 97 QPixmap m_pixmap; 98 /** Holds the button pixmap size. */ 99 QSize m_pixmapSize; 98 100 /** Holds whether button is checked. */ 99 101 bool m_fChecked; … … 205 207 /* Prepare icon for assigned type: */ 206 208 const QIcon icon = gpConverter->toIcon(m_type); 209 m_pixmapSize = icon.availableSizes().first(); 210 m_pixmap = icon.pixmap(m_pixmapSize); 211 207 212 /* Cache button size-hint: */ 208 213 QStyleOptionButton option; 209 214 option.initFrom(this); 210 215 const QRect minRect = QApplication::style()->subElementRect(QStyle::SE_CheckBoxIndicator, &option); 211 m_size = icon.availableSizes().first().expandedTo(minRect.size()); 212 /* Cache pixmap of same size: */ 213 m_pixmap = icon.pixmap(m_size); 216 m_size = m_pixmapSize.expandedTo(minRect.size()); 214 217 215 218 /* Translate finally: */ … … 253 256 /* Draw pixmap for unhovered-state: */ 254 257 else 255 painter.drawItemPixmap(option.rect, Qt::AlignCenter, m_pixmap); 258 { 259 QRect pixmapRect = QRect(QPoint(0, 0), m_pixmapSize); 260 pixmapRect.moveCenter(option.rect.center()); 261 painter.drawItemPixmap(pixmapRect, Qt::AlignCenter, m_pixmap); 262 } 256 263 } 257 264
Note:
See TracChangeset
for help on using the changeset viewer.