summaryrefslogtreecommitdiffstats
path: root/src/widgets/accessible
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/accessible')
-rw-r--r--src/widgets/accessible/complexwidgets.cpp1
-rw-r--r--src/widgets/accessible/qaccessiblewidget.cpp6
-rw-r--r--src/widgets/accessible/qaccessiblewidgetfactory.cpp5
-rw-r--r--src/widgets/accessible/qaccessiblewidgets.cpp7
-rw-r--r--src/widgets/accessible/qaccessiblewidgets_p.h2
-rw-r--r--src/widgets/accessible/simplewidgets.cpp59
-rw-r--r--src/widgets/accessible/simplewidgets_p.h2
7 files changed, 61 insertions, 21 deletions
diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp
index ea3b88468b..397a58a5d4 100644
--- a/src/widgets/accessible/complexwidgets.cpp
+++ b/src/widgets/accessible/complexwidgets.cpp
@@ -41,7 +41,6 @@
#include <qaccessible.h>
#include <qapplication.h>
-#include <qabstractbutton.h>
#include <qevent.h>
#include <qheaderview.h>
#include <qtabbar.h>
diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp
index 840a990799..94cf58ae3b 100644
--- a/src/widgets/accessible/qaccessiblewidget.cpp
+++ b/src/widgets/accessible/qaccessiblewidget.cpp
@@ -44,7 +44,9 @@
#include "qaction.h"
#include "qapplication.h"
#include "qgroupbox.h"
+#if QT_CONFIG(label)
#include "qlabel.h"
+#endif
#include "qtooltip.h"
#include "qwhatsthis.h"
#include "qwidget.h"
@@ -81,7 +83,7 @@ static QString buddyString(const QWidget *widget)
QWidget *parent = widget->parentWidget();
if (!parent)
return QString();
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut) && QT_CONFIG(label)
for (QObject *o : parent->children()) {
QLabel *label = qobject_cast<QLabel*>(o);
if (label && label->buddy() == widget)
@@ -309,7 +311,7 @@ QAccessibleWidget::relations(QAccessible::Relation match /*= QAccessible::AllRel
if (match & QAccessible::Label) {
const QAccessible::Relation rel = QAccessible::Label;
if (QWidget *parent = widget()->parentWidget()) {
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut) && QT_CONFIG(label)
// first check for all siblings that are labels to us
// ideally we would go through all objects and check, but that
// will be too expensive
diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
index da184fd90d..e7db53c251 100644
--- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp
+++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp
@@ -45,7 +45,6 @@
#include "complexwidgets_p.h"
#include "itemviews_p.h"
-#include <qpushbutton.h>
#include <qtoolbutton.h>
#include <qtreeview.h>
#include <qvariant.h>
@@ -104,11 +103,13 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
} else if (classname == QLatin1String("QToolButton")) {
iface = new QAccessibleToolButton(widget);
#endif // QT_NO_TOOLBUTTON
+#if QT_CONFIG(abstractbutton)
} else if (classname == QLatin1String("QCheckBox")
|| classname == QLatin1String("QRadioButton")
|| classname == QLatin1String("QPushButton")
|| classname == QLatin1String("QAbstractButton")) {
iface = new QAccessibleButton(widget);
+#endif
} else if (classname == QLatin1String("QDialog")) {
iface = new QAccessibleWidget(widget, QAccessible::Dialog);
} else if (classname == QLatin1String("QMessageBox")) {
@@ -184,8 +185,10 @@ QAccessibleInterface *qAccessibleFactory(const QString &classname, QObject *obje
} else if (classname == QLatin1String("QMdiSubWindow")) {
iface = new QAccessibleMdiSubWindow(widget);
#endif
+#if QT_CONFIG(dialogbuttonbox)
} else if (classname == QLatin1String("QDialogButtonBox")) {
iface = new QAccessibleDialogButtonBox(widget);
+#endif
#ifndef QT_NO_DIAL
} else if (classname == QLatin1String("QDial")) {
iface = new QAccessibleDial(widget);
diff --git a/src/widgets/accessible/qaccessiblewidgets.cpp b/src/widgets/accessible/qaccessiblewidgets.cpp
index 4c48ecb465..7f77f7c524 100644
--- a/src/widgets/accessible/qaccessiblewidgets.cpp
+++ b/src/widgets/accessible/qaccessiblewidgets.cpp
@@ -54,7 +54,9 @@
#include <QToolBox>
#include <QMdiArea>
#include <QMdiSubWindow>
+#if QT_CONFIG(dialogbuttonbox)
#include <QDialogButtonBox>
+#endif
#include <limits.h>
#include <QRubberBand>
#include <QTextBrowser>
@@ -62,7 +64,6 @@
#include <QAbstractItemView>
#include <QDockWidget>
#include <QMainWindow>
-#include <QAbstractButton>
#include <private/qdockwidget_p.h>
#include <QFocusFrame>
@@ -480,7 +481,7 @@ QMdiSubWindow *QAccessibleMdiSubWindow::mdiSubWindow() const
}
#endif // QT_NO_MDIAREA
-#ifndef QT_NO_DIALOGBUTTONBOX
+#if QT_CONFIG(dialogbuttonbox)
// ======================= QAccessibleDialogButtonBox ======================
QAccessibleDialogButtonBox::QAccessibleDialogButtonBox(QWidget *widget)
: QAccessibleWidget(widget, QAccessible::Grouping)
@@ -488,7 +489,7 @@ QAccessibleDialogButtonBox::QAccessibleDialogButtonBox(QWidget *widget)
Q_ASSERT(qobject_cast<QDialogButtonBox*>(widget));
}
-#endif // QT_NO_DIALOGBUTTONBOX
+#endif // QT_CONFIG(dialogbuttonbox)
#if !defined(QT_NO_TEXTBROWSER) && !defined(QT_NO_CURSOR)
QAccessibleTextBrowser::QAccessibleTextBrowser(QWidget *widget)
diff --git a/src/widgets/accessible/qaccessiblewidgets_p.h b/src/widgets/accessible/qaccessiblewidgets_p.h
index 052958d4c7..4d945a2016 100644
--- a/src/widgets/accessible/qaccessiblewidgets_p.h
+++ b/src/widgets/accessible/qaccessiblewidgets_p.h
@@ -248,11 +248,13 @@ protected:
};
#endif // QT_NO_MDIAREA
+#if QT_CONFIG(dialogbuttonbox)
class QAccessibleDialogButtonBox : public QAccessibleWidget
{
public:
explicit QAccessibleDialogButtonBox(QWidget *widget);
};
+#endif
#if !defined(QT_NO_TEXTBROWSER) && !defined(QT_NO_CURSOR)
class QAccessibleTextBrowser : public QAccessibleTextEdit
diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp
index a806cb7af6..a53e5eaf30 100644
--- a/src/widgets/accessible/simplewidgets.cpp
+++ b/src/widgets/accessible/simplewidgets.cpp
@@ -39,15 +39,25 @@
#include "simplewidgets_p.h"
+#if QT_CONFIG(abstractbutton)
#include <qabstractbutton.h>
+#endif
+#if QT_CONFIG(checkbox)
#include <qcheckbox.h>
+#endif
+#if QT_CONFIG(pushbutton)
#include <qpushbutton.h>
+#endif
#include <qprogressbar.h>
#include <qstatusbar.h>
+#if QT_CONFIG(radiobutton)
#include <qradiobutton.h>
+#endif
#include <qtoolbutton.h>
#include <qmenu.h>
+#if QT_CONFIG(label)
#include <qlabel.h>
+#endif
#include <qgroupbox.h>
#include <qlcdnumber.h>
#include <qlineedit.h>
@@ -72,6 +82,7 @@ extern QList<QWidget*> childWidgets(const QWidget *widget);
QString qt_accStripAmp(const QString &text);
QString qt_accHotKey(const QString &text);
+#if QT_CONFIG(abstractbutton)
/*!
\class QAccessibleButton
\brief The QAccessibleButton class implements the QAccessibleInterface for button type widgets.
@@ -109,7 +120,7 @@ QString QAccessibleButton::text(QAccessible::Text t) const
switch (t) {
case QAccessible::Accelerator:
{
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut) && QT_CONFIG(pushbutton)
QPushButton *pb = qobject_cast<QPushButton*>(object());
if (pb && pb->isDefault())
str = QKeySequence(Qt::Key_Enter).toString(QKeySequence::NativeText);
@@ -136,15 +147,20 @@ QAccessible::State QAccessibleButton::state() const
QAccessible::State state = QAccessibleWidget::state();
QAbstractButton *b = button();
+#if QT_CONFIG(checkbox)
QCheckBox *cb = qobject_cast<QCheckBox *>(b);
+#endif
if (b->isCheckable())
state.checkable = true;
if (b->isChecked())
state.checked = true;
+#if QT_CONFIG(checkbox)
else if (cb && cb->checkState() == Qt::PartiallyChecked)
state.checkStateMixed = true;
+#endif
if (b->isDown())
state.pressed = true;
+#if QT_CONFIG(pushbutton)
QPushButton *pb = qobject_cast<QPushButton*>(b);
if (pb) {
if (pb->isDefault())
@@ -154,6 +170,7 @@ QAccessible::State QAccessibleButton::state() const
state.hasPopup = true;
#endif
}
+#endif
return state;
}
@@ -164,17 +181,22 @@ QRect QAccessibleButton::rect() const
if (!ab->isVisible())
return QRect();
+#if QT_CONFIG(checkbox)
if (QCheckBox *cb = qobject_cast<QCheckBox *>(ab)) {
QPoint wpos = cb->mapToGlobal(QPoint(0, 0));
QStyleOptionButton opt;
cb->initStyleOption(&opt);
return cb->style()->subElementRect(QStyle::SE_CheckBoxClickRect, &opt, cb).translated(wpos);
- } else if (QRadioButton *rb = qobject_cast<QRadioButton *>(ab)) {
+ }
+#endif
+#if QT_CONFIG(radiobutton)
+ else if (QRadioButton *rb = qobject_cast<QRadioButton *>(ab)) {
QPoint wpos = rb->mapToGlobal(QPoint(0, 0));
QStyleOptionButton opt;
rb->initStyleOption(&opt);
return rb->style()->subElementRect(QStyle::SE_RadioButtonClickRect, &opt, rb).translated(wpos);
}
+#endif
return QAccessibleWidget::rect();
}
@@ -248,7 +270,7 @@ QStringList QAccessibleButton::keyBindingsForAction(const QString &actionName) c
}
return QStringList();
}
-
+#endif // QT_CONFIG(abstractbutton)
#ifndef QT_NO_TOOLBUTTON
/*!
@@ -390,6 +412,7 @@ QAccessibleDisplay::QAccessibleDisplay(QWidget *w, QAccessible::Role role)
QAccessible::Role QAccessibleDisplay::role() const
{
+#if QT_CONFIG(label)
QLabel *l = qobject_cast<QLabel*>(object());
if (l) {
if (l->pixmap())
@@ -411,6 +434,7 @@ QAccessible::Role QAccessibleDisplay::role() const
return QAccessible::StatusBar;
#endif
}
+#endif
return QAccessibleWidget::role();
}
@@ -421,7 +445,9 @@ QString QAccessibleDisplay::text(QAccessible::Text t) const
case QAccessible::Name:
str = widget()->accessibleName();
if (str.isEmpty()) {
- if (qobject_cast<QLabel*>(object())) {
+ if (false) {
+#if QT_CONFIG(label)
+ } else if (qobject_cast<QLabel*>(object())) {
QLabel *label = qobject_cast<QLabel*>(object());
str = label->text();
#ifndef QT_NO_TEXTHTMLPARSER
@@ -436,6 +462,7 @@ QString QAccessibleDisplay::text(QAccessible::Text t) const
if (label->buddy())
str = qt_accStripAmp(str);
#endif
+#endif // QT_CONFIG(label)
#ifndef QT_NO_LCDNUMBER
} else if (qobject_cast<QLCDNumber*>(object())) {
QLCDNumber *l = qobject_cast<QLCDNumber*>(object());
@@ -470,21 +497,15 @@ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> >
QAccessibleDisplay::relations(QAccessible::Relation match /* = QAccessible::AllRelations */) const
{
QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > rels = QAccessibleWidget::relations(match);
+#if QT_CONFIG(shortcut) && QT_CONFIG(label)
if (match & QAccessible::Labelled) {
- QVarLengthArray<QObject *, 4> relatedObjects;
-
-#ifndef QT_NO_SHORTCUT
if (QLabel *label = qobject_cast<QLabel*>(object())) {
- relatedObjects.append(label->buddy());
- }
-#endif
- for (int i = 0; i < relatedObjects.count(); ++i) {
const QAccessible::Relation rel = QAccessible::Labelled;
- QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(relatedObjects.at(i));
- if (iface)
+ if (QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(label->buddy()))
rels.append(qMakePair(iface, rel));
}
}
+#endif
return rels;
}
@@ -501,33 +522,41 @@ QString QAccessibleDisplay::imageDescription() const
#ifndef QT_NO_TOOLTIP
return widget()->toolTip();
#else
- return QString::null;
+ return QString();
#endif
}
/*! \internal */
QSize QAccessibleDisplay::imageSize() const
{
+#if QT_CONFIG(label)
QLabel *label = qobject_cast<QLabel *>(widget());
if (!label)
+#endif
return QSize();
+#if QT_CONFIG(label)
const QPixmap *pixmap = label->pixmap();
if (!pixmap)
return QSize();
return pixmap->size();
+#endif
}
/*! \internal */
QPoint QAccessibleDisplay::imagePosition() const
{
+#if QT_CONFIG(label)
QLabel *label = qobject_cast<QLabel *>(widget());
if (!label)
+#endif
return QPoint();
+#if QT_CONFIG(label)
const QPixmap *pixmap = label->pixmap();
if (!pixmap)
return QPoint();
return QPoint(label->mapToGlobal(label->pos()));
+#endif
}
#ifndef QT_NO_GROUPBOX
@@ -670,11 +699,13 @@ void QAccessibleLineEdit::setText(QAccessible::Text t, const QString &text)
}
QString newText = text;
+#if QT_CONFIG(validator)
if (lineEdit()->validator()) {
int pos = 0;
if (lineEdit()->validator()->validate(newText, pos) != QValidator::Acceptable)
return;
}
+#endif
lineEdit()->setText(newText);
}
diff --git a/src/widgets/accessible/simplewidgets_p.h b/src/widgets/accessible/simplewidgets_p.h
index 8bd0af8261..1e4ae5ab67 100644
--- a/src/widgets/accessible/simplewidgets_p.h
+++ b/src/widgets/accessible/simplewidgets_p.h
@@ -65,6 +65,7 @@ class QToolButton;
class QGroupBox;
class QProgressBar;
+#if QT_CONFIG(abstractbutton)
class QAccessibleButton : public QAccessibleWidget
{
Q_DECLARE_TR_FUNCTIONS(QAccessibleButton)
@@ -83,6 +84,7 @@ public:
protected:
QAbstractButton *button() const;
};
+#endif
#ifndef QT_NO_TOOLBUTTON
class QAccessibleToolButton : public QAccessibleButton