VirtualBox

Changeset 92820 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 8, 2021 2:27:31 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
148741
Message:

FE/Qt: bugref:10163: Network Manager: Simplify layout for Cloud Networking page.

File:
1 edited

Legend:

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

    r92764 r92820  
    213213void UIDetailsWidgetCloudNetwork::prepareThis()
    214214{
    215     /* Prepare main layout: */
    216     QVBoxLayout *pLayoutMain = new QVBoxLayout(this);
    217     if (pLayoutMain)
     215    /* Prepare options widget layout: */
     216    QGridLayout *pLayout = new QGridLayout(this);
     217    if (pLayout)
    218218    {
    219219#ifdef VBOX_WS_MAC
    220         pLayoutMain->setSpacing(10);
    221         pLayoutMain->setContentsMargins(10, 10, 10, 10);
     220        pLayout->setSpacing(10);
     221        pLayout->setContentsMargins(10, 10, 10, 10);
    222222#endif
    223223
    224         /* Prepare options widget layout: */
    225         QGridLayout *pLayoutOptions = new QGridLayout;
    226         if (pLayoutOptions)
    227         {
    228             /* Prepare network name label: */
    229             m_pLabelNetworkName = new QLabel(this);
     224        /* Prepare network name label: */
     225        m_pLabelNetworkName = new QLabel(this);
     226        if (m_pLabelNetworkName)
     227        {
     228            m_pLabelNetworkName->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     229            pLayout->addWidget(m_pLabelNetworkName, 0, 0);
     230        }
     231        /* Prepare network name editor: */
     232        m_pEditorNetworkName = new QLineEdit(this);
     233        if (m_pEditorNetworkName)
     234        {
    230235            if (m_pLabelNetworkName)
    231             {
    232                 m_pLabelNetworkName->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    233                 pLayoutOptions->addWidget(m_pLabelNetworkName, 0, 0);
    234             }
    235             /* Prepare network name editor: */
    236             m_pEditorNetworkName = new QLineEdit(this);
    237             if (m_pEditorNetworkName)
    238             {
    239                 if (m_pLabelNetworkName)
    240                     m_pLabelNetworkName->setBuddy(m_pEditorNetworkName);
    241                 connect(m_pEditorNetworkName, &QLineEdit::textEdited,
    242                         this, &UIDetailsWidgetCloudNetwork::sltNetworkNameChanged);
    243 
    244                 pLayoutOptions->addWidget(m_pEditorNetworkName, 0, 1);
    245             }
    246 
    247             /* Prepare cloud provider name label: */
    248             m_pLabelProviderName = new QLabel(this);
     236                m_pLabelNetworkName->setBuddy(m_pEditorNetworkName);
     237            connect(m_pEditorNetworkName, &QLineEdit::textEdited,
     238                    this, &UIDetailsWidgetCloudNetwork::sltNetworkNameChanged);
     239
     240            pLayout->addWidget(m_pEditorNetworkName, 0, 1);
     241        }
     242
     243        /* Prepare cloud provider name label: */
     244        m_pLabelProviderName = new QLabel(this);
     245        if (m_pLabelProviderName)
     246        {
     247            m_pLabelProviderName->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     248            pLayout->addWidget(m_pLabelProviderName, 1, 0);
     249        }
     250        /* Prepare cloud provider name combo: */
     251        m_pComboProviderName = new QIComboBox(this);
     252        if (m_pComboProviderName)
     253        {
    249254            if (m_pLabelProviderName)
    250             {
    251                 m_pLabelProviderName->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    252                 pLayoutOptions->addWidget(m_pLabelProviderName, 1, 0);
    253             }
    254             /* Prepare cloud provider name combo: */
    255             m_pComboProviderName = new QIComboBox(this);
    256             if (m_pComboProviderName)
    257             {
    258                 if (m_pLabelProviderName)
    259                     m_pLabelProviderName->setBuddy(m_pComboProviderName);
    260                 connect(m_pComboProviderName, static_cast<void(QIComboBox::*)(int)>(&QIComboBox::currentIndexChanged),
    261                         this, &UIDetailsWidgetCloudNetwork::sltCloudProviderNameChanged);
    262 
    263                 pLayoutOptions->addWidget(m_pComboProviderName, 1, 1);
    264             }
    265 
    266             /* Prepare cloud profile name label: */
    267             m_pLabelProfileName = new QLabel(this);
     255                m_pLabelProviderName->setBuddy(m_pComboProviderName);
     256            connect(m_pComboProviderName, static_cast<void(QIComboBox::*)(int)>(&QIComboBox::currentIndexChanged),
     257                    this, &UIDetailsWidgetCloudNetwork::sltCloudProviderNameChanged);
     258
     259            pLayout->addWidget(m_pComboProviderName, 1, 1);
     260        }
     261
     262        /* Prepare cloud profile name label: */
     263        m_pLabelProfileName = new QLabel(this);
     264        if (m_pLabelProfileName)
     265        {
     266            m_pLabelProfileName->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     267            pLayout->addWidget(m_pLabelProfileName, 2, 0);
     268        }
     269        /* Prepare cloud profile name combo: */
     270        m_pComboProfileName = new QIComboBox(this);
     271        if (m_pComboProfileName)
     272        {
    268273            if (m_pLabelProfileName)
    269             {
    270                 m_pLabelProfileName->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    271                 pLayoutOptions->addWidget(m_pLabelProfileName, 2, 0);
    272             }
    273             /* Prepare cloud profile name combo: */
    274             m_pComboProfileName = new QIComboBox(this);
    275             if (m_pComboProfileName)
    276             {
    277                 if (m_pLabelProfileName)
    278                     m_pLabelProfileName->setBuddy(m_pComboProfileName);
    279                 connect(m_pComboProfileName, static_cast<void(QIComboBox::*)(int)>(&QIComboBox::currentIndexChanged),
    280                         this, &UIDetailsWidgetCloudNetwork::sltCloudProfileNameChanged);
    281 
    282                 pLayoutOptions->addWidget(m_pComboProfileName, 2, 1);
    283             }
    284 
    285             /* Prepare network id label: */
    286             m_pLabelNetworkId = new QLabel(this);
     274                m_pLabelProfileName->setBuddy(m_pComboProfileName);
     275            connect(m_pComboProfileName, static_cast<void(QIComboBox::*)(int)>(&QIComboBox::currentIndexChanged),
     276                    this, &UIDetailsWidgetCloudNetwork::sltCloudProfileNameChanged);
     277
     278            pLayout->addWidget(m_pComboProfileName, 2, 1);
     279        }
     280
     281        /* Prepare network id label: */
     282        m_pLabelNetworkId = new QLabel(this);
     283        if (m_pLabelNetworkId)
     284        {
     285            m_pLabelNetworkId->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     286            pLayout->addWidget(m_pLabelNetworkId, 3, 0);
     287        }
     288        /* Prepare network id editor: */
     289        m_pEditorNetworkId = new QLineEdit(this);
     290        if (m_pEditorNetworkId)
     291        {
    287292            if (m_pLabelNetworkId)
    288             {
    289                 m_pLabelNetworkId->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    290                 pLayoutOptions->addWidget(m_pLabelNetworkId, 3, 0);
    291             }
    292             /* Prepare network id editor: */
    293             m_pEditorNetworkId = new QLineEdit(this);
    294             if (m_pEditorNetworkId)
    295             {
    296                 if (m_pLabelNetworkId)
    297                     m_pLabelNetworkId->setBuddy(m_pEditorNetworkId);
    298                 connect(m_pEditorNetworkId, &QLineEdit::textEdited,
    299                         this, &UIDetailsWidgetCloudNetwork::sltNetworkIdChanged);
    300 
    301                 pLayoutOptions->addWidget(m_pEditorNetworkId, 3, 1);
    302             }
    303 
    304             pLayoutMain->addLayout(pLayoutOptions);
     293                m_pLabelNetworkId->setBuddy(m_pEditorNetworkId);
     294            connect(m_pEditorNetworkId, &QLineEdit::textEdited,
     295                    this, &UIDetailsWidgetCloudNetwork::sltNetworkIdChanged);
     296
     297            pLayout->addWidget(m_pEditorNetworkId, 3, 1);
    305298        }
    306299
     
    315308                connect(m_pButtonBoxOptions, &QIDialogButtonBox::clicked, this, &UIDetailsWidgetCloudNetwork::sltHandleButtonBoxClick);
    316309
    317                 pLayoutMain->addWidget(m_pButtonBoxOptions);
     310                pLayout->addWidget(m_pButtonBoxOptions, 4, 0, 1, 2);
    318311            }
    319312        }
Note: See TracChangeset for help on using the changeset viewer.

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