Changeset 101118 in vbox
- Timestamp:
- Sep 13, 2023 6:12:28 PM (19 months ago)
- svn:sync-xref-src-repo-rev:
- 159087
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/UIAdvancedSettingsDialog.cpp
r101032 r101118 27 27 28 28 /* Qt includes: */ 29 #include <QAbstractButton> 30 #include <QAbstractScrollArea> 31 #include <QAbstractSpinBox> 29 32 #include <QCloseEvent> 33 #include <QComboBox> 34 #include <QCoreApplication> 30 35 #include <QGridLayout> 31 36 #include <QProgressBar> … … 33 38 #include <QScrollArea> 34 39 #include <QScrollBar> 40 #include <QSlider> 35 41 #include <QStackedWidget> 42 #include <QTimer> 36 43 #include <QVariant> 37 44 #include <QVBoxLayout> … … 130 137 , m_fValid(true) 131 138 , m_fSilent(true) 139 , m_pScrollingTimer(0) 132 140 , m_pLayoutMain(0) 133 141 , m_pEditorFilter(0) … … 210 218 /* Mark serialization finished: */ 211 219 m_fSerializationIsInProgress = false; 220 } 221 222 bool UIAdvancedSettingsDialog::eventFilter(QObject *pObject, QEvent *pEvent) 223 { 224 /* Ignore other than wheel events in this handler: */ 225 if (pEvent->type() != QEvent::Wheel) 226 return QIWithRetranslateUI<QMainWindow>::eventFilter(pObject, pEvent); 227 228 /* Do not touch wheel events for m_pScrollArea or it's children: */ 229 if ( pObject == m_pScrollArea 230 || pObject->parent() == m_pScrollArea) 231 { 232 /* Moreover restart 'sticky scrolling timer' during which 233 * all the scrolling will be redirected to m_pScrollViewport: */ 234 m_pScrollingTimer->start(); 235 return QIWithRetranslateUI<QMainWindow>::eventFilter(pObject, pEvent); 236 } 237 238 /* While 'sticky scrolling timer' is active 239 * redirect wheel event for widgets of following types to m_pScrollViewport: */ 240 if ( m_pScrollingTimer->isActive() 241 && ( qobject_cast<QAbstractButton*>(pObject) 242 || qobject_cast<QAbstractScrollArea*>(pObject) 243 || qobject_cast<QAbstractScrollArea*>(pObject->parent()) 244 || qobject_cast<QAbstractSpinBox*>(pObject) 245 || qobject_cast<QAbstractSpinBox*>(pObject->parent()) 246 || qobject_cast<QComboBox*>(pObject) 247 || qobject_cast<QSlider*>(pObject) 248 || qobject_cast<QTabWidget*>(pObject) 249 || qobject_cast<QTabWidget*>(pObject->parent()))) 250 { 251 /* Check if redirected event was really handled, otherwise give it back: */ 252 if (QCoreApplication::sendEvent(m_pScrollViewport, pEvent)) 253 return true; 254 } 255 256 /* Call to base-class: */ 257 return QIWithRetranslateUI<QMainWindow>::eventFilter(pObject, pEvent); 212 258 } 213 259 … … 536 582 void UIAdvancedSettingsDialog::prepare() 537 583 { 584 /* Prepare 'sticky scrolling timer': */ 585 m_pScrollingTimer = new QTimer(this); 586 if (m_pScrollingTimer) 587 { 588 m_pScrollingTimer->setInterval(500); 589 m_pScrollingTimer->setSingleShot(true); 590 } 591 538 592 /* Prepare central-widget: */ 539 593 setCentralWidget(new QWidget); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UIAdvancedSettingsDialog.h
r101032 r101118 45 45 class QShowEvent; 46 46 class QStackedWidget; 47 class QTimer; 47 48 class QVariant; 48 49 class QIDialogButtonBox; … … 107 108 108 109 protected: 110 111 /** Preprocesses Qt @a pEvent for passed @a pObject. */ 112 virtual bool eventFilter(QObject *pObject, QEvent *pEvent) RT_OVERRIDE; 109 113 110 114 /** Handles translation event. */ … … 239 243 QMap<int, QString> m_pageHelpKeywords; 240 244 245 /** Holds the 'sticky scrolling timer' instance. */ 246 QTimer *m_pScrollingTimer; 247 241 248 /** @name Widgets 242 249 * @{ */
Note:
See TracChangeset
for help on using the changeset viewer.