VirtualBox

Changeset 11968 in vbox for trunk


Ignore:
Timestamp:
Sep 2, 2008 11:11:58 AM (16 years ago)
Author:
vboxsync
Message:

Fe/Qt4: Fix Hard Disk UI issues: restoring edit-state of HD attachment table when getting focus, re-activating table (alt-tab), fixing F2 key functionality.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSettingsUtils.h

    r10468 r11968  
    219219        emit currentChanged (aCurrent);
    220220    }
     221
     222    void focusInEvent (QFocusEvent *aEvent)
     223    {
     224        /* Restore edit-mode on focus in. */
     225        QTableView::focusInEvent (aEvent);
     226        if (model()->flags (currentIndex()) & Qt::ItemIsEditable)
     227            edit (currentIndex());
     228    }
    221229};
    222230
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxVMSettingsHD.h

    r11186 r11968  
    196196private:
    197197
     198    void keyPressEvent (QKeyEvent *aEvent);
    198199    void populate (const HDSltValue &aIncluding);
    199200
     
    228229
    229230private:
     231
     232    void keyPressEvent (QKeyEvent *aEvent);
    230233
    231234    static HDVdiEditor *mInstance;
     
    326329    QAction *mDelAction;
    327330    QAction *mVdmAction;
     331    bool mWasTableSelected;
    328332};
    329333
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMSettingsHD.cpp

    r11530 r11968  
    243243}
    244244
     245void HDSltEditor::keyPressEvent (QKeyEvent *aEvent)
     246{
     247    /* Make F2 key to show the popup. */
     248    if (aEvent->key() == Qt::Key_F2)
     249    {
     250        aEvent->accept();
     251        showPopup();
     252    }
     253    else
     254        aEvent->ignore();
     255    QComboBox::keyPressEvent (aEvent);
     256}
     257
    245258void HDSltEditor::populate (const HDSltValue &aIncluding)
    246259{
     
    313326{
    314327    emit readyToCommit (this);
     328}
     329
     330void HDVdiEditor::keyPressEvent (QKeyEvent *aEvent)
     331{
     332    /* Make F2 key to show the popup. */
     333    if (aEvent->key() == Qt::Key_F2)
     334    {
     335        aEvent->accept();
     336        showPopup();
     337    }
     338    else
     339        aEvent->ignore();
     340    VBoxMediaComboBox::keyPressEvent (aEvent);
    315341}
    316342
     
    395421VBoxVMSettingsHD::VBoxVMSettingsHD()
    396422    : mValidator (0)
     423    , mWasTableSelected (false)
    397424{
    398425    /* Apply UI decorations */
     
    859886                    break;
    860887            }
     888        } else
     889        if (aEvent->type() == QEvent::WindowDeactivate)
     890        {
     891            /* Store focus state if it is on temporary editor. */
     892            if (widget->hasFocus())
     893                mWasTableSelected = true;
    861894        }
    862895    } else
     
    869902            (index.row() == mModel->rowCount() - 1 || !index.isValid()))
    870903            newClicked();
     904    } else
     905    if (aEvent->type() == QEvent::WindowActivate)
     906    {
     907        if (mWasTableSelected)
     908        {
     909            /* Restore focus state if it was on temporary editor. */
     910            mWasTableSelected = false;
     911            mTwAts->setFocus();
     912        }
    871913    }
    872914
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