VirtualBox

Changeset 69821 in vbox


Ignore:
Timestamp:
Nov 24, 2017 12:01:19 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8694: Large HiDPI support cleanup/rework, removing unnecessary hard-coded spacings, using scalable when necessary.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/UITakeSnapshotDialog.cpp

    r67535 r69821  
    2525# include <QLineEdit>
    2626# include <QPushButton>
     27# include <QStyle>
    2728
    2829/* GUI includes: */
     
    100101    AssertPtrReturnVoid(pLayout);
    101102    {
    102         /* Configure layout: */
    103         pLayout->setSpacing(20);
    104 
    105103        /* Create sub-layout: */
    106104        QVBoxLayout *pSubLayout1 = new QVBoxLayout;
     
    130128        {
    131129            /* Configure layout: */
    132             pSubLayout2->setSpacing(10);
     130            const int iS = qApp->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing) / 2;
     131            pSubLayout2->setSpacing(iS);
    133132
    134133            /* Create name label: */
     
    162161        {
    163162            /* Configure layout: */
    164             pSubLayout3->setSpacing(10);
     163            const int iS = qApp->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing) / 2;
     164            pSubLayout3->setSpacing(iS);
    165165
    166166            /* Create description label: */
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIArrowSplitter.cpp

    r69500 r69821  
    236236        /* Configure main-layout: */
    237237        m_pMainLayout->setContentsMargins(0, 0, 0, 0);
    238         m_pMainLayout->setSpacing(3);
     238        const int iS = qApp->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing) / 2;
     239        m_pMainLayout->setSpacing(iS);
    239240        /* Create button-layout: */
    240241        QHBoxLayout *pButtonLayout = new QHBoxLayout;
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIMessageBox.cpp

    r69726 r69821  
    181181            /* Configure top-layout: */
    182182            pTopLayout->setContentsMargins(0, 0, 0, 0);
    183             pTopLayout->setSpacing(10);
    184183            /* Create icon-label: */
    185184            m_pLabelIcon = new QLabel;
  • trunk/src/VBox/Frontends/VirtualBox/src/hostnetwork/UIHostNetworkManager.cpp

    r69672 r69821  
    815815        layout()->setSpacing(10);
    816816#else
    817         layout()->setSpacing(4);
     817        const int iS = qApp->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing) / 2;
     818        layout()->setSpacing(iS);
    818819#endif
    819820
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp

    r69672 r69821  
    15221522        layout()->setSpacing(10);
    15231523#else
    1524         layout()->setSpacing(4);
     1524        const int iS = qApp->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing) / 2;
     1525        layout()->setSpacing(iS);
    15251526#endif
    15261527
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp

    r68885 r69821  
    12861286        /* Configure main-layout: */
    12871287        m_pMainLayout->setContentsMargins(0, 0, 0, 0);
    1288         m_pMainLayout->setSpacing(5);
     1288        const int iS = qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 2;
     1289        m_pMainLayout->setSpacing(iS);
    12891290        /* Update pool: */
    12901291        updatePool();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIStatusBarEditorWindow.cpp

    r69702 r69821  
    545545            /* Configure button-layout: */
    546546            m_pButtonLayout->setContentsMargins(0, 0, 0, 0);
    547             m_pButtonLayout->setSpacing(5);
     547            const int iS = qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 2;
     548            m_pButtonLayout->setSpacing(iS);
    548549            /* Add button-layout into main-layout: */
    549550            m_pMainLayout->addLayout(m_pButtonLayout);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.cpp

    r69698 r69821  
    190190                }
    191191                /* Configure layout: */
    192                 pTopLeftLayout->setSpacing(0);
    193192                pTopLeftLayout->setContentsMargins(0, 0, 0, 0);
    194193                pTopLeftLayout->addWidget(m_pIcon);
     
    198197            QVBoxLayout *pTopRightLayout = new QVBoxLayout;
    199198            {
     199                /* Configure layout: */
     200                // WORKAROUND:
     201                // Why do we need it? It should be the default one, but it's not..
     202                const int iS1 = qApp->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing);
     203                pTopRightLayout->setSpacing(iS1);
     204
    200205                /* Prepare 'text' label: */
    201206                m_pLabel = new QLabel(this);
     
    203208                QGridLayout *pChoiceLayout = new QGridLayout;
    204209                {
     210                    /* Configure layout: */
     211                    // WORKAROUND:
     212                    // Why do we need it? It should be the default one, but it's not..
     213                    const int iS2 = qApp->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing);
     214                    pChoiceLayout->setSpacing(iS2);
     215
    205216                    /* Prepare icon metric: */
    206217                    const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
     
    270281#ifdef VBOX_WS_MAC
    271282                    pChoiceLayout->setSpacing(15);
    272 #else /* VBOX_WS_MAC */
    273                     pChoiceLayout->setSpacing(6);
    274 #endif /* !VBOX_WS_MAC */
     283#endif
    275284                    pChoiceLayout->setContentsMargins(0, 0, 0, 0);
    276285                    pChoiceLayout->addWidget(m_pDetachIcon, 0, 0);
     
    287296#ifdef VBOX_WS_MAC
    288297                pTopRightLayout->setSpacing(15);
    289 #else /* VBOX_WS_MAC */
    290                 pTopRightLayout->setSpacing(6);
    291 #endif /* !VBOX_WS_MAC */
     298#endif
    292299                pTopRightLayout->setContentsMargins(0, 0, 0, 0);
    293300                pTopRightLayout->addWidget(m_pLabel);
     
    295302            }
    296303            /* Configure layout: */
    297             pTopLayout->setSpacing(20);
    298304            pTopLayout->setContentsMargins(0, 0, 0, 0);
     305            // WORKAROUND:
     306            // Why do we need it? It should be the default one, but it's not..
     307            const int iS3 = qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing);
     308            pTopLayout->setSpacing(iS3);
    299309            pTopLayout->addItem(pTopLeftLayout);
    300310            pTopLayout->addItem(pTopRightLayout);
     
    310320        }
    311321        /* Configure layout: */
    312         pMainLayout->setSpacing(20);
    313322#ifdef VBOX_WS_MAC
    314323        pMainLayout->setContentsMargins(40, 20, 40, 20);
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.cpp

    r69260 r69821  
    12421242        layout()->setSpacing(10);
    12431243#else
    1244         layout()->setSpacing(4);
     1244        const int iS = qApp->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing) / 2;
     1245        layout()->setSpacing(iS);
    12451246#endif
    12461247
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp

    r69500 r69821  
    103103    pMainLayout->addWidget(m_pSelector->widget(), 0, 0, 2, 1);
    104104    m_pSelector->widget()->setFocus();
    105     pMainLayout->setSpacing(10);
    106105#endif /* VBOX_GUI_WITH_TOOLBAR_SETTINGS */
    107106    connect(m_pSelector, SIGNAL(sigCategoryChanged(int)), this, SLOT(sltCategoryChanged(int)));
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp

    r69500 r69821  
    34503450        mLtStorage->setContentsMargins(3, 0, 3, 0);
    34513451        mLtStorage->setSpacing(3);
     3452#else
     3453        const int iS = qApp->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing) / 3;
     3454        mLtStorage->setSpacing(iS);
    34523455#endif
    34533456
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSystem.cpp

    r68435 r69821  
    755755            m_pLayoutBootOrder->setContentsMargins(3, 3, 3, 3);
    756756            m_pLayoutBootOrder->setSpacing(3);
     757#else
     758            const int iS = qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 3;
     759            m_pLayoutBootOrder->setSpacing(iS);
    757760#endif
    758761
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFilmContainer.cpp

    r69726 r69821  
    2525# include <QScrollArea>
    2626# include <QScrollBar>
     27# include <QStyle>
    2728# include <QCheckBox>
    2829# include <QPainter>
     
    6869            /* Configure viewport layout: */
    6970            pWidgetLayout->setMargin(0);
    70             pWidgetLayout->setSpacing(4);
     71            const int iS = qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 2;
     72            pWidgetLayout->setSpacing(iS);
    7173            /* Create new widgets according passed vector: */
    7274            for (int iScreenIndex = 0; iScreenIndex < value.size(); ++iScreenIndex)
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIHostComboEditor.cpp

    r69500 r69821  
    481481    {
    482482        /* Configure layout: */
    483         pLayout->setSpacing(4);
     483        const int iS = qApp->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing) / 2;
     484        pLayout->setSpacing(iS);
    484485        pLayout->setContentsMargins(0, 0, 0, 0);
    485486        /* Create UIHostComboEditorPrivate instance: */
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIHotKeyEditor.cpp

    r69500 r69821  
    2525# include <QLineEdit>
    2626# include <QKeyEvent>
     27# include <QStyle>
    2728
    2829/* GUI includes; */
     
    123124
    124125    /* Configure layout: */
    125     m_pMainLayout->setSpacing(4);
     126    const int iS = qApp->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing) / 2;
     127    m_pMainLayout->setSpacing(iS);
    126128    m_pMainLayout->setContentsMargins(0, 0, 0, 0);
    127129    m_pMainLayout->addWidget(m_pLineEdit);
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIPortForwardingTable.cpp

    r69676 r69821  
    826826        /* On macOS we can do a bit of smoothness: */
    827827        pMainLayout->setContentsMargins(0, 0, 0, 0);
     828        pMainLayout->setSpacing(3);
     829#else
     830        const int iS = qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 3;
     831        pMainLayout->setSpacing(iS);
    828832#endif
    829         pMainLayout->setSpacing(3);
    830833        /* Create table: */
    831834        m_pTableView = new UIPortForwardingView;
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIWarningPane.cpp

    r69500 r69821  
    107107        /* Configure layout: */
    108108        pMainLayout->setContentsMargins(0, 0, 0, 0);
    109         pMainLayout->setSpacing(10);
    110109        /* Add left stretch: */
    111110        pMainLayout->addStretch();
     
    121120            /* Configure layout: */
    122121            m_pIconLayout->setContentsMargins(0, 0, 0, 0);
    123             m_pIconLayout->setSpacing(6);
    124122            /* Add into main-layout: */
    125123            pMainLayout->addLayout(m_pIconLayout);
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