Changeset 63697 in vbox
- Timestamp:
- Sep 2, 2016 1:02:50 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserView.cpp
r63696 r63697 22 22 /* Qt includes: */ 23 23 # include <QScrollBar> 24 # include <QAccessibleWidget> 24 25 25 26 /* GUI includes: */ 26 27 # include "UIGChooser.h" 28 # include "UIGChooserModel.h" 27 29 # include "UIGChooserView.h" 28 30 # include "UIGChooserItem.h" 29 31 32 /* Other VBox includes: */ 33 # include <iprt/assert.h> 34 30 35 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 36 37 38 /** QAccessibleWidget extension used as an accessibility interface for Chooser-view. */ 39 class UIAccessibilityInterfaceForUIGChooserView : public QAccessibleWidget 40 { 41 public: 42 43 /** Returns an accessibility interface for passed @a strClassname and @a pObject. */ 44 static QAccessibleInterface* pFactory(const QString &strClassname, QObject *pObject) 45 { 46 /* Creating Chooser-view accessibility interface: */ 47 if (pObject && strClassname == QLatin1String("UIGChooserView")) 48 return new UIAccessibilityInterfaceForUIGChooserView(qobject_cast<QWidget*>(pObject)); 49 50 /* Null by default: */ 51 return 0; 52 } 53 54 /** Constructs an accessibility interface passing @a pWidget to the base-class. */ 55 UIAccessibilityInterfaceForUIGChooserView(QWidget *pWidget) 56 : QAccessibleWidget(pWidget, QAccessible::List) 57 {} 58 59 /** Returns the number of children. */ 60 virtual int childCount() const /* override */ 61 { 62 /* Make sure view still alive: */ 63 AssertPtrReturn(view(), 0); 64 65 /* Return the number of children: */ 66 return view()->chooser()->model()->root()->items().size(); 67 } 68 69 /** Returns the child with the passed @a iIndex. */ 70 virtual QAccessibleInterface *child(int iIndex) const /* override */ 71 { 72 /* Make sure view still alive: */ 73 AssertPtrReturn(view(), 0); 74 75 /* Make sure index is valid: */ 76 if (iIndex < childCount()) 77 return QAccessible::queryAccessibleInterface(view()->chooser()->model()->root()->items().at(iIndex)); 78 79 /* Null by default: */ 80 return 0; 81 } 82 83 /** Returns a text for the passed @a enmTextRole. */ 84 virtual QString text(QAccessible::Text enmTextRole) const /* override */ 85 { 86 /* Make sure view still alive: */ 87 AssertPtrReturn(view(), QString()); 88 89 /* Return view tool-tip: */ 90 Q_UNUSED(enmTextRole); 91 return view()->toolTip(); 92 } 93 94 private: 95 96 /** Returns corresponding Chooser-view. */ 97 UIGChooserView* view() const { return qobject_cast<UIGChooserView*>(widget()); } 98 }; 31 99 32 100 … … 37 105 , m_iMinimumHeightHint(0) 38 106 { 107 /* Install Chooser-view accessibility interface factory: */ 108 QAccessible::installFactory(UIAccessibilityInterfaceForUIGChooserView::pFactory); 109 39 110 /* Setup frame: */ 40 111 setFrameShape(QFrame::NoFrame);
Note:
See TracChangeset
for help on using the changeset viewer.

