summaryrefslogtreecommitdiffstats
path: root/src/plugins/accessible
diff options
context:
space:
mode:
authorHarald Fernengel <harald.fernengel@nokia.com>2009-11-06 14:15:05 (GMT)
committerHarald Fernengel <harald.fernengel@nokia.com>2009-11-06 14:16:11 (GMT)
commit4ad6343be52b757fd354cd92874bca944d2ede49 (patch)
tree68d9fa38a04de8959310b977f295184e2b4a8bdd /src/plugins/accessible
parentf8883337699d59e3b5eb9393067a24fb43fb2604 (diff)
downloadQt-4ad6343be52b757fd354cd92874bca944d2ede49.zip
Qt-4ad6343be52b757fd354cd92874bca944d2ede49.tar.gz
Qt-4ad6343be52b757fd354cd92874bca944d2ede49.tar.bz2
Add preliminary QAccessibleImage interface
As requested by the Maemo team.
Diffstat (limited to 'src/plugins/accessible')
-rw-r--r--src/plugins/accessible/widgets/simplewidgets.cpp38
-rw-r--r--src/plugins/accessible/widgets/simplewidgets.h7
2 files changed, 44 insertions, 1 deletions
diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp
index aa51759..1d801e4 100644
--- a/src/plugins/accessible/widgets/simplewidgets.cpp
+++ b/src/plugins/accessible/widgets/simplewidgets.cpp
@@ -602,6 +602,44 @@ int QAccessibleDisplay::navigate(RelationFlag rel, int entry, QAccessibleInterfa
return QAccessibleWidgetEx::navigate(rel, entry, target);
}
+/*! \reimp */
+QString QAccessibleDisplay::imageDescription()
+{
+ return widget()->toolTip();
+}
+
+/*! \reimp */
+QSize QAccessibleDisplay::imageSize()
+{
+ QLabel *label = qobject_cast<QLabel *>(widget());
+ if (!label)
+ return QSize();
+ const QPixmap *pixmap = label->pixmap();
+ if (!pixmap)
+ return QSize();
+ return pixmap->size();
+}
+
+/*! \reimp */
+QRect QAccessibleDisplay::imagePosition(QAccessible2::CoordinateType coordType)
+{
+ QLabel *label = qobject_cast<QLabel *>(widget());
+ if (!label)
+ return QRect();
+ const QPixmap *pixmap = label->pixmap();
+ if (!pixmap)
+ return QRect();
+
+ switch (coordType) {
+ case QAccessible2::RelativeToScreen:
+ return QRect(label->mapToGlobal(label->pos()), label->size());
+ case QAccessible2::RelativeToParent:
+ return label->geometry();
+ }
+
+ return QRect();
+}
+
#ifndef QT_NO_LINEEDIT
/*!
\class QAccessibleLineEdit
diff --git a/src/plugins/accessible/widgets/simplewidgets.h b/src/plugins/accessible/widgets/simplewidgets.h
index 0c1cf5e..5182bdd 100644
--- a/src/plugins/accessible/widgets/simplewidgets.h
+++ b/src/plugins/accessible/widgets/simplewidgets.h
@@ -111,7 +111,7 @@ protected:
};
#endif // QT_NO_TOOLBUTTON
-class QAccessibleDisplay : public QAccessibleWidgetEx
+class QAccessibleDisplay : public QAccessibleWidgetEx, public QAccessibleImageInterface
{
Q_ACCESSIBLE_OBJECT
public:
@@ -122,6 +122,11 @@ public:
Relation relationTo(int child, const QAccessibleInterface *other, int otherChild) const;
int navigate(RelationFlag, int entry, QAccessibleInterface **target) const;
+
+ // QAccessibleImageInterface
+ QString imageDescription();
+ QSize imageSize();
+ QRect imagePosition(QAccessible2::CoordinateType coordType);
};
#ifndef QT_NO_LINEEDIT