Changeset 108309 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Feb 20, 2025 12:54:11 PM (2 months ago)
- svn:sync-xref-src-repo-rev:
- 167653
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsItem.cpp
r108295 r108309 452 452 #endif /* !VBOX_WS_MAC && !VBOX_WS_WIN */ 453 453 454 /* Prepare fonts: */455 m_nameFont = font();456 m_nameFont.setWeight(QFont::Bold);457 458 454 /* Configure item options: */ 459 455 setOwnedByLayout(false); … … 568 564 { 569 565 /* Layout hints: */ 570 case ToolsItemData_Margin: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 3 * 2;566 case ToolsItemData_Margin: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 3 * 2; 571 567 case ToolsItemData_Spacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2; 572 568 case ToolsItemData_Padding: return 4; 569 570 /* Font hints: */ 571 case Qt::FontRole: 572 { 573 /* Init font: */ 574 QFont fnt = font(); 575 fnt.setWeight(QFont::Bold); 576 577 /* Make Machine tool font smaller for widget mode: */ 578 if (!model()->isPopup() && itemClass() == UIToolClass_Machine) 579 fnt.setPointSize(fnt.pointSize() - 1); 580 581 /* Return font: */ 582 return fnt; 583 } 573 584 574 585 /* Default: */ … … 602 613 void UIToolsItem::updateNameSize() 603 614 { 604 /* Prepare variables: */605 QPaintDevice *pPaintDevice = model()->paintDevice();606 607 615 /* Calculate new name size: */ 608 const QFontMetrics fm( m_nameFont, pPaintDevice);616 const QFontMetrics fm(data(Qt::FontRole).value<QFont>(), model()->paintDevice()); 609 617 const QSize nameSize = QSize(fm.horizontalAdvance(m_strName), fm.height()); 610 618 … … 920 928 QPoint(iNameX, iNameY), 921 929 /* Font to paint text: */ 922 m_nameFont,930 data(Qt::FontRole).value<QFont>(), 923 931 /* Paint device: */ 924 932 model()->paintDevice(), -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsItem.h
r108308 r108309 271 271 /** Holds the item pixmap. */ 272 272 QPixmap m_pixmap; 273 /** Holds the item name font. */274 QFont m_nameFont;275 273 276 274 /** Holds the hiding reason. */
Note:
See TracChangeset
for help on using the changeset viewer.