Changeset 106064 in vbox for trunk/src/VBox
- Timestamp:
- Sep 16, 2024 5:26:03 PM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/UIAdvancedSettingsDialog.cpp
r106063 r106064 940 940 } 941 941 942 /* Handle key-press events: */ 943 if (pEvent->type() == QEvent::KeyPress) 944 { 945 /* Convert to key-press event and acquire the key: */ 946 QKeyEvent *pKeyEvent = static_cast<QKeyEvent*>(pEvent); 947 const int iKey = pKeyEvent->key(); 948 /* Handle Alt+<NUMERIC> menemonics: */ 949 if ( pKeyEvent->modifiers() & Qt::AltModifier 950 && iKey >= Qt::Key_1 951 && iKey <= Qt::Key_9) 952 { 953 /* Stop further event handling anyway: */ 954 pEvent->accept(); 955 956 /* Acquire current page: */ 957 const int iCurrentId = m_pSelector->currentId(); 958 QWidget *pPage = m_pSelector->idToPage(iCurrentId); 959 if (pPage) 960 { 961 /* Look the page for a suitable tab-widget: */ 962 const QList<QTabWidget*> tabWidgets = pPage->findChildren<QTabWidget*>(); 963 if (!tabWidgets.isEmpty()) 964 { 965 /* Look for a proper tab offset: */ 966 const int iShift = iKey - Qt::Key_1; 967 QTabWidget *pTabWidget = tabWidgets.first(); 968 int iVisibleTabNumber = 0; 969 for (int i = 0; i < pTabWidget->count(); ++i) 970 if (pTabWidget->isTabVisible(i)) 971 { 972 if (iVisibleTabNumber == iShift) 973 { 974 /* Activate proper tab and leave: */ 975 pTabWidget->setCurrentIndex(iVisibleTabNumber); 976 break; 977 } 978 ++iVisibleTabNumber; 979 } 980 } 981 } 982 } 983 } 984 942 985 /* Call to base-class: */ 943 986 return QMainWindow::eventFilter(pObject, pEvent);
Note:
See TracChangeset
for help on using the changeset viewer.