Make QWindowContainer accessible
Change-Id: I93451b8842648db0815c96d64d319daecb45f0de Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>bb10
parent
bb9dd25843
commit
760ad40700
|
|
@ -247,6 +247,8 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec
|
|||
iface = 0;
|
||||
} else if (classname == QLatin1String("QWidget")) {
|
||||
iface = new QAccessibleWidget(widget);
|
||||
} else if (classname == QLatin1String("QWindowContainer")) {
|
||||
iface = new QAccessibleWindowContainer(widget);
|
||||
}
|
||||
|
||||
return iface;
|
||||
|
|
|
|||
|
|
@ -57,6 +57,8 @@
|
|||
#include <qstyle.h>
|
||||
#include <qstyleoption.h>
|
||||
#include <qtextdocument.h>
|
||||
#include <qwindow.h>
|
||||
#include <private/qwindowcontainer_p.h>
|
||||
#include <QtCore/qvarlengtharray.h>
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
|
|
@ -845,7 +847,38 @@ QProgressBar *QAccessibleProgressBar::progressBar() const
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
QAccessibleWindowContainer::QAccessibleWindowContainer(QWidget *w)
|
||||
: QAccessibleWidget(w)
|
||||
{
|
||||
}
|
||||
|
||||
int QAccessibleWindowContainer::childCount() const
|
||||
{
|
||||
if (container()->containedWindow())
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int QAccessibleWindowContainer::indexOfChild(const QAccessibleInterface *child) const
|
||||
{
|
||||
if (child->object() == container()->containedWindow())
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
QAccessibleInterface *QAccessibleWindowContainer::child(int i) const
|
||||
{
|
||||
if (i == 0)
|
||||
return QAccessible::queryAccessibleInterface(container()->containedWindow());
|
||||
return 0;
|
||||
}
|
||||
|
||||
QWindowContainer *QAccessibleWindowContainer::container() const
|
||||
{
|
||||
return static_cast<QWindowContainer *>(widget());
|
||||
}
|
||||
|
||||
#endif // QT_NO_ACCESSIBILITY
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
|
|
|||
|
|
@ -195,6 +195,19 @@ protected:
|
|||
};
|
||||
#endif
|
||||
|
||||
class QWindowContainer;
|
||||
class QAccessibleWindowContainer : public QAccessibleWidget
|
||||
{
|
||||
public:
|
||||
QAccessibleWindowContainer(QWidget *w);
|
||||
int childCount() const Q_DECL_OVERRIDE;
|
||||
int indexOfChild(const QAccessibleInterface *child) const Q_DECL_OVERRIDE;
|
||||
QAccessibleInterface *child(int i) const Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QWindowContainer *container() const;
|
||||
};
|
||||
|
||||
#endif // QT_NO_ACCESSIBILITY
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
"QScrollArea",
|
||||
"QCalendarWidget",
|
||||
"QDockWidget",
|
||||
"QDesktopScreenWidget"
|
||||
"QDesktopScreenWidget",
|
||||
"QWindowContainer"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,7 +200,11 @@ QWindowContainer::QWindowContainer(QWindow *embeddedWindow, QWidget *parent, Qt:
|
|||
connect(QGuiApplication::instance(), SIGNAL(focusWindowChanged(QWindow *)), this, SLOT(focusWindowChanged(QWindow *)));
|
||||
}
|
||||
|
||||
|
||||
QWindow *QWindowContainer::containedWindow() const
|
||||
{
|
||||
Q_D(const QWindowContainer);
|
||||
return d->window;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
|
|||
|
||||
class QWindowContainerPrivate;
|
||||
|
||||
class QWindowContainer : public QWidget
|
||||
class Q_WIDGETS_EXPORT QWindowContainer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DECLARE_PRIVATE(QWindowContainer)
|
||||
|
|
@ -56,6 +56,7 @@ class QWindowContainer : public QWidget
|
|||
public:
|
||||
explicit QWindowContainer(QWindow *embeddedWindow, QWidget *parent = 0, Qt::WindowFlags f = 0);
|
||||
~QWindowContainer();
|
||||
QWindow *containedWindow() const;
|
||||
|
||||
static void toplevelAboutToBeDestroyed(QWidget *parent);
|
||||
static void parentWasChanged(QWidget *parent);
|
||||
|
|
|
|||
Loading…
Reference in New Issue