#include "qaccessiblequickview.h"
#include "qaccessiblequickitem.h"
-#include <QtQuick/QQuickView>
+#include <QtQuick/QQuickWindow>
#include <QtQuick/QQuickItem>
#include <QtQuick/private/qquickitem_p.h>
#include <QtQuick/private/qquickaccessibleattached_p.h>
QStringList AccessibleQuickFactory::keys() const
{
QStringList list;
- list << QLatin1String("QQuickView");
+ list << QLatin1String("QQuickWindow");
list << QLatin1String("QQuickItem");
return list;
}
QAccessibleInterface *AccessibleQuickFactory::create(const QString &classname, QObject *object)
{
- if (classname == QLatin1String("QQuickView")) {
- return new QAccessibleQuickView(qobject_cast<QQuickView *>(object)); // FIXME
+ if (classname == QLatin1String("QQuickWindow")) {
+ return new QAccessibleQuickWindow(qobject_cast<QQuickWindow *>(object));
} else if (classname == QLatin1String("QQuickItem")) {
QQuickItem *item = qobject_cast<QQuickItem *>(object);
Q_ASSERT(item);
QT_BEGIN_NAMESPACE
-QAccessibleQuickView::QAccessibleQuickView(QQuickView *object)
+QAccessibleQuickWindow::QAccessibleQuickWindow(QQuickWindow *object)
:QAccessibleObject(object)
{
}
-int QAccessibleQuickView::childCount() const
+QQuickItem *QAccessibleQuickWindow::rootItem() const
{
- return view()->contentItem() ? 1 : 0;
+ if (window()->contentItem())
+ return window()->contentItem()->childItems().first();
+ return 0;
}
-QAccessibleInterface *QAccessibleQuickView::parent() const
+int QAccessibleQuickWindow::childCount() const
+{
+ return rootItem() ? 1 : 0;
+}
+
+QAccessibleInterface *QAccessibleQuickWindow::parent() const
{
// FIXME: for now we assume to be a top level window...
return QAccessible::queryAccessibleInterface(qApp);
}
-QAccessibleInterface *QAccessibleQuickView::child(int index) const
+QAccessibleInterface *QAccessibleQuickWindow::child(int index) const
{
if (index == 0) {
- if (QQuickItem *declarativeRoot = view()->rootObject())
+ if (QQuickItem *declarativeRoot = rootItem())
return new QAccessibleQuickItem(declarativeRoot);
}
return 0;
}
-QAccessible::Role QAccessibleQuickView::role() const
+QAccessible::Role QAccessibleQuickWindow::role() const
{
return QAccessible::Window; // FIXME
}
-QAccessible::State QAccessibleQuickView::state() const
+QAccessible::State QAccessibleQuickWindow::state() const
{
QAccessible::State st;
- if (view() == QGuiApplication::focusWindow())
+ if (window() == QGuiApplication::focusWindow())
st.active = true;
- if (!view()->isVisible())
+ if (!window()->isVisible())
st.invisible = true;
return st;
}
-QRect QAccessibleQuickView::rect() const
+QRect QAccessibleQuickWindow::rect() const
{
- return QRect(view()->x(), view()->y(), view()->width(), view()->height());
+ return QRect(window()->x(), window()->y(), window()->width(), window()->height());
}
-QString QAccessibleQuickView::text(QAccessible::Text text) const
+QString QAccessibleQuickWindow::text(QAccessible::Text text) const
{
#ifdef Q_ACCESSIBLE_QUICK_ITEM_ENABLE_DEBUG_DESCRIPTION
if (text == QAccessible::DebugDescription) {
#else
Q_UNUSED(text)
#endif
- return view()->title();
+ return window()->title();
}
return 0;
}
-QAccessibleInterface *QAccessibleQuickView::childAt(int x, int y) const
+QAccessibleInterface *QAccessibleQuickWindow::childAt(int x, int y) const
{
- Q_ASSERT(view());
- QQuickItem *root = view()->contentItem();
+ Q_ASSERT(window());
+ QQuickItem *root = rootItem();
if (root) {
if (QQuickItem *item = childAt_helper(root, x, y))
return QAccessible::queryAccessibleInterface(item);
return 0;
}
-int QAccessibleQuickView::indexOfChild(const QAccessibleInterface *iface) const
+int QAccessibleQuickWindow::indexOfChild(const QAccessibleInterface *iface) const
{
if (iface) {
- QQuickItem *declarativeRoot = view()->rootObject();
+ QQuickItem *declarativeRoot = rootItem();
if (declarativeRoot == iface->object())
return 0;
}
return -1;
-
}
QT_END_NAMESPACE
#include <QtGui/qaccessible2.h>
#include <QtGui/qaccessibleobject.h>
-#include <QtQuick/qquickview.h>
+#include <QtQuick/qquickwindow.h>
QT_BEGIN_NAMESPACE
#ifndef QT_NO_ACCESSIBILITY
-class QAccessibleQuickView : public QAccessibleObject
+class QAccessibleQuickWindow : public QAccessibleObject
{
public:
- QAccessibleQuickView(QQuickView *object);
+ QAccessibleQuickWindow(QQuickWindow *object);
QAccessibleInterface *parent() const;
QAccessibleInterface *child(int index) const;
int indexOfChild(const QAccessibleInterface *iface) const;
QString text(QAccessible::Text text) const;
QAccessibleInterface *childAt(int x, int y) const;
+
private:
- QQuickView *view() const { return static_cast<QQuickView*>(object()); }
+ QQuickWindow *window() const { return static_cast<QQuickWindow*>(object()); }
+ QQuickItem *rootItem() const;
};
#endif // QT_NO_ACCESSIBILITY