VirtualBox

Ignore:
Timestamp:
Mar 24, 2022 3:24:02 PM (3 years ago)
Author:
vboxsync
Message:

FE/Qt/Ds: bugref:6899: Machine settings: Display page accessibility improvements for Screen tab, part 3.

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

Legend:

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

    r94341 r94358  
    10301030    {
    10311031        /* Prepare editor: */
    1032         UIGraphicsControllerEditor *pEditor = new UIGraphicsControllerEditor(pPopup, true /* with label */);
     1032        UIGraphicsControllerEditor *pEditor = new UIGraphicsControllerEditor(pPopup);
    10331033        if (pEditor)
    10341034        {
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIGraphicsControllerEditor.cpp

    r94056 r94358  
    3131
    3232
    33 UIGraphicsControllerEditor::UIGraphicsControllerEditor(QWidget *pParent /* = 0 */, bool fWithLabel /* = false */)
     33UIGraphicsControllerEditor::UIGraphicsControllerEditor(QWidget *pParent /* = 0 */)
    3434    : QIWithRetranslateUI<QWidget>(pParent)
    35     , m_fWithLabel(fWithLabel)
    3635    , m_enmValue(KGraphicsControllerType_Max)
     36    , m_pLayout(0)
    3737    , m_pLabel(0)
    3838    , m_pCombo(0)
     
    6565}
    6666
     67int UIGraphicsControllerEditor::minimumLabelHorizontalHint() const
     68{
     69    return m_pLabel->minimumSizeHint().width();
     70}
     71
     72void UIGraphicsControllerEditor::setMinimumLayoutIndent(int iIndent)
     73{
     74    if (m_pLayout)
     75        m_pLayout->setColumnMinimumWidth(0, iIndent);
     76}
     77
    6778void UIGraphicsControllerEditor::retranslateUi()
    6879{
     
    89100{
    90101    /* Create main layout: */
    91     QGridLayout *pMainLayout = new QGridLayout(this);
    92     if (pMainLayout)
     102    m_pLayout = new QGridLayout(this);
     103    if (m_pLayout)
    93104    {
    94         pMainLayout->setContentsMargins(0, 0, 0, 0);
    95         int iRow = 0;
     105        m_pLayout->setContentsMargins(0, 0, 0, 0);
    96106
    97107        /* Create label: */
    98         if (m_fWithLabel)
    99             m_pLabel = new QLabel(this);
     108        m_pLabel = new QLabel(this);
    100109        if (m_pLabel)
    101             pMainLayout->addWidget(m_pLabel, 0, iRow++, 1, 1);
     110        {
     111            m_pLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
     112            m_pLayout->addWidget(m_pLabel, 0, 0);
     113        }
    102114
    103115        /* Create combo layout: */
    104         QHBoxLayout *pComboLayout = new QHBoxLayout;
    105         if (pComboLayout)
     116        QHBoxLayout *pLayoutCombo = new QHBoxLayout;
     117        if (pLayoutCombo)
    106118        {
    107119            /* Create combo: */
     
    110122            {
    111123                /* This is necessary since contents is dynamical now: */
    112                 m_pCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
    113124                if (m_pLabel)
    114125                    m_pLabel->setBuddy(m_pCombo);
     126                m_pCombo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
    115127                connect(m_pCombo, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
    116128                        this, &UIGraphicsControllerEditor::sltHandleCurrentIndexChanged);
    117                 pComboLayout->addWidget(m_pCombo);
     129
     130                pLayoutCombo->addWidget(m_pCombo);
    118131            }
    119132
    120133            /* Add stretch: */
    121             pComboLayout->addStretch();
     134            pLayoutCombo->addStretch();
    122135
    123136            /* Add combo-layout into main-layout: */
    124             pMainLayout->addLayout(pComboLayout, 0, iRow++, 1, 1);
     137            m_pLayout->addLayout(pLayoutCombo, 0, 1);
    125138        }
    126139    }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIGraphicsControllerEditor.h

    r94056 r94358  
    3434/* Forward declarations: */
    3535class QComboBox;
     36class QGridLayout;
    3637class QLabel;
    3738
     
    4849public:
    4950
    50     /** Constructs graphics controller editor passing @a pParent to the base-class.
    51       * @param  fWithLabel  Brings whether we should add label ourselves. */
    52     UIGraphicsControllerEditor(QWidget *pParent = 0, bool fWithLabel = false);
     51    /** Constructs graphics controller editor passing @a pParent to the base-class. */
     52    UIGraphicsControllerEditor(QWidget *pParent = 0);
    5353
    5454    /** Defines editor @a enmValue. */
     
    5959    /** Returns the vector of supported values. */
    6060    QVector<KGraphicsControllerType> supportedValues() const { return m_supportedValues; }
     61
     62    /** Returns minimum layout hint. */
     63    int minimumLabelHorizontalHint() const;
     64    /** Defines minimum layout @a iIndent. */
     65    void setMinimumLayoutIndent(int iIndent);
    6166
    6267protected:
     
    7782    void populateCombo();
    7883
    79     /** Holds whether descriptive label should be created. */
    80     bool  m_fWithLabel;
    81 
    8284    /** Holds the value to be selected. */
    8385    KGraphicsControllerType  m_enmValue;
     
    8688    QVector<KGraphicsControllerType>  m_supportedValues;
    8789
     90    /** Holds the main layout instance. */
     91    QGridLayout *m_pLayout;
    8892    /** Holds the label instance. */
    89     QLabel    *m_pLabel;
     93    QLabel      *m_pLabel;
    9094    /** Holds the combo instance. */
    91     QComboBox *m_pCombo;
     95    QComboBox   *m_pCombo;
    9296};
    9397
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.cpp

    r94357 r94358  
    311311    , m_pLabelMonitorCountMax(0)
    312312    , m_pEditorScaleFactor(0)
    313     , m_pLabelGraphicsController(0)
    314313    , m_pEditorGraphicsController(0)
    315314    , m_pLabelAcceleration(0)
     
    778777    m_pSpinboxMonitorCount->setToolTip(tr("Controls the amount of virtual monitors provided to the virtual machine."));
    779778    m_pEditorScaleFactor->setToolTip(tr("Controls the guest screen scale factor."));
    780     m_pLabelGraphicsController->setText(tr("&Graphics Controller:"));
    781779    m_pLabelAcceleration->setText(tr("Acceleration:"));
    782780    m_pCheckbox3D->setToolTip(tr("When checked, the virtual machine will be given access "
     
    863861    iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pLabelMonitorCount->minimumSizeHint().width());
    864862    iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pEditorScaleFactor->minimumLabelHorizontalHint());
    865     iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pLabelGraphicsController->minimumSizeHint().width());
     863    iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pEditorGraphicsController->minimumLabelHorizontalHint());
    866864    iMinimumLayoutHint = qMax(iMinimumLayoutHint, m_pLabelAcceleration->minimumSizeHint().width());
    867865    m_pEditorVideoMemorySize->setMinimumLayoutIndent(iMinimumLayoutHint);
    868866    m_pEditorScaleFactor->setMinimumLayoutIndent(iMinimumLayoutHint);
     867    m_pEditorGraphicsController->setMinimumLayoutIndent(iMinimumLayoutHint);
    869868    m_pLayoutScreen->setColumnMinimumWidth(0, iMinimumLayoutHint);
    870869
     
    885884    m_pSpinboxMonitorCount->setEnabled(isMachineOffline());
    886885    m_pEditorScaleFactor->setEnabled(isMachineInValidMode());
    887     m_pLabelGraphicsController->setEnabled(isMachineOffline());
    888886    m_pEditorGraphicsController->setEnabled(isMachineOffline());
    889887    m_pLabelAcceleration->setEnabled(isMachineOffline());
     
    11811179                m_pLayoutScreen->addWidget(m_pEditorScaleFactor, 3, 0, 1, 3);
    11821180
    1183             /* Prepare graphics controller label: */
    1184             m_pLabelGraphicsController = new QLabel(m_pTabScreen);
    1185             if (m_pLabelGraphicsController)
    1186             {
    1187                 m_pLabelGraphicsController->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    1188                 m_pLayoutScreen->addWidget(m_pLabelGraphicsController, 4, 0);
    1189             }
    11901181            /* Prepare graphics controller editor: */
    11911182            m_pEditorGraphicsController = new UIGraphicsControllerEditor(m_pTabScreen);
    11921183            if (m_pEditorGraphicsController)
    1193             {
    1194                 if (m_pLabelGraphicsController)
    1195                     m_pLabelGraphicsController->setBuddy(m_pEditorGraphicsController);
    1196                 m_pLayoutScreen->addWidget(m_pEditorGraphicsController, 4, 1, 1, 2);
    1197             }
     1184                m_pLayoutScreen->addWidget(m_pEditorGraphicsController, 4, 0, 1, 3);
    11981185
    11991186            /* Prepare acceleration label: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsDisplay.h

    r94357 r94358  
    215215        /** Holds the scale factor editor instance. */
    216216        UIScaleFactorEditor        *m_pEditorScaleFactor;
    217         /** Holds the graphics controller label instance. */
    218         QLabel                     *m_pLabelGraphicsController;
    219217        /** Holds the graphics controller editor instance. */
    220218        UIGraphicsControllerEditor *m_pEditorGraphicsController;
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