VirtualBox

Changeset 82430 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 5, 2019 4:49:10 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9390: UIGraphicsControllerEditor: Proactively caching value to be able to operate over it even if it's not around supported values.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/widgets
Files:
2 edited

Legend:

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

    r80072 r82430  
    3030    : QIWithRetranslateUI<QWidget>(pParent)
    3131    , m_fWithLabel(fWithLabel)
     32    , m_enmValue(KGraphicsControllerType_Max)
    3233    , m_pLabel(0)
    3334    , m_pCombo(0)
     
    4041    if (m_pCombo)
    4142    {
    42         int iIndex = m_pCombo->findData(QVariant::fromValue(enmValue));
     43        /* Update cached value: */
     44        m_enmValue = enmValue;
     45
     46        /* Look for proper index to choose: */
     47        int iIndex = m_pCombo->findData(QVariant::fromValue(m_enmValue));
    4348        if (iIndex != -1)
    4449            m_pCombo->setCurrentIndex(iIndex);
     
    4853KGraphicsControllerType UIGraphicsControllerEditor::value() const
    4954{
    50     return m_pCombo ? m_pCombo->itemData(m_pCombo->currentIndex()).value<KGraphicsControllerType>() : KGraphicsControllerType_Null;
     55    return m_pCombo ? m_pCombo->currentData().value<KGraphicsControllerType>() : m_enmValue;
    5156}
    5257
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIGraphicsControllerEditor.h

    r80068 r82430  
    7777    bool  m_fWithLabel;
    7878
     79    /** Holds the value to be selected. */
     80    KGraphicsControllerType  m_enmValue;
     81
    7982    /** Holds the label instance. */
    8083    QLabel     *m_pLabel;
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