VirtualBox

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


Ignore:
Timestamp:
Sep 6, 2018 10:37:46 AM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: VirtualBox Manager UI: Details pane re-styling: Syncing margins and spacings with Chooser pane; let the System element get spare vertical space if any.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager/details
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsGroup.cpp

    r74110 r74111  
    105105{
    106106    /* Prepare variables: */
    107     int iMargin = data(GroupData_Margin).toInt();
    108     int iSpacing = data(GroupData_Spacing).toInt();
    109     int iMaximumWidth = (int)geometry().width() - 2 * iMargin;
     107    const int iMargin = data(GroupData_Margin).toInt();
     108    const int iSpacing = data(GroupData_Spacing).toInt();
     109    const int iMaximumWidth = geometry().size().toSize().width();
    110110    int iVerticalIndent = iMargin;
    111111
     
    118118                continue;
    119119        /* Move set: */
    120         pItem->setPos(iMargin, iVerticalIndent);
     120        pItem->setPos(0, iVerticalIndent);
    121121        /* Resize set: */
    122         int iWidth = iMaximumWidth;
    123         pItem->resize(iWidth, pItem->minimumHeightHint());
     122        pItem->resize(iMaximumWidth, pItem->minimumHeightHint());
    124123        /* Layout set content: */
    125124        pItem->updateLayout();
     
    132131{
    133132    /* Prepare variables: */
    134     int iMargin = data(GroupData_Margin).toInt();
    135133    int iMinimumWidthHint = 0;
    136134
     
    149147    }
    150148
    151     /* Add two margins finally: */
    152     if (fHasItems)
    153         iMinimumWidthHint += 2 * iMargin;
    154 
    155149    /* Return result: */
    156150    return iMinimumWidthHint;
     
    160154{
    161155    /* Prepare variables: */
    162     int iMargin = data(GroupData_Margin).toInt();
    163     int iSpacing = data(GroupData_Spacing).toInt();
     156    const int iMargin = data(GroupData_Margin).toInt();
     157    const int iSpacing = data(GroupData_Spacing).toInt();
    164158    int iMinimumHeightHint = 0;
     159    bool fHasItems = false;
    165160
    166161    /* For each the set we have: */
    167     bool fHasItems = false;
    168162    foreach (UIDetailsItem *pItem, items())
    169163    {
     
    307301        /* Layout hints: */
    308302        case GroupData_Margin: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 6;
    309         case GroupData_Spacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2;
     303        case GroupData_Spacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 6;
    310304        /* Default: */
    311305        default: break;
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsSet.cpp

    r74044 r74111  
    300300{
    301301    /* Prepare variables: */
    302     int iMargin = data(SetData_Margin).toInt();
    303     int iSpacing = data(SetData_Spacing).toInt();
    304     int iMaximumWidth = geometry().size().toSize().width();
    305     int iVerticalIndent = iMargin;
     302    const int iMargin = data(SetData_Margin).toInt();
     303    const int iSpacing = data(SetData_Spacing).toInt();
     304    const int iMaximumWidth = geometry().size().toSize().width();
     305    int iVerticalIndent = 0;
    306306
    307307    /* Layout all the elements: */
     
    329329            {
    330330                /* Move element: */
    331                 pElement->setPos(iMargin, iVerticalIndent);
     331                pElement->setPos(0, iVerticalIndent);
    332332                /* Calculate required width: */
    333                 int iWidth = iMaximumWidth - 2 * iMargin;
     333                int iWidth = iMaximumWidth;
    334334                if (pElement->elementType() == DetailsElementType_General ||
    335335                    pElement->elementType() == DetailsElementType_System)
     
    345345                /* Acquire required height: */
    346346                int iHeight = pElement->minimumHeightHint();
     347                if (pElement->elementType() == DetailsElementType_System)
     348                    if (UIDetailsElement *pPreviewElement = element(DetailsElementType_Preview))
     349                        if (pPreviewElement->isVisible())
     350                        {
     351                            int iSpareHeight = pPreviewElement->minimumHeightHint();
     352                            if (UIDetailsElement *pGeneralElement = element(DetailsElementType_General))
     353                                if (pGeneralElement->isVisible())
     354                                    iSpareHeight -= (iSpacing + pGeneralElement->minimumHeightHint());
     355                            iHeight = qMax(iHeight, iSpareHeight);
     356                        }
    347357                /* If element height is wrong: */
    348358                if (pElement->geometry().height() != iHeight)
     
    363373                int iHeight = pElement->minimumHeightHint();
    364374                /* Move element: */
    365                 pElement->setPos(iMaximumWidth - iMargin - iWidth, iMargin);
     375                pElement->setPos(iMaximumWidth - iWidth, iMargin);
    366376                /* Resize element: */
    367377                pElement->resize(iWidth, iHeight);
     
    384394
    385395    /* Prepare variables: */
    386     int iMargin = data(SetData_Margin).toInt();
    387     int iSpacing = data(SetData_Spacing).toInt();
     396    const int iSpacing = data(SetData_Spacing).toInt();
    388397    int iMinimumWidthHint = 0;
    389398
     
    428437    }
    429438
    430     /* And two margins finally: */
    431     iMinimumWidthHint += 2 * iMargin;
    432 
    433439    /* Return result: */
    434440    return iMinimumWidthHint;
     
    546552        /* Layout hints: */
    547553        case SetData_Margin: return 0;
    548         case SetData_Spacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 5;
     554        case SetData_Spacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 6;
    549555        /* Default: */
    550556        default: break;
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