Accessibility: Use factory function instead of plugin
This simplifies deployment and makes instantiating accessible interfaces faster since no plugin needs to be loaded. [ChangeLog][QtWidgets] Accessibility for widgets is now included in the widget library instead of being a separate plugin. For static builds this means that libqtaccessiblewidgets is no longer required. Task-number: QTBUG-32888 Change-Id: Ie7347898868fd67c1fc568f0d251cbd2ef71e041 Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
This commit is contained in:
parent
55eec6829e
commit
eaee2bd0d0
@ -1,5 +0,0 @@
|
|||||||
TEMPLATE = subdirs
|
|
||||||
|
|
||||||
contains(QT_CONFIG, accessibility) {
|
|
||||||
SUBDIRS += widgets
|
|
||||||
}
|
|
@ -1,54 +0,0 @@
|
|||||||
{
|
|
||||||
"Keys": [
|
|
||||||
"QLineEdit",
|
|
||||||
"QComboBox",
|
|
||||||
"QAbstractSpinBox",
|
|
||||||
"QSpinBox",
|
|
||||||
"QDoubleSpinBox",
|
|
||||||
"QScrollBar",
|
|
||||||
"QSlider",
|
|
||||||
"QAbstractSlider",
|
|
||||||
"QToolButton",
|
|
||||||
"QCheckBox",
|
|
||||||
"QRadioButton",
|
|
||||||
"QPushButton",
|
|
||||||
"QAbstractButton",
|
|
||||||
"QDialog",
|
|
||||||
"QMessageBox",
|
|
||||||
"QMainWindow",
|
|
||||||
"QLabel",
|
|
||||||
"QLCDNumber",
|
|
||||||
"QGroupBox",
|
|
||||||
"QStatusBar",
|
|
||||||
"QProgressBar",
|
|
||||||
"QPlainTextEdit",
|
|
||||||
"QMenuBar",
|
|
||||||
"QMenu",
|
|
||||||
"QTabBar",
|
|
||||||
"QToolBar",
|
|
||||||
"QSizeGrip",
|
|
||||||
"QListView",
|
|
||||||
"QTreeView",
|
|
||||||
"QTableView",
|
|
||||||
"QWidget",
|
|
||||||
"QSplitter",
|
|
||||||
"QSplitterHandle",
|
|
||||||
"QTextEdit",
|
|
||||||
"QTipLabel",
|
|
||||||
"QFrame",
|
|
||||||
"QStackedWidget",
|
|
||||||
"QToolBox",
|
|
||||||
"QMdiArea",
|
|
||||||
"QMdiSubWindow",
|
|
||||||
"QDialogButtonBox",
|
|
||||||
"QDial",
|
|
||||||
"QRubberBand",
|
|
||||||
"QTextBrowser",
|
|
||||||
"QAbstractScrollArea",
|
|
||||||
"QScrollArea",
|
|
||||||
"QCalendarWidget",
|
|
||||||
"QDockWidget",
|
|
||||||
"QDesktopScreenWidget",
|
|
||||||
"QWindowContainer"
|
|
||||||
]
|
|
||||||
}
|
|
@ -3,6 +3,5 @@ TEMPLATE = subdirs
|
|||||||
SUBDIRS *= sqldrivers
|
SUBDIRS *= sqldrivers
|
||||||
!winrt:qtHaveModule(network): SUBDIRS += bearer
|
!winrt:qtHaveModule(network): SUBDIRS += bearer
|
||||||
qtHaveModule(gui): SUBDIRS *= imageformats platforms platforminputcontexts platformthemes generic
|
qtHaveModule(gui): SUBDIRS *= imageformats platforms platforminputcontexts platformthemes generic
|
||||||
qtHaveModule(widgets): SUBDIRS += accessible
|
|
||||||
|
|
||||||
!winrt:!wince*:qtHaveModule(widgets):SUBDIRS += printsupport
|
!winrt:!wince*:qtHaveModule(widgets):SUBDIRS += printsupport
|
||||||
|
@ -1,6 +1,23 @@
|
|||||||
# Qt accessibility module
|
# Qt accessibility module
|
||||||
|
|
||||||
contains(QT_CONFIG, accessibility) {
|
contains(QT_CONFIG, accessibility) {
|
||||||
HEADERS += accessible/qaccessiblewidget.h
|
HEADERS += \
|
||||||
SOURCES += accessible/qaccessiblewidget.cpp
|
accessible/qaccessiblewidget.h \
|
||||||
|
accessible/qaccessiblewidgetfactory_p.h \
|
||||||
|
accessible/complexwidgets.h \
|
||||||
|
accessible/itemviews.h \
|
||||||
|
accessible/qaccessiblemenu.h \
|
||||||
|
accessible/qaccessiblewidgets.h \
|
||||||
|
accessible/rangecontrols.h \
|
||||||
|
accessible/simplewidgets.h
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
accessible/qaccessiblewidget.cpp \
|
||||||
|
accessible/qaccessiblewidgetfactory.cpp \
|
||||||
|
accessible/complexwidgets.cpp \
|
||||||
|
accessible/itemviews.cpp \
|
||||||
|
accessible/qaccessiblemenu.cpp \
|
||||||
|
accessible/qaccessiblewidgets.cpp \
|
||||||
|
accessible/rangecontrols.cpp \
|
||||||
|
accessible/simplewidgets.cpp
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
QString Q_GUI_EXPORT qt_accStripAmp(const QString &text);
|
QString qt_accStripAmp(const QString &text);
|
||||||
|
|
||||||
#ifndef QT_NO_TABBAR
|
#ifndef QT_NO_TABBAR
|
||||||
/*!
|
/*!
|
@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
QString Q_GUI_EXPORT qt_accStripAmp(const QString &text);
|
QString qt_accStripAmp(const QString &text);
|
||||||
|
|
||||||
#ifndef QT_NO_ITEMVIEWS
|
#ifndef QT_NO_ITEMVIEWS
|
||||||
/*
|
/*
|
@ -52,8 +52,8 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
#ifndef QT_NO_MENU
|
#ifndef QT_NO_MENU
|
||||||
|
|
||||||
QString Q_GUI_EXPORT qt_accStripAmp(const QString &text);
|
QString qt_accStripAmp(const QString &text);
|
||||||
QString Q_GUI_EXPORT qt_accHotKey(const QString &text);
|
QString qt_accHotKey(const QString &text);
|
||||||
|
|
||||||
QAccessibleInterface *getOrCreateMenu(QWidget *menu, QAction *action)
|
QAccessibleInterface *getOrCreateMenu(QWidget *menu, QAction *action)
|
||||||
{
|
{
|
@ -134,7 +134,7 @@ static int qt_accAmpIndex(const QString &text)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Q_WIDGETS_EXPORT qt_accStripAmp(const QString &text)
|
QString qt_accStripAmp(const QString &text)
|
||||||
{
|
{
|
||||||
QString newText(text);
|
QString newText(text);
|
||||||
int ampIndex = qt_accAmpIndex(newText);
|
int ampIndex = qt_accAmpIndex(newText);
|
||||||
@ -144,7 +144,7 @@ QString Q_WIDGETS_EXPORT qt_accStripAmp(const QString &text)
|
|||||||
return newText.replace(QLatin1String("&&"), QLatin1String("&"));
|
return newText.replace(QLatin1String("&&"), QLatin1String("&"));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Q_WIDGETS_EXPORT qt_accHotKey(const QString &text)
|
QString qt_accHotKey(const QString &text)
|
||||||
{
|
{
|
||||||
int ampIndex = qt_accAmpIndex(text);
|
int ampIndex = qt_accAmpIndex(text);
|
||||||
if (ampIndex != -1)
|
if (ampIndex != -1)
|
||||||
|
@ -46,8 +46,6 @@
|
|||||||
#include "complexwidgets.h"
|
#include "complexwidgets.h"
|
||||||
#include "itemviews.h"
|
#include "itemviews.h"
|
||||||
|
|
||||||
#include <qaccessibleplugin.h>
|
|
||||||
#include <qplugin.h>
|
|
||||||
#include <qpushbutton.h>
|
#include <qpushbutton.h>
|
||||||
#include <qtoolbutton.h>
|
#include <qtoolbutton.h>
|
||||||
#include <qtreeview.h>
|
#include <qtreeview.h>
|
||||||
@ -58,23 +56,7 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *object)
|
||||||
class AccessibleFactory : public QAccessiblePlugin
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QAccessibleFactoryInterface" FILE "widgets.json")
|
|
||||||
|
|
||||||
public:
|
|
||||||
AccessibleFactory();
|
|
||||||
|
|
||||||
QAccessibleInterface *create(const QString &classname, QObject *object);
|
|
||||||
};
|
|
||||||
|
|
||||||
AccessibleFactory::AccessibleFactory()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObject *object)
|
|
||||||
{
|
{
|
||||||
QAccessibleInterface *iface = 0;
|
QAccessibleInterface *iface = 0;
|
||||||
if (!object || !object->isWidgetType())
|
if (!object || !object->isWidgetType())
|
||||||
@ -254,9 +236,6 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec
|
|||||||
return iface;
|
return iface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#include "main.moc"
|
|
||||||
|
|
||||||
#endif // QT_NO_ACCESSIBILITY
|
#endif // QT_NO_ACCESSIBILITY
|
53
src/widgets/accessible/qaccessiblewidgetfactory_p.h
Normal file
53
src/widgets/accessible/qaccessiblewidgetfactory_p.h
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of the QtWidgets module of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3.0 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU General Public License version 3.0 requirements will be
|
||||||
|
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <QtGui/qaccessible.h>
|
||||||
|
|
||||||
|
#ifndef QACCESSIBLEWIDGETFACTORY_H
|
||||||
|
#define QACCESSIBLEWIDGETFACTORY_H
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *object);
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
@ -72,8 +72,7 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
QString Q_GUI_EXPORT qt_accStripAmp(const QString &text);
|
QString qt_accStripAmp(const QString &text);
|
||||||
QString Q_GUI_EXPORT qt_accHotKey(const QString &text);
|
|
||||||
|
|
||||||
QList<QWidget*> childWidgets(const QWidget *widget, bool includeTopLevel)
|
QList<QWidget*> childWidgets(const QWidget *widget, bool includeTopLevel)
|
||||||
{
|
{
|
@ -57,7 +57,7 @@
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
#ifndef QT_NO_ACCESSIBILITY
|
#ifndef QT_NO_ACCESSIBILITY
|
||||||
extern QString Q_GUI_EXPORT qt_accStripAmp(const QString &text);
|
QString qt_accStripAmp(const QString &text);
|
||||||
#ifndef QT_NO_SCROLLBAR
|
#ifndef QT_NO_SCROLLBAR
|
||||||
extern QStyleOptionSlider Q_GUI_EXPORT qt_qscrollbarStyleOption(QScrollBar *scrollBar);
|
extern QStyleOptionSlider Q_GUI_EXPORT qt_qscrollbarStyleOption(QScrollBar *scrollBar);
|
||||||
#endif
|
#endif
|
@ -71,8 +71,8 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
extern QList<QWidget*> childWidgets(const QWidget *widget, bool includeTopLevel = false);
|
extern QList<QWidget*> childWidgets(const QWidget *widget, bool includeTopLevel = false);
|
||||||
|
|
||||||
QString Q_GUI_EXPORT qt_accStripAmp(const QString &text);
|
QString qt_accStripAmp(const QString &text);
|
||||||
QString Q_GUI_EXPORT qt_accHotKey(const QString &text);
|
QString qt_accHotKey(const QString &text);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class QAccessibleButton
|
\class QAccessibleButton
|
@ -77,6 +77,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "private/qkeymapper_p.h"
|
#include "private/qkeymapper_p.h"
|
||||||
|
#include "private/qaccessiblewidgetfactory_p.h"
|
||||||
|
|
||||||
#include <qthread.h>
|
#include <qthread.h>
|
||||||
#include <private/qthread_p.h>
|
#include <private/qthread_p.h>
|
||||||
@ -557,6 +558,11 @@ void QApplicationPrivate::construct()
|
|||||||
qt_gui_eval_init(application_type);
|
qt_gui_eval_init(application_type);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef QT_NO_ACCESSIBILITY
|
||||||
|
// factory for accessible interfaces for widgets shipped with Qt
|
||||||
|
QAccessible::installFactory(&qAccessibleFactory);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef QT_NO_LIBRARY
|
#ifndef QT_NO_LIBRARY
|
||||||
if(load_testability) {
|
if(load_testability) {
|
||||||
QLibrary testLib(QLatin1String("qttestability"));
|
QLibrary testLib(QLatin1String("qttestability"));
|
||||||
|
@ -8,9 +8,6 @@ DEFINES += QT_NO_USING_NAMESPACE
|
|||||||
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x65000000
|
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x65000000
|
||||||
irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
|
irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
|
||||||
|
|
||||||
MODULE_PLUGIN_TYPES += \
|
|
||||||
accessible/libqtaccessiblewidgets.so
|
|
||||||
|
|
||||||
QMAKE_DOCS = $$PWD/doc/qtwidgets.qdocconf
|
QMAKE_DOCS = $$PWD/doc/qtwidgets.qdocconf
|
||||||
|
|
||||||
load(qt_module)
|
load(qt_module)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user