VirtualBox

Changeset 68328 in vbox


Ignore:
Timestamp:
Aug 8, 2017 7:46:36 AM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8928: Fixing UIFilePathSelector regression caused by QIComboBox rework which breaks the focusing rules; Also make sure corresponding event-filters are installed for editable combo-box only.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIComboBox.cpp

    r68079 r68328  
    166166    AssertPtrReturn(m_pComboBox, 0);
    167167    return m_pComboBox->lineEdit();
     168}
     169
     170QComboBox *QIComboBox::comboBox() const
     171{
     172    return m_pComboBox;
    168173}
    169174
  • trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIComboBox.h

    r64540 r68328  
    113113    void setItemText(int iIndex, const QString &strText) const;
    114114
     115protected:
     116
     117    /** Returns the embedded combo-box reference. */
     118    QComboBox *comboBox() const;
     119
    115120private:
    116121
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIFilePathSelector.cpp

    r64539 r68328  
    126126    {
    127127        QIComboBox::setEditable(true);
     128
     129        /* Install combo-box event-filter: */
     130        Assert(comboBox());
     131        comboBox()->installEventFilter(this);
     132
     133        /* Install line-edit connection/event-filter: */
    128134        Assert(lineEdit());
    129135        connect(lineEdit(), SIGNAL(textEdited(const QString &)),
    130136                this, SLOT(onTextEdited(const QString &)));
    131 
    132         /* Installing necessary event filters: */
    133137        lineEdit()->installEventFilter(this);
    134138    }
     
    137141        if (lineEdit())
    138142        {
    139             /* Installing necessary event filters: */
    140             lineEdit()->installEventFilter(this);
     143            /* Remove line-edit event-filter/connection: */
     144            lineEdit()->removeEventFilter(this);
    141145            disconnect(lineEdit(), SIGNAL(textEdited(const QString &)),
    142146                       this, SLOT(onTextEdited(const QString &)));
     147        }
     148        if (comboBox())
     149        {
     150            /* Remove combo-box event-filter: */
     151            comboBox()->removeEventFilter(this);
    143152        }
    144153        QIComboBox::setEditable(false);
     
    177186bool UIFilePathSelector::eventFilter(QObject *pObject, QEvent *pEvent)
    178187{
    179     if (m_fMouseAwaited && (pEvent->type() == QEvent::MouseButtonPress))
    180         QMetaObject::invokeMethod(this, "refreshText", Qt::QueuedConnection);
    181 
     188    /* If the object is private combo-box: */
     189    if (pObject == comboBox())
     190    {
     191        /* Handle focus events related to private child: */
     192        switch (pEvent->type())
     193        {
     194            case QEvent::FocusIn:  focusInEvent(static_cast<QFocusEvent*>(pEvent)); break;
     195            case QEvent::FocusOut: focusOutEvent(static_cast<QFocusEvent*>(pEvent)); break;
     196            default: break;
     197        }
     198    }
     199
     200    /* If the object is private line-edit: */
     201    if (pObject == lineEdit())
     202    {
     203        if (m_fMouseAwaited && (pEvent->type() == QEvent::MouseButtonPress))
     204            QMetaObject::invokeMethod(this, "refreshText", Qt::QueuedConnection);
     205    }
     206
     207    /* Call to base-class: */
    182208    return QIWithRetranslateUI<QIComboBox>::eventFilter(pObject, pEvent);
    183209}
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