VirtualBox

Changeset 108309 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Feb 20, 2025 12:54:11 PM (2 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
167653
Message:

FE/Qt: bugref:10814: VBox Manager / Tools pane: Smaller font size for Machine tools in widget mode.

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  
    452452#endif /* !VBOX_WS_MAC && !VBOX_WS_WIN */
    453453
    454     /* Prepare fonts: */
    455     m_nameFont = font();
    456     m_nameFont.setWeight(QFont::Bold);
    457 
    458454    /* Configure item options: */
    459455    setOwnedByLayout(false);
     
    568564    {
    569565        /* 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;
    571567        case ToolsItemData_Spacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2;
    572568        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        }
    573584
    574585        /* Default: */
     
    602613void UIToolsItem::updateNameSize()
    603614{
    604     /* Prepare variables: */
    605     QPaintDevice *pPaintDevice = model()->paintDevice();
    606 
    607615    /* Calculate new name size: */
    608     const QFontMetrics fm(m_nameFont, pPaintDevice);
     616    const QFontMetrics fm(data(Qt::FontRole).value<QFont>(), model()->paintDevice());
    609617    const QSize nameSize = QSize(fm.horizontalAdvance(m_strName), fm.height());
    610618
     
    920928                      QPoint(iNameX, iNameY),
    921929                      /* Font to paint text: */
    922                       m_nameFont,
     930                      data(Qt::FontRole).value<QFont>(),
    923931                      /* Paint device: */
    924932                      model()->paintDevice(),
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsItem.h

    r108308 r108309  
    271271        /** Holds the item pixmap. */
    272272        QPixmap  m_pixmap;
    273         /** Holds the item name font. */
    274         QFont    m_nameFont;
    275273
    276274        /** Holds the hiding reason. */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette