VirtualBox

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


Ignore:
Timestamp:
Aug 17, 2023 3:21:53 PM (16 months ago)
Author:
vboxsync
Message:

FE/Qt: UISettingsDialog: A bit of cleanup related to obsolete whats-this stuff.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp

    r99946 r100899  
    3333#include <QPushButton>
    3434#include <QStackedWidget>
    35 #include <QTimer>
     35#include <QVariant>
    3636
    3737/* GUI includes: */
     
    7979    , m_fValid(true)
    8080    , m_fSilent(true)
    81     , m_pWhatsThisTimer(new QTimer(this))
    8281    , m_pLabelTitle(0)
    8382    , m_pButtonBox(0)
     
    220219}
    221220
    222 bool UISettingsDialog::eventFilter(QObject *pObject, QEvent *pEvent)
    223 {
    224     /* Ignore objects which are NOT widgets: */
    225     if (!pObject->isWidgetType())
    226         return QMainWindow::eventFilter(pObject, pEvent);
    227 
    228     /* Ignore widgets which window is NOT settings window: */
    229     QWidget *pWidget = static_cast<QWidget*>(pObject);
    230     if (pWidget->window() != this)
    231         return QMainWindow::eventFilter(pObject, pEvent);
    232 
    233     /* Process different event-types: */
    234     switch (pEvent->type())
    235     {
    236         /* Process enter/leave events to remember whats-this candidates: */
    237         case QEvent::Enter:
    238         case QEvent::Leave:
    239         {
    240             if (pEvent->type() == QEvent::Enter)
    241                 m_pWhatsThisCandidate = pWidget;
    242             else
    243                 m_pWhatsThisCandidate = 0;
    244 
    245             m_pWhatsThisTimer->start(100);
    246             break;
    247         }
    248         /* Process focus-in event to update whats-this pane: */
    249         case QEvent::FocusIn:
    250         {
    251             sltUpdateWhatsThis(true /* got focus? */);
    252             break;
    253         }
    254         default:
    255             break;
    256     }
    257 
    258     /* Base-class processing: */
    259     return QMainWindow::eventFilter(pObject, pEvent);
    260 }
    261 
    262221void UISettingsDialog::retranslateUi()
    263222{
    264     setWhatsThis(tr("<i>Select a settings category from the list on the left-hand side and move the mouse over a settings "
    265                     "item to get more information.</i>"));
    266223    m_pLabelTitle->setText(QString());
    267224
     
    654611}
    655612
    656 void UISettingsDialog::sltUpdateWhatsThis(bool fGotFocus)
    657 {
    658     QString strWhatsThisText;
    659     QWidget *pWhatsThisWidget = 0;
    660 
    661     /* If focus had NOT changed: */
    662     if (!fGotFocus)
    663     {
    664         /* We will use the recommended candidate: */
    665         if (m_pWhatsThisCandidate && m_pWhatsThisCandidate != this)
    666             pWhatsThisWidget = m_pWhatsThisCandidate;
    667     }
    668     /* If focus had changed: */
    669     else
    670     {
    671         /* We will use the focused widget instead: */
    672         pWhatsThisWidget = QApplication::focusWidget();
    673     }
    674 
    675     /* If the given widget lacks the whats-this text, look at its parent: */
    676     while (pWhatsThisWidget && pWhatsThisWidget != this)
    677     {
    678         strWhatsThisText = pWhatsThisWidget->whatsThis();
    679         if (!strWhatsThisText.isEmpty())
    680             break;
    681         pWhatsThisWidget = pWhatsThisWidget->parentWidget();
    682     }
    683 
    684     if (pWhatsThisWidget && !strWhatsThisText.isEmpty())
    685         pWhatsThisWidget->setToolTip(strWhatsThisText);
    686 }
    687 
    688613void UISettingsDialog::prepare()
    689614{
     
    805730        }
    806731    }
    807 
    808     /* Setup what's this stuff: */
    809     qApp->installEventFilter(this);
    810     m_pWhatsThisTimer->setSingleShot(true);
    811     connect(m_pWhatsThisTimer, &QTimer::timeout,
    812             this, &UISettingsDialog::sltUpdateWhatsThisNoFocus);
    813732
    814733    /* Apply language settings: */
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h

    r98103 r100899  
    3434/* Qt includes: */
    3535#include <QMainWindow>
    36 #include <QPointer>
    37 #include <QVariant>
    3836
    3937/* GUI includes: */
     
    4846class QShowEvent;
    4947class QStackedWidget;
    50 class QTimer;
     48class QVariant;
    5149class QIDialogButtonBox;
    5250class UIPageValidator;
     
    115113protected:
    116114
    117     /** Preprocesses any Qt @a pEvent for passed @a pObject. */
    118     virtual bool eventFilter(QObject *pObject, QEvent *pEvent) RT_OVERRIDE;
    119115    /** Handles translation event. */
    120116    virtual void retranslateUi() RT_OVERRIDE;
     
    196192    void sltHandleWarningPaneUnhovered(UIPageValidator *pValidator);
    197193
    198     /** Updates watch this information depending on whether we have @a fGotFocus. */
    199     void sltUpdateWhatsThis(bool fGotFocus);
    200     /** Updates watch this information. */
    201     void sltUpdateWhatsThisNoFocus() { sltUpdateWhatsThis(false); }
    202 
    203194private:
    204195
     
    240231    QString  m_strWarningHint;
    241232
    242     /** Holds the what's this hover timer instance. */
    243     QTimer            *m_pWhatsThisTimer;
    244     /** Holds the what's this hover timer instance. */
    245     QPointer<QWidget>  m_pWhatsThisCandidate;
    246 
    247233    /** Holds the map of settings pages. */
    248234    QMap<int, int>      m_pages;
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIMaximumGuestScreenSizeEditor.cpp

    r98103 r100899  
    157157    if (m_pComboPolicy)
    158158    {
    159         /* Get current size-combo tool-tip data: */
    160         const QString strCurrentComboItemTip = m_pComboPolicy->currentData(Qt::ToolTipRole).toString();
    161         m_pComboPolicy->setWhatsThis(strCurrentComboItemTip);
    162 
    163159        /* Get current size-combo item data: */
    164160        const MaximumGuestScreenSizePolicy enmPolicy = m_pComboPolicy->currentData().value<MaximumGuestScreenSizePolicy>();
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