Changeset 64100 in vbox
- Timestamp:
- Sep 29, 2016 5:09:16 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 111055
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSelector.cpp
r64091 r64100 21 21 22 22 /* Qt includes: */ 23 # include <QAccessibleWidget> 23 24 # include <QAction> 24 25 # include <QHeaderView> 25 26 # include <QLayout> 26 27 # include <QTabWidget> 28 # include <QToolButton> 27 29 28 30 /* GUI includes: */ … … 35 37 36 38 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 39 40 41 /** QAccessibleWidget extension used as an accessibility interface for UIToolBar. */ 42 class UIAccessibilityInterfaceForUIToolBarButton : public QAccessibleWidget 43 { 44 public: 45 46 /** Returns an accessibility interface for passed @a strClassname and @a pObject. */ 47 static QAccessibleInterface *pFactory(const QString &strClassname, QObject *pObject) 48 { 49 /* Creating segmented-button accessibility interface: */ 50 if ( pObject 51 && strClassname == QLatin1String("QToolButton") 52 && pObject->property("Belongs to") == "UISettingsSelectorToolBar") 53 return new UIAccessibilityInterfaceForUIToolBarButton(qobject_cast<QWidget*>(pObject)); 54 55 /* Null by default: */ 56 return 0; 57 } 58 59 /** Constructs an accessibility interface passing @a pWidget to the base-class. */ 60 UIAccessibilityInterfaceForUIToolBarButton(QWidget *pWidget) 61 : QAccessibleWidget(pWidget, QAccessible::RadioButton) 62 {} 63 64 virtual QAccessible::State state() const 65 { 66 /* Prepare the button state: */ 67 QAccessible::State state; 68 69 /* Make sure button still alive: */ 70 AssertPtrReturn(button(), state); 71 72 /* Compose the button state: */ 73 state.checkable = button()->isCheckable(); 74 state.checked = button()->isChecked(); 75 76 /* Return the segment state: */ 77 return state; 78 } 79 80 private: 81 82 /** Returns corresponding segmented-button. */ 83 QToolButton *button() const { return qobject_cast<QToolButton*>(widget()); } 84 }; 37 85 38 86 … … 439 487 , m_pActionGroup(0) 440 488 { 489 /* Install tool-bar button accessibility interface factory: */ 490 QAccessible::installFactory(UIAccessibilityInterfaceForUIToolBarButton::pFactory); 491 441 492 /* Prepare the toolbar: */ 442 493 m_pToolBar = new UIToolBar(pParent); … … 489 540 m_pActionGroup->addAction(pItem->action()); 490 541 m_pToolBar->addAction(pItem->action()); 542 m_pToolBar->widgetForAction(pItem->action()) 543 ->setProperty("Belongs to", "UISettingsSelectorToolBar"); 491 544 pPage->setContentsMargins(0, 0, 0, 0); 492 545 pPage->layout()->setContentsMargins(0, 0, 0, 0); … … 498 551 m_pActionGroup->addAction(pItem->action()); 499 552 m_pToolBar->addAction(pItem->action()); 553 m_pToolBar->widgetForAction(pItem->action()) 554 ->setProperty("Belongs to", "UISettingsSelectorToolBar"); 500 555 QITabWidget *pTabWidget = new QITabWidget(); 501 556 pTabWidget->setIconSize(QSize(16, 16));
Note:
See TracChangeset
for help on using the changeset viewer.