- Timestamp:
- Nov 16, 2017 12:14:46 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/graphics/UIGraphicsButton.cpp
r69641 r69712 87 87 { 88 88 /* Prepare variables: */ 89 int iMargin = data(GraphicsButton_Margin).toInt(); 90 QIcon icon = data(GraphicsButton_Icon).value<QIcon>(); 91 QSize iconSize = data(GraphicsButton_IconSize).toSize(); 89 const int iMargin = data(GraphicsButton_Margin).toInt(); 90 const QIcon icon = data(GraphicsButton_Icon).value<QIcon>(); 91 const QSize expectedIconSize = data(GraphicsButton_IconSize).toSize(); 92 const QPixmap pixmap = icon.pixmap(expectedIconSize); 93 const QSize actualIconSize = pixmap.size() / pixmap.devicePixelRatio(); 94 QPoint position = QPoint(iMargin, iMargin); 95 if (actualIconSize != expectedIconSize) 96 { 97 const int iDx = (expectedIconSize.width() - actualIconSize.width()) / 2; 98 const int iDy = (expectedIconSize.height() - actualIconSize.height()) / 2; 99 position += QPoint(iDx, iDy); 100 } 92 101 93 102 /* Just draw the pixmap: */ 94 pPainter->drawPixmap( QRect(QPoint(iMargin, iMargin), iconSize), icon.pixmap(iconSize));103 pPainter->drawPixmap(position, pixmap); 95 104 } 96 105
Note:
See TracChangeset
for help on using the changeset viewer.