From dc2512f3088d6f836ef06d35cbf1a5f7acb4ce7b Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Thu, 2 Mar 2017 13:39:22 +0100 Subject: Add feature.label and feature.formlayout Change-Id: Ic8dc0aee7f3fc0d8218ba709352b1378078c6070 Reviewed-by: Oswald Buddenhagen Reviewed-by: Lars Knoll --- src/widgets/accessible/qaccessiblewidget.cpp | 6 ++++-- src/widgets/accessible/simplewidgets.cpp | 19 +++++++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) (limited to 'src/widgets/accessible') 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(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/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp index 184b934c34..99b22a735e 100644 --- a/src/widgets/accessible/simplewidgets.cpp +++ b/src/widgets/accessible/simplewidgets.cpp @@ -49,7 +49,9 @@ #endif #include #include +#if QT_CONFIG(label) #include +#endif #include #include #include @@ -395,6 +397,7 @@ QAccessibleDisplay::QAccessibleDisplay(QWidget *w, QAccessible::Role role) QAccessible::Role QAccessibleDisplay::role() const { +#if QT_CONFIG(label) QLabel *l = qobject_cast(object()); if (l) { if (l->pixmap()) @@ -416,6 +419,7 @@ QAccessible::Role QAccessibleDisplay::role() const return QAccessible::StatusBar; #endif } +#endif return QAccessibleWidget::role(); } @@ -426,7 +430,9 @@ QString QAccessibleDisplay::text(QAccessible::Text t) const case QAccessible::Name: str = widget()->accessibleName(); if (str.isEmpty()) { - if (qobject_cast(object())) { + if (false) { +#if QT_CONFIG(label) + } else if (qobject_cast(object())) { QLabel *label = qobject_cast(object()); str = label->text(); #ifndef QT_NO_TEXTHTMLPARSER @@ -441,6 +447,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(object())) { QLCDNumber *l = qobject_cast(object()); @@ -475,7 +482,7 @@ QVector > QAccessibleDisplay::relations(QAccessible::Relation match /* = QAccessible::AllRelations */) const { QVector > rels = QAccessibleWidget::relations(match); -#ifndef QT_NO_SHORTCUT +#if QT_CONFIG(shortcut) && QT_CONFIG(label) if (match & QAccessible::Labelled) { if (QLabel *label = qobject_cast(object())) { const QAccessible::Relation rel = QAccessible::Labelled; @@ -507,26 +514,34 @@ QString QAccessibleDisplay::imageDescription() const /*! \internal */ QSize QAccessibleDisplay::imageSize() const { +#if QT_CONFIG(label) QLabel *label = qobject_cast(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(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 -- cgit v1.2.3