VirtualBox

Changeset 94534 in vbox for trunk


Ignore:
Timestamp:
Apr 8, 2022 6:18:43 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt/Ds: bugref:6899: Machine settings: Network page accessibility improvements (part 3); Layout and NLS stuff for attachment type and advanced network options editor.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIMachineNetworkFeaturesEditor.cpp

    r94527 r94534  
    246246            m_pComboAdapterType->setItemText(i, gpConverter->toString(enmType));
    247247        }
    248         m_pComboAdapterType->setToolTip(tr("Selects the type of the virtual network adapter. Depending on this value, VirtualBox "
     248        m_pComboAdapterType->setToolTip(tr("Holds the type of the virtual network adapter. Depending on this value, VirtualBox "
    249249                                           "will provide different network hardware to the virtual machine."));
    250250    }
     
    259259            m_pComboPromiscuousMode->setItemText(i, gpConverter->toString(enmType));
    260260        }
    261         m_pComboPromiscuousMode->setToolTip(tr("Selects the promiscuous mode policy of the network adapter when attached to an "
     261        m_pComboPromiscuousMode->setToolTip(tr("Holds the promiscuous mode policy of the network adapter when attached to an "
    262262                                               "internal network, host only network or a bridge."));
    263263    }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINetworkAttachmentEditor.cpp

    r94530 r94534  
    4747    , m_enmRestrictedNetworkAttachmentTypes(UIExtraDataMetaDefs::DetailsElementOptionTypeNetwork_Invalid)
    4848    , m_enmType(KNetworkAttachmentType_Max)
     49    , m_pLayout(0)
    4950    , m_pLabelType(0)
    5051    , m_pComboType(0)
     
    100101{
    101102    return m_name.value(enmType);
     103}
     104
     105int UINetworkAttachmentEditor::minimumLabelHorizontalHint() const
     106{
     107    int iMinimumLabelHorizontalHint = 0;
     108    if (m_pLabelType)
     109        iMinimumLabelHorizontalHint = qMax(iMinimumLabelHorizontalHint, m_pLabelType->minimumSizeHint().width());
     110    if (m_pLabelName)
     111        iMinimumLabelHorizontalHint = qMax(iMinimumLabelHorizontalHint, m_pLabelName->minimumSizeHint().width());
     112    return iMinimumLabelHorizontalHint;
     113}
     114
     115void UINetworkAttachmentEditor::setMinimumLayoutIndent(int iIndent)
     116{
     117    if (m_pLayout)
     118        m_pLayout->setColumnMinimumWidth(0, iIndent);
    102119}
    103120
     
    255272
    256273    /* Create main layout: */
    257     QGridLayout *pMainLayout = new QGridLayout(this);
    258     if (pMainLayout)
    259     {
    260         pMainLayout->setContentsMargins(0, 0, 0, 0);
     274    m_pLayout = new QGridLayout(this);
     275    if (m_pLayout)
     276    {
     277        m_pLayout->setContentsMargins(0, 0, 0, 0);
    261278
    262279        /* Create type label: */
     
    265282        {
    266283            m_pLabelType->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
    267             pMainLayout->addWidget(m_pLabelType, 0, 0);
     284            m_pLayout->addWidget(m_pLabelType, 0, 0);
    268285        }
    269286        /* Create type combo layout: */
     
    286303
    287304            /* Add combo-layout into main-layout: */
    288             pMainLayout->addLayout(pComboLayout, 0, 1);
     305            m_pLayout->addLayout(pComboLayout, 0, 1);
    289306        }
    290307
     
    293310        m_pLabelName->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
    294311        if (m_pLabelName)
    295             pMainLayout->addWidget(m_pLabelName, 1, 0);
     312            m_pLayout->addWidget(m_pLabelName, 1, 0);
    296313        /* Create name combo: */
    297314        m_pComboName = new QComboBox(this);
     
    305322            connect(m_pComboName, &QComboBox::editTextChanged,
    306323                    this, &UINetworkAttachmentEditor::sltHandleCurrentNameChanged);
    307             pMainLayout->addWidget(m_pComboName, 1, 1);
     324            m_pLayout->addWidget(m_pComboName, 1, 1);
    308325        }
    309326    }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UINetworkAttachmentEditor.h

    r94530 r94534  
    3535/* Forward declarations: */
    3636class QComboBox;
     37class QGridLayout;
    3738class QLabel;
    3839
     
    6869    /** Returns current name for specified @a enmType. */
    6970    QString valueName(KNetworkAttachmentType enmType) const;
     71
     72    /** Returns minimum layout hint. */
     73    int minimumLabelHorizontalHint() const;
     74    /** Defines minimum layout @a iIndent. */
     75    void setMinimumLayoutIndent(int iIndent);
    7076
    7177    /** Returns bridged adapter list. */
     
    132138    KNetworkAttachmentType  m_enmType;
    133139
     140    /** Holds the main layout instance. */
     141    QGridLayout *m_pLayout;
    134142    /** Holds the type label instance. */
    135     QLabel    *m_pLabelType;
     143    QLabel      *m_pLabelType;
    136144    /** Holds the type combo instance. */
    137     QComboBox *m_pComboType;
     145    QComboBox   *m_pComboType;
    138146    /** Holds the name label instance. */
    139     QLabel    *m_pLabelName;
     147    QLabel      *m_pLabelName;
    140148    /** Holds the name combo instance. */
    141     QComboBox *m_pComboName;
     149    QComboBox   *m_pComboName;
    142150};
    143151
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp

    r94530 r94534  
    551551    /* Reapply attachment info: */
    552552    sltHandleAttachmentTypeChange();
     553
     554    /* These editors have own labels, but we want them to be properly layouted according to each other: */
     555    int iMinimumLayoutHint = 0;
     556    iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pEditorAttachmentType->minimumLabelHorizontalHint());
     557    iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pEditorNetworkFeatures->minimumLabelHorizontalHint());
     558    m_pEditorAttachmentType->setMinimumLayoutIndent(iMinimumLayoutHint);
     559    m_pEditorNetworkFeatures->setMinimumLayoutIndent(iMinimumLayoutHint);
    553560}
    554561
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