VirtualBox

Changeset 43810 in vbox for trunk/src


Ignore:
Timestamp:
Nov 6, 2012 9:43:09 AM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: VM group UI: Some group-item cleanup.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.cpp

    r43809 r43810  
    362362        case GroupItemData_EnterButtonSize: return m_pEnterButton ? m_pEnterButton->minimumSizeHint().toSize() : QSize(0, 0);
    363363        case GroupItemData_ExitButtonSize: return m_pExitButton ? m_pExitButton->minimumSizeHint().toSize() : QSize(0, 0);
    364         case GroupItemData_MinimumNameSize:
    365         {
    366             if (isMainRoot())
    367                 return QSize(0, 0);
    368             QPaintDevice *pPaintDevice = model()->paintDevice();
    369             QFontMetrics fm(m_nameFont, pPaintDevice);
    370             int iMaximumTextWidth = textWidth(m_nameFont, pPaintDevice, 20);
    371             QString strCompressedName = compressText(m_nameFont, pPaintDevice, m_strName, iMaximumTextWidth);
    372             return QSize(fm.width(strCompressedName), fm.height());
    373         }
    374364        case GroupItemData_NameSize: return isMainRoot() ? QSize(0, 0) : textSize(m_nameFont, model()->paintDevice(),
    375365                                                                                  data(GroupItemData_Name).toString());
     
    514504    QSize exitButtonSize = data(GroupItemData_ExitButtonSize).toSize();
    515505    QSize toggleButtonSize = data(GroupItemData_ToggleButtonSize).toSize();
    516     QSize minimumNameSize = data(GroupItemData_MinimumNameSize).toSize();
    517506    QSize groupPixmapSize = data(GroupItemData_GroupPixmapSize).toSize();
    518507    QSize groupCountTextSize = data(GroupItemData_GroupCountTextSize).toSize();
     
    520509    QSize machineCountTextSize = data(GroupItemData_MachineCountTextSize).toSize();
    521510    QSize enterButtonSize = data(GroupItemData_EnterButtonSize).toSize();
     511
     512    /* Calculate minimum visible name size: */
     513    QPaintDevice *pPaintDevice = model()->paintDevice();
     514    QFontMetrics fm(m_nameFont, pPaintDevice);
     515    int iMaximumNameWidth = textWidth(m_nameFont, pPaintDevice, 20);
     516    QString strCompressedName = compressText(m_nameFont, pPaintDevice, m_strName, iMaximumNameWidth);
     517    int iMinimumNameWidth = fm.width(strCompressedName);
     518    int iMinimumNameHeight = fm.height();
    522519
    523520    /* Calculate minimum width: */
     
    531528                    iMajorSpacing +
    532529                    /* Minimum name width: */
    533                     minimumNameSize.width() +
     530                    iMinimumNameWidth +
    534531                    /* Spacing between name and info: */
    535532                    iMajorSpacing;
     
    554551        heights << toggleButtonSize.height();
    555552    heights /* Minimum name height: */
    556             << minimumNameSize.height()
     553            << iMinimumNameHeight
    557554            /* Group info height: */
    558555            << groupPixmapSize.height() << groupCountTextSize.height()
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.h

    r43809 r43810  
    116116        GroupItemData_EnterButtonSize,
    117117        GroupItemData_ExitButtonSize,
    118         GroupItemData_MinimumNameSize,
    119118        GroupItemData_NameSize,
    120119        GroupItemData_GroupPixmapSize,
Note: See TracChangeset for help on using the changeset viewer.

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