VirtualBox

Changeset 103093 in vbox for trunk


Ignore:
Timestamp:
Jan 26, 2024 4:40:51 PM (13 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
161339
Message:

FE/Qt: UIWelcomePane: Reworking layout a bit to make it suitable for Experience mode warning.

File:
1 edited

Legend:

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

    r103083 r103093  
    2727
    2828/* Qt includes: */
    29 #include <QHBoxLayout>
     29#include <QGridLayout>
    3030#include <QLabel>
    3131#include <QStyle>
    32 #include <QVBoxLayout>
    3332#include <QUrl>
    3433
     
    102101
    103102    /* Prepare main layout: */
    104     QHBoxLayout *pMainLayout = new QHBoxLayout(this);
     103    QGridLayout *pMainLayout = new QGridLayout(this);
    105104    if (pMainLayout)
    106105    {
    107         /* Prepare welcome layout: */
    108         QVBoxLayout *pLayoutWelcome = new QVBoxLayout;
    109         if (pLayoutWelcome)
     106        const int iL = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) / 2;
     107        const int iT = qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin);
     108        const int iR = qApp->style()->pixelMetric(QStyle::PM_LayoutRightMargin);
     109        const int iB = qApp->style()->pixelMetric(QStyle::PM_LayoutBottomMargin) / 2;
     110#ifdef VBOX_WS_MAC
     111        const int iSpacing = 20;
     112#else
     113        const int iSpacing = qApp->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing);
     114#endif
     115        pMainLayout->setContentsMargins(iL, iT, iR, iB);
     116        pMainLayout->setSpacing(iSpacing);
     117        pMainLayout->setRowStretch(1, 1);
     118
     119        /* Prepare greetings label: */
     120        m_pLabelGreetings = new QIRichTextLabel(this);
     121        if (m_pLabelGreetings)
    110122        {
    111             const int iL = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) / 2;
    112 #ifdef VBOX_WS_MAC
    113             const int iSpacing = 20;
    114 #else
    115             const int iSpacing = qApp->style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing);
    116 #endif
    117             pLayoutWelcome->setContentsMargins(iL, 0, 0, 0);
    118             pLayoutWelcome->setSpacing(iSpacing);
    119 
    120             /* Prepare greetings label: */
    121             m_pLabelGreetings = new QIRichTextLabel(this);
    122             if (m_pLabelGreetings)
    123             {
    124                 m_pLabelGreetings->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
    125                 connect(m_pLabelGreetings, &QIRichTextLabel::sigLinkClicked, this, &UIWelcomePane::sltHandleLinkActivated);
    126                 pLayoutWelcome->addWidget(m_pLabelGreetings);
    127             }
    128 
    129             /* Add stretch: */
    130             pLayoutWelcome->addStretch();
    131 
    132             /* Add into layout: */
    133             pMainLayout->addLayout(pLayoutWelcome);
     123            m_pLabelGreetings->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
     124            connect(m_pLabelGreetings, &QIRichTextLabel::sigLinkClicked, this, &UIWelcomePane::sltHandleLinkActivated);
     125            pMainLayout->addWidget(m_pLabelGreetings, 0, 0);
    134126        }
    135127
     
    139131        {
    140132            m_pLabelIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    141 
    142             /* Add into layout: */
    143             pMainLayout->addWidget(m_pLabelIcon);
    144             pMainLayout->setAlignment(m_pLabelIcon, Qt::AlignHCenter | Qt::AlignTop);
     133            pMainLayout->addWidget(m_pLabelIcon, 0, 1);
    145134        }
    146135    }
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