VirtualBox

Changeset 77826 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 21, 2019 2:27:05 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9241: VirtualBox Manager: Chooser pane: Reworking margins and indents, remaining part, s.a. r129476. Syncing group item with machine/global items.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.cpp

    r77805 r77826  
    200200    /* Prepare variables: */
    201201    const QPoint pos = pEvent->pos().toPoint();
    202     const int iMargin = data(GroupItemData_VerticalMargin).toInt();
     202    const int iMarginV = data(GroupItemData_MarginV).toInt();
    203203    const int iHeaderHeight = m_minimumHeaderSize.height();
    204     const int iFullHeaderHeight = 2 * iMargin + iHeaderHeight;
     204    const int iFullHeaderHeight = 2 * iMarginV + iHeaderHeight;
    205205    /* Skip if hovered part out of the header: */
    206206    if (pos.y() >= iFullHeaderHeight)
     
    266266
    267267    /* Layout name-editor: */
    268     const int iMargin = data(GroupItemData_VerticalMargin).toInt();
    269     const int iHeaderHeight = 2 * iMargin + m_minimumHeaderSize.height();
     268    const int iMarginV = data(GroupItemData_MarginV).toInt();
     269    const int iHeaderHeight = 2 * iMarginV + m_minimumHeaderSize.height();
    270270    const QSize headerSize = QSize(geometry().width(), iHeaderHeight);
    271271    const QGraphicsView *pView = model()->scene()->views().first();
     
    573573{
    574574    /* Prepare variables: */
    575     const int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt();
    576     const int iVerticalMargin = data(GroupItemData_VerticalMargin).toInt();
     575    const int iMarginHL = data(GroupItemData_MarginHL).toInt();
     576    const int iMarginHR = data(GroupItemData_MarginHR).toInt();
     577    const int iMarginV = data(GroupItemData_MarginV).toInt();
    577578    const int iParentIndent = data(GroupItemData_ParentIndent).toInt();
    578579    const int iFullHeaderHeight = m_minimumHeaderSize.height();
     
    602603                /* Layout exit-button: */
    603604                int iExitButtonX = iHorizontalMargin;
    604                 int iExitButtonY = iExitButtonHeight == iFullHeaderHeight ? iVerticalMargin :
    605                                    iVerticalMargin + (iFullHeaderHeight - iExitButtonHeight) / 2;
     605                int iExitButtonY = iExitButtonHeight == iFullHeaderHeight ? iMarginV :
     606                                   iMarginV + (iFullHeaderHeight - iExitButtonHeight) / 2;
    606607                m_pExitButton->setPos(iExitButtonX, iExitButtonY);
    607608                /* Show exit-button: */
     
    610611
    611612            /* Prepare body indent: */
    612             iPreviousVerticalIndent = iVerticalMargin + iFullHeaderHeight + iVerticalMargin;
     613            iPreviousVerticalIndent = iMarginV + iFullHeaderHeight + iMarginV;
    613614        }
    614615#endif
     
    638639            int iToggleButtonHeight = m_toggleButtonSize.height();
    639640            /* Layout toggle-button: */
    640             int iToggleButtonX = iHorizontalMargin + iParentIndent * level();
    641             int iToggleButtonY = iToggleButtonHeight == iFullHeaderHeight ? iVerticalMargin :
    642                                  iVerticalMargin + (iFullHeaderHeight - iToggleButtonHeight) / 2;
     641            int iToggleButtonX = iMarginHL + iParentIndent * level();;
     642            int iToggleButtonY = iToggleButtonHeight == iFullHeaderHeight ? iMarginV :
     643                                 iMarginV + (iFullHeaderHeight - iToggleButtonHeight) / 2;
    643644            m_pToggleButton->setPos(iToggleButtonX, iToggleButtonY);
    644645            /* Show toggle-button: */
     
    654655            int iEnterButtonHeight = m_enterButtonSize.height();
    655656            /* Layout enter-button: */
    656             int iEnterButtonX = iFullWidth - iHorizontalMargin - iEnterButtonWidth;
    657             int iEnterButtonY = iEnterButtonHeight == iFullHeaderHeight ? iVerticalMargin :
    658                                 iVerticalMargin + (iFullHeaderHeight - iEnterButtonHeight) / 2;
     657            int iEnterButtonX = iFullWidth - iMarginHR - iEnterButtonWidth;
     658            int iEnterButtonY = iEnterButtonHeight == iFullHeaderHeight ? iMarginV :
     659                                iMarginV + (iFullHeaderHeight - iEnterButtonHeight) / 2;
    659660            m_pEnterButton->setPos(iEnterButtonX, iEnterButtonY);
    660661        }
    661662
    662663        /* Prepare body indent: */
    663         iPreviousVerticalIndent = 2 * iVerticalMargin + iFullHeaderHeight;
     664        iPreviousVerticalIndent = 2 * iMarginV + iFullHeaderHeight;
    664665
    665666        /* Adjust scroll-view geometry: */
     
    12301231    {
    12311232        /* Layout hints: */
    1232         case GroupItemData_HorizonalMargin: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4;
    1233         case GroupItemData_VerticalMargin:  return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2;
     1233        case GroupItemData_MarginHL:        return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2;
     1234        case GroupItemData_MarginHR:        return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4 * 5;
     1235        case GroupItemData_MarginV:         return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2;
    12341236        case GroupItemData_HeaderSpacing:   return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2;
    12351237        case GroupItemData_ChildrenSpacing: return 1;
     
    13731375    {
    13741376        /* Prepare variables: */
    1375         const int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt();
     1377        const int iMarginHL = data(GroupItemData_MarginHL).toInt();
     1378        const int iMarginHR = data(GroupItemData_MarginHR).toInt();
    13761379        const int iParentIndent = data(GroupItemData_ParentIndent).toInt();
    13771380
     
    13881391
    13891392        /* And 2 margins at last - left and right: */
    1390         iProposedWidth += 2 * iHorizontalMargin + iParentIndent * level();
     1393        iProposedWidth += iMarginHL + iMarginHR + iParentIndent * level();
    13911394    }
    13921395
     
    14151418    {
    14161419        /* Prepare variables: */
    1417         const int iVerticalMargin = data(GroupItemData_VerticalMargin).toInt();
     1420        const int iMarginV = data(GroupItemData_MarginV).toInt();
    14181421
    14191422        /* Group-item header have 2 margins - top and bottom: */
    1420         iProposedHeight += 2 * iVerticalMargin;
     1423        iProposedHeight += 2 * iMarginV;
    14211424        /* And header content height to take into account: */
    14221425        iProposedHeight += m_minimumHeaderSize.height();
     
    14511454
    14521455    /* Prepare variables: */
    1453     int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt();
     1456    int iMarginHL = data(GroupItemData_MarginHL).toInt();
     1457    int iMarginHR = data(GroupItemData_MarginHR).toInt();
    14541458    int iHeaderSpacing = data(GroupItemData_HeaderSpacing).toInt();
    14551459    int iToggleButtonWidth = m_toggleButtonSize.width();
     
    14631467
    14641468    /* Left margin: */
    1465     iMaximumWidth -= iHorizontalMargin;
     1469    iMaximumWidth -= iMarginHL;
    14661470    /* Button width: */
    14671471    if (isRoot())
     
    14861490    }
    14871491    /* Right margin: */
    1488     iMaximumWidth -= iHorizontalMargin;
     1492    iMaximumWidth -= iMarginHR;
    14891493    /* Calculate new visible name and name-size: */
    14901494    QPaintDevice *pPaintDevice = model()->paintDevice();
     
    16141618        {
    16151619            /* Prepare variables: */
    1616             const int iMargin = data(GroupItemData_VerticalMargin).toInt();
    1617             const int iFullHeaderHeight = 2 * iMargin + m_minimumHeaderSize.height();
     1620            const int iMarginV = data(GroupItemData_MarginV).toInt();
     1621            const int iFullHeaderHeight = 2 * iMarginV + m_minimumHeaderSize.height();
    16181622            QRect headerRect = QRect(0, 0, rect.width(), iFullHeaderHeight);
    16191623
     
    16301634    {
    16311635        /* Prepare variables: */
    1632         const int iMargin = data(GroupItemData_VerticalMargin).toInt();
    1633         const int iFullHeaderHeight = 2 * iMargin + m_minimumHeaderSize.height();
     1636        const int iMarginV = data(GroupItemData_MarginV).toInt();
     1637        const int iFullHeaderHeight = 2 * iMarginV + m_minimumHeaderSize.height();
    16341638
    16351639        /* Calculate top rectangle: */
     
    16831687
    16841688    /* Prepare variables: */
    1685     const int iMargin = data(GroupItemData_VerticalMargin).toInt();
    1686     const int iFullHeaderHeight = 2 * iMargin + m_minimumHeaderSize.height();
     1689    const int iMarginV = data(GroupItemData_MarginV).toInt();
     1690    const int iFullHeaderHeight = 2 * iMarginV + m_minimumHeaderSize.height();
    16871691
    16881692    /* Prepare color: */
     
    17171721
    17181722    /* Prepare variables: */
    1719     const int iHorizontalMargin = data(GroupItemData_HorizonalMargin).toInt();
    1720     const int iVerticalMargin = data(GroupItemData_VerticalMargin).toInt();
     1723    const int iMarginHL = data(GroupItemData_MarginHL).toInt();
     1724    const int iMarginHR = data(GroupItemData_MarginHR).toInt();
     1725    const int iMarginV = data(GroupItemData_MarginV).toInt();
    17211726    const int iHeaderSpacing = data(GroupItemData_HeaderSpacing).toInt();
    17221727    const int iParentIndent = data(GroupItemData_ParentIndent).toInt();
     
    17291734
    17301735    /* Paint name: */
    1731     int iNameX = iHorizontalMargin + iParentIndent * level();
     1736    int iNameX = iMarginHL + iParentIndent * level();
    17321737    if (isRoot())
    17331738        iNameX += m_exitButtonSize.width();
     
    17351740        iNameX += m_toggleButtonSize.width();
    17361741    iNameX += iHeaderSpacing;
    1737     int iNameY = m_visibleNameSize.height() == iFullHeaderHeight ? iVerticalMargin :
    1738                  iVerticalMargin + (iFullHeaderHeight - m_visibleNameSize.height()) / 2;
     1742    int iNameY = m_visibleNameSize.height() == iFullHeaderHeight ? iMarginV :
     1743                 iMarginV + (iFullHeaderHeight - m_visibleNameSize.height()) / 2;
    17391744    paintText(/* Painter: */
    17401745              pPainter,
     
    17551760
    17561761        /* Indent: */
    1757         int iHorizontalIndent = rect.right() - iHorizontalMargin;
     1762        int iHorizontalIndent = rect.right() - iMarginHR;
    17581763        if (!isRoot())
    17591764            iHorizontalIndent -= iEnterButtonWidth;
     
    17651770            int iMachineCountTextX = iHorizontalIndent;
    17661771            int iMachineCountTextY = m_infoSizeMachines.height() == iFullHeaderHeight ?
    1767                                      iVerticalMargin : iVerticalMargin + (iFullHeaderHeight - m_infoSizeMachines.height()) / 2;
     1772                                     iMarginV : iMarginV + (iFullHeaderHeight - m_infoSizeMachines.height()) / 2;
    17681773            paintText(/* Painter: */
    17691774                      pPainter,
     
    17801785            int iMachinePixmapX = iHorizontalIndent;
    17811786            int iMachinePixmapY = m_pixmapSizeMachines.height() == iFullHeaderHeight ?
    1782                                   iVerticalMargin : iVerticalMargin + (iFullHeaderHeight - m_pixmapSizeMachines.height()) / 2;
     1787                                  iMarginV : iMarginV + (iFullHeaderHeight - m_pixmapSizeMachines.height()) / 2;
    17831788            paintPixmap(/* Painter: */
    17841789                        pPainter,
     
    17951800            int iGroupCountTextX = iHorizontalIndent;
    17961801            int iGroupCountTextY = m_infoSizeGroups.height() == iFullHeaderHeight ?
    1797                                    iVerticalMargin : iVerticalMargin + (iFullHeaderHeight - m_infoSizeGroups.height()) / 2;
     1802                                   iMarginV : iMarginV + (iFullHeaderHeight - m_infoSizeGroups.height()) / 2;
    17981803            paintText(/* Painter: */
    17991804                      pPainter,
     
    18101815            int iGroupPixmapX = iHorizontalIndent;
    18111816            int iGroupPixmapY = m_pixmapSizeGroups.height() == iFullHeaderHeight ?
    1812                                 iVerticalMargin : iVerticalMargin + (iFullHeaderHeight - m_pixmapSizeGroups.height()) / 2;
     1817                                iMarginV : iMarginV + (iFullHeaderHeight - m_pixmapSizeGroups.height()) / 2;
    18131818            paintPixmap(/* Painter: */
    18141819                        pPainter,
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.h

    r77723 r77826  
    216216    {
    217217        /* Layout hints: */
    218         GroupItemData_HorizonalMargin,
    219         GroupItemData_VerticalMargin,
     218        GroupItemData_MarginHL,
     219        GroupItemData_MarginHR,
     220        GroupItemData_MarginV,
    220221        GroupItemData_HeaderSpacing,
    221222        GroupItemData_ChildrenSpacing,
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp

    r77805 r77826  
    567567    {
    568568        /* Layout hints: */
    569         case MachineItemData_MarginHL:       return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
    570         case MachineItemData_MarginHR:       return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4 * 5;
    571         case MachineItemData_MarginV:       return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4 * 3;
     569        case MachineItemData_MarginHL:     return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
     570        case MachineItemData_MarginHR:     return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4 * 5;
     571        case MachineItemData_MarginV:      return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4 * 3;
    572572        case MachineItemData_MajorSpacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2;
    573573        case MachineItemData_MinorSpacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4;
     
    578578        /* Pixmaps: */
    579579        case MachineItemData_SettingsButtonPixmap: return UIIconPool::iconSet(":/vm_settings_16px.png");
    580         case MachineItemData_StartButtonPixmap: return UIIconPool::iconSet(":/vm_start_16px.png");
    581         case MachineItemData_PauseButtonPixmap: return UIIconPool::iconSet(":/vm_pause_16px.png");
    582         case MachineItemData_CloseButtonPixmap: return UIIconPool::iconSet(":/exit_16px.png");
     580        case MachineItemData_StartButtonPixmap:    return UIIconPool::iconSet(":/vm_start_16px.png");
     581        case MachineItemData_PauseButtonPixmap:    return UIIconPool::iconSet(":/vm_pause_16px.png");
     582        case MachineItemData_CloseButtonPixmap:    return UIIconPool::iconSet(":/exit_16px.png");
    583583
    584584        /* Default: */
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