Changeset 63729 in vbox
- Timestamp:
- Sep 5, 2016 4:33:44 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/details/UIGDetailsView.cpp
r63726 r63729 21 21 22 22 /* Qt includes: */ 23 # include <QAccessibleWidget> 23 24 # include <QApplication> 24 25 # include <QScrollBar> … … 26 27 /* GUI includes: */ 27 28 # include "UIGDetails.h" 29 # include "UIGDetailsModel.h" 28 30 # include "UIGDetailsView.h" 31 # include "UIGDetailsItem.h" 32 33 /* Other VBox includes: */ 34 # include <iprt/assert.h> 29 35 30 36 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 37 38 39 /** QAccessibleWidget extension used as an accessibility interface for Details-view. */ 40 class UIAccessibilityInterfaceForUIGDetailsView : public QAccessibleWidget 41 { 42 public: 43 44 /** Returns an accessibility interface for passed @a strClassname and @a pObject. */ 45 static QAccessibleInterface *pFactory(const QString &strClassname, QObject *pObject) 46 { 47 /* Creating Details-view accessibility interface: */ 48 if (pObject && strClassname == QLatin1String("UIGDetailsView")) 49 return new UIAccessibilityInterfaceForUIGDetailsView(qobject_cast<QWidget*>(pObject)); 50 51 /* Null by default: */ 52 return 0; 53 } 54 55 /** Constructs an accessibility interface passing @a pWidget to the base-class. */ 56 UIAccessibilityInterfaceForUIGDetailsView(QWidget *pWidget) 57 : QAccessibleWidget(pWidget, QAccessible::List) 58 {} 59 60 /** Returns the number of children. */ 61 virtual int childCount() const /* override */ 62 { 63 /* Make sure view still alive: */ 64 AssertPtrReturn(view(), 0); 65 66 /* What amount of children root has? */ 67 const int cChildCount = view()->details()->model()->root()->items().size(); 68 69 /* Return amount of children root has (if there are many of children): */ 70 if (cChildCount > 1) 71 return cChildCount; 72 73 /* Return the number of children lone root child has (otherwise): */ 74 return view()->details()->model()->root()->items().first()->items().size(); 75 } 76 77 /** Returns the child with the passed @a iIndex. */ 78 virtual QAccessibleInterface *child(int iIndex) const /* override */ 79 { 80 /* Make sure view still alive: */ 81 AssertPtrReturn(view(), 0); 82 /* Make sure index is valid: */ 83 AssertReturn(iIndex >= 0 && iIndex < childCount(), 0); 84 85 /* What amount of children root has? */ 86 const int cChildCount = view()->details()->model()->root()->items().size(); 87 88 /* Return the root child with the passed iIndex (if there are many of children): */ 89 if (cChildCount > 1) 90 return QAccessible::queryAccessibleInterface(view()->details()->model()->root()->items().at(iIndex)); 91 92 /* Return the lone root child's child with the passed iIndex (otherwise): */ 93 return QAccessible::queryAccessibleInterface(view()->details()->model()->root()->items().first()->items().at(iIndex)); 94 } 95 96 /** Returns a text for the passed @a enmTextRole. */ 97 virtual QString text(QAccessible::Text enmTextRole) const /* override */ 98 { 99 /* Make sure view still alive: */ 100 AssertPtrReturn(view(), QString()); 101 102 /* Return view tool-tip: */ 103 Q_UNUSED(enmTextRole); 104 return view()->toolTip(); 105 } 106 107 private: 108 109 /** Returns corresponding Details-view. */ 110 UIGDetailsView *view() const { return qobject_cast<UIGDetailsView*>(widget()); } 111 }; 31 112 32 113 … … 37 118 , m_iMinimumHeightHint(0) 38 119 { 120 /* Install Details-view accessibility interface factory: */ 121 QAccessible::installFactory(UIAccessibilityInterfaceForUIGDetailsView::pFactory); 122 39 123 /* Prepare palette: */ 40 124 preparePalette();
Note:
See TracChangeset
for help on using the changeset viewer.

