Changeset 100899 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Aug 17, 2023 3:21:53 PM (16 months ago)
- 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 33 33 #include <QPushButton> 34 34 #include <QStackedWidget> 35 #include <Q Timer>35 #include <QVariant> 36 36 37 37 /* GUI includes: */ … … 79 79 , m_fValid(true) 80 80 , m_fSilent(true) 81 , m_pWhatsThisTimer(new QTimer(this))82 81 , m_pLabelTitle(0) 83 82 , m_pButtonBox(0) … … 220 219 } 221 220 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 else243 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 262 221 void UISettingsDialog::retranslateUi() 263 222 { 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>"));266 223 m_pLabelTitle->setText(QString()); 267 224 … … 654 611 } 655 612 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 else670 {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 688 613 void UISettingsDialog::prepare() 689 614 { … … 805 730 } 806 731 } 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);813 732 814 733 /* Apply language settings: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h
r98103 r100899 34 34 /* Qt includes: */ 35 35 #include <QMainWindow> 36 #include <QPointer>37 #include <QVariant>38 36 39 37 /* GUI includes: */ … … 48 46 class QShowEvent; 49 47 class QStackedWidget; 50 class Q Timer;48 class QVariant; 51 49 class QIDialogButtonBox; 52 50 class UIPageValidator; … … 115 113 protected: 116 114 117 /** Preprocesses any Qt @a pEvent for passed @a pObject. */118 virtual bool eventFilter(QObject *pObject, QEvent *pEvent) RT_OVERRIDE;119 115 /** Handles translation event. */ 120 116 virtual void retranslateUi() RT_OVERRIDE; … … 196 192 void sltHandleWarningPaneUnhovered(UIPageValidator *pValidator); 197 193 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 203 194 private: 204 195 … … 240 231 QString m_strWarningHint; 241 232 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 247 233 /** Holds the map of settings pages. */ 248 234 QMap<int, int> m_pages; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/editors/UIMaximumGuestScreenSizeEditor.cpp
r98103 r100899 157 157 if (m_pComboPolicy) 158 158 { 159 /* Get current size-combo tool-tip data: */160 const QString strCurrentComboItemTip = m_pComboPolicy->currentData(Qt::ToolTipRole).toString();161 m_pComboPolicy->setWhatsThis(strCurrentComboItemTip);162 163 159 /* Get current size-combo item data: */ 164 160 const MaximumGuestScreenSizePolicy enmPolicy = m_pComboPolicy->currentData().value<MaximumGuestScreenSizePolicy>();
Note:
See TracChangeset
for help on using the changeset viewer.