Changeset 89276 in vbox for trunk/src/VBox
- Timestamp:
- May 25, 2021 3:49:20 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/wizards/UIWizard.cpp
r87001 r89276 20 20 #include <QLayout> 21 21 #include <QStyle> 22 #include <QWindow> 22 23 23 24 /* GUI includes: */ … … 497 498 void UIWizard::assignWatermarkHelper() 498 499 { 499 /* Calculate metric and ratio: */500 const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize);501 const double dRatio = (double)iIconMetric / 32;502 500 /* Load pixmap to icon first: */ 503 501 QIcon icon = UIIconPool::iconSet(m_strWatermarkName); 504 QSize size = icon.availableSizes().value(0, QSize(145, 290)); 505 size *= dRatio; 506 /* Create initial watermark: */ 507 QPixmap pixWaterMark(icon.pixmap(size)); 502 /* Create initial watermark pixmap. 503 * For HiDPI support parent-widget's device pixel ratio is to be taken into account: */ 504 QPixmap pixWaterMark( parentWidget() 505 ? icon.pixmap(parentWidget()->windowHandle(), QSize(145, 290)) 506 : icon.pixmap(QSize(145, 290))); 508 507 /* Convert watermark to image which 509 508 * allows to manage pixel data directly: */ … … 540 539 /* Convert processed image to pixmap and assign it to wizard's watermark. */ 541 540 QPixmap pixWatermarkNew = QPixmap::fromImage(imgWatermarkNew); 541 /* For HiDPI support parent-widget's device pixel ratio is to be taken into account: */ 542 const double dRatio = parentWidget()->windowHandle()->devicePixelRatio(); 543 pixWatermarkNew.setDevicePixelRatio(dRatio); 544 /* Assign watermark finally: */ 542 545 setPixmap(QWizard::WatermarkPixmap, pixWatermarkNew); 543 546 }
Note:
See TracChangeset
for help on using the changeset viewer.