VirtualBox

Ignore:
Timestamp:
Jul 25, 2013 2:19:29 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: Close VM dialog: Handle *double-click* as the activation handler for the dialog radio-buttons.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.cpp

    r47160 r47398  
    189189                    {
    190190                        /* Configure button: */
     191                        m_pSaveRadio->installEventFilter(this);
    191192                        connect(m_pSaveRadio, SIGNAL(toggled(bool)), this, SLOT(sltUpdateWidgetAvailability()));
    192193                    }
     
    202203                    {
    203204                        /* Configure button: */
     205                        m_pShutdownRadio->installEventFilter(this);
    204206                        connect(m_pShutdownRadio, SIGNAL(toggled(bool)), this, SLOT(sltUpdateWidgetAvailability()));
    205207                    }
     
    215217                    {
    216218                        /* Configure button: */
     219                        m_pPowerOffRadio->installEventFilter(this);
    217220                        connect(m_pPowerOffRadio, SIGNAL(toggled(bool)), this, SLOT(sltUpdateWidgetAvailability()));
    218221                    }
     
    383386}
    384387
     388bool UIVMCloseDialog::eventFilter(QObject *pWatched, QEvent *pEvent)
     389{
     390    /* For now we are interested in double-click events only: */
     391    if (pEvent->type() == QEvent::MouseButtonDblClick)
     392    {
     393        /* Make sure its one of the radio-buttons
     394         * which has this event-filter installed: */
     395        if (qobject_cast<QRadioButton*>(pWatched))
     396        {
     397            /* Since on double-click the button will be also selected
     398             * we are just calling for the *accept* slot: */
     399            accept();
     400        }
     401    }
     402
     403    /* Call to base-class: */
     404    return QIWithRetranslateUI<QIDialog>::eventFilter(pWatched, pEvent);
     405}
     406
    385407void UIVMCloseDialog::polishEvent(QShowEvent *pEvent)
    386408{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIVMCloseDialog.h

    r46704 r47398  
    8080    void retranslateUi();
    8181
     82    /* Handler: Event-filtering stuff: */
     83    bool eventFilter(QObject *pWatched, QEvent *pEvent);
     84
    8285    /* Handler: Polish-event stuff: */
    8386    void polishEvent(QShowEvent *pEvent);
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