- Timestamp:
- Oct 30, 2023 1:38:39 PM (16 months ago)
- svn:sync-xref-src-repo-rev:
- 159747
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/softkeyboard/UISoftKeyboard.cpp
r101563 r101658 402 402 * The position of a key within the physical layout is read from the layout file. Note that UISoftKeyboardKey usually does not have 403 403 * caption field(s). Captions are kept by UISoftKeyboardLayout since same keys may (and usually do) have different captions in 404 * different layouts. So called static captions are ex ections. They are defined in physical layout files and kept as member of404 * different layouts. So called static captions are exceptions. They are defined in physical layout files and kept as member of 405 405 * UISoftKeyboardKey. When a static caption exits captions (if any) from the keyboard layout files are ignored. */ 406 406 class UISoftKeyboardKey … … 449 449 450 450 void setImageByName(const QString &strCaption); 451 const QImage &image() const;451 QPixmap image() const; 452 452 453 453 void setParentWidget(UISoftKeyboardWidget* pParent); … … 517 517 bool m_fIsOSMenuKey; 518 518 double m_fCornerRadius; 519 QI mage m_image;519 QIcon m_icon; 520 520 }; 521 521 … … 1733 1733 if (strImageFileName.isEmpty()) 1734 1734 return; 1735 m_image = QImage(QString(":/%1").arg(strImageFileName)); 1736 } 1737 1738 const QImage &UISoftKeyboardKey::image() const 1739 { 1740 return m_image; 1735 m_icon = UIIconPool::iconSet(QString(":/%1").arg(strImageFileName)); 1736 } 1737 1738 QPixmap UISoftKeyboardKey::image() const 1739 { 1740 QPixmap pixmap; 1741 1742 /* Check whether we have valid icon: */ 1743 if (!m_icon.isNull()) 1744 { 1745 /* Determine desired icon size: */ 1746 const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize); 1747 const QSize iconSize = QSize(iIconMetric, iIconMetric); 1748 /* Get pixmap of requested size (take into account the DPI of the main shown window, if possible): */ 1749 const qreal fDevicePixelRatio = windowManager().mainWindowShown() && windowManager().mainWindowShown()->windowHandle() 1750 ? windowManager().mainWindowShown()->windowHandle()->devicePixelRatio() : 1; 1751 pixmap = m_icon.pixmap(iconSize, fDevicePixelRatio); 1752 } 1753 1754 return pixmap; 1741 1755 } 1742 1756 … … 2185 2199 int iMargin = 0.1 * qMax(keyGeometry.width(), keyGeometry.height()); 2186 2200 int size = qMin(keyGeometry.width() - 2 * iMargin, keyGeometry.height() - 2 * iMargin); 2187 painter.draw Image(QRect(0.5 * (keyGeometry.width() - size), 0.5 * (keyGeometry.height() - size),2201 painter.drawPixmap(QRect(0.5 * (keyGeometry.width() - size), 0.5 * (keyGeometry.height() - size), 2188 2202 size, size), key.image()); 2189 2203 }
Note:
See TracChangeset
for help on using the changeset viewer.