VirtualBox

Changeset 10335 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jul 7, 2008 4:03:04 PM (17 years ago)
Author:
vboxsync
Message:

FE/Qt4: More default button improvements.

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

Legend:

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

    r10325 r10335  
    4949    bool isSizeGripEnabled () const;
    5050
     51    void setDefaultButton (QPushButton* aButton);
     52    QPushButton* defaultButton () const;
     53
    5154public slots:
    5255
     
    8083
    8184    QPointer<QSizeGrip> mSizeGrip;
    82 
    83     QPushButton* mDefaultButton;
     85    QPointer<QPushButton> mDefaultButton;
    8486};
    8587
  • trunk/src/VBox/Frontends/VirtualBox4/src/QIMainDialog.cpp

    r10327 r10335  
    4141    : QMainWindow (aParent, aFlags)
    4242    , mRescode (QDialog::Rejected)
    43     , mDefaultButton (NULL)
    4443{
    4544    qApp->installEventFilter (this);
     
    111110    return mSizeGrip;
    112111}
     112
     113void QIMainDialog::setDefaultButton (QPushButton* aButton)
     114{
     115    mDefaultButton = aButton;
     116}
     117
     118QPushButton* QIMainDialog::defaultButton() const
     119{
     120    return mDefaultButton;
     121}
     122
    113123
    114124void QIMainDialog::setVisible (bool aVisible)
     
    277287                                        /* We handle this, so return true after
    278288                                         * that. */
    279                                         currentDefault->click();
     289                                        currentDefault->animateClick();
    280290                                        return true;
    281291                                    }
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxVMLogViewer.cpp

    r10156 r10335  
    111111    connect (mBtnRefresh, SIGNAL (clicked()), this, SLOT (refresh()));
    112112
    113     /* Save is default */
    114     mBtnSave->setDefault (true);
    115     /* Make the [Save] button focused by default */
    116     mBtnSave->setFocus();
    117 
    118113    /* Reading log files */
    119114    refresh();
    120 
     115    /* Set the focus to the initial default button */
     116    defaultButton()->setDefault (true);
     117    defaultButton()->setFocus();
     118#ifdef Q_WS_MAC
     119    /* We have to force this to get the default button L&F on the mac. */
     120    defaultButton()->setEnabled (true);
     121#endif /* Q_WS_MAC */
    121122    /* Loading language constants */
    122123    retranslateUi();
     124
    123125}
    124126
     
    201203    mBtnSave->setEnabled (isAnyLogPresent);
    202204    mLogList->setEnabled (isAnyLogPresent);
     205    /* Default to the save button if there are any log files otherwise to the
     206     * close button. The initial automatic of the main dialog has to be
     207     * overwritten */
     208    setDefaultButton (isAnyLogPresent ? mBtnSave:mBtnClose);
    203209}
    204210
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