summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Fernengel <harald.fernengel@nokia.com>2009-10-20 15:40:40 (GMT)
committerHarald Fernengel <harald.fernengel@nokia.com>2009-10-20 15:48:25 (GMT)
commit77f2319ab80be40268da689d5bc4726257ddd7ab (patch)
tree19a312a804c1c1275589106fc45430fe1c923e0f /src
parent0bdb8aa64deef437b94f4998f4c2f6ed93a38489 (diff)
downloadQt-77f2319ab80be40268da689d5bc4726257ddd7ab.zip
Qt-77f2319ab80be40268da689d5bc4726257ddd7ab.tar.gz
Qt-77f2319ab80be40268da689d5bc4726257ddd7ab.tar.bz2
Implement QAccesibleValueInterface for QProgressBar
Patch has been tested thorougly in the accessibility-fixes branch of the qt-maemo repository, thus no review
Diffstat (limited to 'src')
-rw-r--r--src/plugins/accessible/widgets/main.cpp4
-rw-r--r--src/plugins/accessible/widgets/simplewidgets.cpp28
-rw-r--r--src/plugins/accessible/widgets/simplewidgets.h19
3 files changed, 50 insertions, 1 deletions
diff --git a/src/plugins/accessible/widgets/main.cpp b/src/plugins/accessible/widgets/main.cpp
index 667de88..9a9a778 100644
--- a/src/plugins/accessible/widgets/main.cpp
+++ b/src/plugins/accessible/widgets/main.cpp
@@ -234,8 +234,10 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec
iface = new QAccessibleDisplay(widget, Grouping);
} else if (classname == QLatin1String("QStatusBar")) {
iface = new QAccessibleWidgetEx(widget, StatusBar);
+#ifndef QT_NO_PROGRESSBAR
} else if (classname == QLatin1String("QProgressBar")) {
- iface = new QAccessibleDisplay(widget);
+ iface = new QAccessibleProgressBar(widget);
+#endif
} else if (classname == QLatin1String("QToolBar")) {
iface = new QAccessibleWidgetEx(widget, ToolBar, widget->windowTitle());
#ifndef QT_NO_MENUBAR
diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp
index 1aadd6c..89482bb 100644
--- a/src/plugins/accessible/widgets/simplewidgets.cpp
+++ b/src/plugins/accessible/widgets/simplewidgets.cpp
@@ -756,6 +756,34 @@ void QAccessibleLineEdit::scrollToSubstring(int startIndex, int endIndex)
#endif // QT_NO_LINEEDIT
+#ifndef QT_NO_PROGRESSBAR
+QAccessibleProgressBar::QAccessibleProgressBar(QWidget *o)
+ : QAccessibleDisplay(o)
+{
+ Q_ASSERT(progressBar());
+}
+
+QVariant QAccessibleProgressBar::currentValue()
+{
+ return progressBar()->value();
+}
+
+QVariant QAccessibleProgressBar::maximumValue()
+{
+ return progressBar()->maximum();
+}
+
+QVariant QAccessibleProgressBar::minimumValue()
+{
+ return progressBar()->minimum();
+}
+
+QProgressBar *QAccessibleProgressBar::progressBar() const
+{
+ return qobject_cast<QProgressBar *>(object());
+}
+#endif
+
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE
diff --git a/src/plugins/accessible/widgets/simplewidgets.h b/src/plugins/accessible/widgets/simplewidgets.h
index abe5bdc..8de35ef 100644
--- a/src/plugins/accessible/widgets/simplewidgets.h
+++ b/src/plugins/accessible/widgets/simplewidgets.h
@@ -52,6 +52,7 @@ QT_BEGIN_NAMESPACE
class QAbstractButton;
class QLineEdit;
class QToolButton;
+class QProgressBar;
class QAccessibleButton : public QAccessibleWidgetEx
{
@@ -150,6 +151,24 @@ protected:
};
#endif // QT_NO_LINEEDIT
+#ifndef QT_NO_PROGRESSBAR
+class QAccessibleProgressBar : public QAccessibleDisplay, public QAccessibleValueInterface
+{
+ Q_ACCESSIBLE_OBJECT
+public:
+ explicit QAccessibleProgressBar(QWidget *o);
+
+ // QAccessibleValueInterface
+ QVariant currentValue();
+ QVariant maximumValue();
+ QVariant minimumValue();
+ inline void setCurrentValue(const QVariant &) {}
+
+protected:
+ QProgressBar *progressBar() const;
+};
+#endif
+
#endif // QT_NO_ACCESSIBILITY
QT_END_NAMESPACE