Changeset 105105 in vbox
- Timestamp:
- Jul 2, 2024 6:26:10 PM (5 months ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/UIAdvancedSettingsDialog.cpp
r104358 r105105 745 745 , m_fValid(true) 746 746 , m_fSilent(true) 747 , m_pScrollingTimer(0)748 747 , m_pLayoutMain(0) 749 748 , m_pCheckBoxMode(0) … … 838 837 if (pEvent->type() != QEvent::Wheel) 839 838 return QMainWindow::eventFilter(pObject, pEvent); 839 /* Ignore events to anything but widgets in this handler: */ 840 QWidget *pWidget = qobject_cast<QWidget*>(pObject); 841 if (!pWidget) 842 return QMainWindow::eventFilter(pObject, pEvent); 840 843 841 844 /* Do not touch wheel events for m_pScrollArea or it's children: */ 842 if ( pObject == m_pScrollArea 843 || pObject->parent() == m_pScrollArea) 844 { 845 /* Moreover restart 'sticky scrolling timer' during which 846 * all the scrolling will be redirected to m_pScrollViewport: */ 847 m_pScrollingTimer->start(); 848 return QMainWindow::eventFilter(pObject, pEvent); 849 } 845 if ( pWidget == m_pScrollArea 846 || pWidget->parent() == m_pScrollArea) 847 return QMainWindow::eventFilter(pWidget, pEvent); 850 848 851 849 /* Unconditionally and for good 852 850 * redirect wheel event for widgets of following types to m_pScrollViewport: */ 853 if ( qobject_cast<QAbstractButton*>(p Object)854 || qobject_cast<QAbstractSpinBox*>(p Object)855 || qobject_cast<QAbstractSpinBox*>(p Object->parent())856 || qobject_cast<QComboBox*>(p Object)857 || qobject_cast<QSlider*>(p Object)858 || qobject_cast<QTabWidget*>(p Object)859 || qobject_cast<QTabWidget*>(p Object->parent()))851 if ( qobject_cast<QAbstractButton*>(pWidget) 852 || qobject_cast<QAbstractSpinBox*>(pWidget) 853 || qobject_cast<QAbstractSpinBox*>(pWidget->parent()) 854 || qobject_cast<QComboBox*>(pWidget) 855 || qobject_cast<QSlider*>(pWidget) 856 || qobject_cast<QTabWidget*>(pWidget) 857 || qobject_cast<QTabWidget*>(pWidget->parent())) 860 858 { 861 859 /* Check if redirected event was really handled, otherwise give it back: */ … … 864 862 } 865 863 866 /* While 'sticky scrolling timer' is active 867 * redirect wheel event for widgets of following types to m_pScrollViewport: */ 868 if ( m_pScrollingTimer->isActive() 869 && ( qobject_cast<QAbstractScrollArea*>(pObject) 870 || qobject_cast<QAbstractScrollArea*>(pObject->parent()))) 864 /* Unless widget of QAbstractScrollArea subclass is focused 865 * redirect it's wheel event to m_pScrollViewport: */ 866 if ( ( qobject_cast<QAbstractScrollArea*>(pWidget) 867 || qobject_cast<QAbstractScrollArea*>(pWidget->parent())) 868 && !pWidget->hasFocus() 869 && !pWidget->parentWidget()->hasFocus()) 871 870 { 872 871 /* Check if redirected event was really handled, otherwise give it back: */ … … 876 875 877 876 /* Call to base-class: */ 878 return QMainWindow::eventFilter(p Object, pEvent);877 return QMainWindow::eventFilter(pWidget, pEvent); 879 878 } 880 879 … … 917 916 void UIAdvancedSettingsDialog::polishEvent() 918 917 { 918 /* Install event-filters for all the required children. 919 * These children can be added together with pages. */ 920 foreach (QWidget *pChild, findChildren<QWidget*>()) 921 { 922 if ( qobject_cast<QAbstractButton*>(pChild) 923 || qobject_cast<QAbstractScrollArea*>(pChild) 924 || qobject_cast<QAbstractScrollArea*>(pChild->parent()) 925 || qobject_cast<QAbstractSpinBox*>(pChild) 926 || qobject_cast<QAbstractSpinBox*>(pChild->parent()) 927 || qobject_cast<QComboBox*>(pChild) 928 || qobject_cast<QSlider*>(pChild) 929 || qobject_cast<QTabWidget*>(pChild) 930 || qobject_cast<QTabWidget*>(pChild->parent())) 931 pChild->installEventFilter(this); 932 } 933 919 934 /* Resize to minimum size: */ 920 935 resize(minimumSizeHint()); … … 1318 1333 void UIAdvancedSettingsDialog::prepare() 1319 1334 { 1320 /* Prepare 'sticky scrolling timer': */1321 m_pScrollingTimer = new QTimer(this);1322 if (m_pScrollingTimer)1323 {1324 m_pScrollingTimer->setInterval(500);1325 m_pScrollingTimer->setSingleShot(true);1326 }1327 1328 1335 /* Prepare central-widget: */ 1329 1336 setCentralWidget(new QWidget); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UIAdvancedSettingsDialog.h
r104363 r105105 44 44 class QShowEvent; 45 45 class QStackedWidget; 46 class QTimer;47 46 class QIDialogButtonBox; 48 47 class UIFilterEditor; … … 275 274 QMap<int, QString> m_pageHelpKeywords; 276 275 277 /** Holds the 'sticky scrolling timer' instance. */278 QTimer *m_pScrollingTimer;279 280 276 /** @name Widgets 281 277 * @{ */
Note:
See TracChangeset
for help on using the changeset viewer.