diff options
Diffstat (limited to 'src/widgets/accessible/qaccessiblewidget.cpp')
-rw-r--r-- | src/widgets/accessible/qaccessiblewidget.cpp | 52 |
1 files changed, 20 insertions, 32 deletions
diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp index 4e5fade3f4..f835a36a92 100644 --- a/src/widgets/accessible/qaccessiblewidget.cpp +++ b/src/widgets/accessible/qaccessiblewidget.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 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$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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 +** 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** 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 +** 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$ ** ****************************************************************************/ @@ -70,7 +62,8 @@ static QList<QWidget*> childWidgets(const QWidget *widget) #if !defined(QT_NO_MENU) && !qobject_cast<QMenu*>(w) #endif - && w->objectName() != QLatin1String("qt_rubberband")) + && w->objectName() != QLatin1String("qt_rubberband") + && w->objectName() != QLatin1String("qt_spinbox_lineedit")) widgets.append(w); } return widgets; @@ -111,7 +104,6 @@ static int qt_accAmpIndex(const QString &text) return -1; int fa = 0; - QChar ac; while ((fa = text.indexOf(QLatin1Char('&'), fa)) != -1) { ++fa; if (fa < text.length()) { @@ -134,7 +126,7 @@ static int qt_accAmpIndex(const QString &text) #endif } -QString Q_WIDGETS_EXPORT qt_accStripAmp(const QString &text) +QString qt_accStripAmp(const QString &text) { QString newText(text); int ampIndex = qt_accAmpIndex(newText); @@ -144,7 +136,7 @@ QString Q_WIDGETS_EXPORT qt_accStripAmp(const QString &text) 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); if (ampIndex != -1) @@ -240,10 +232,10 @@ QWidget *QAccessibleWidget::widget() const */ QObject *QAccessibleWidget::parentObject() const { - QObject *parent = object()->parent(); - if (!parent) - parent = qApp; - return parent; + QWidget *w = widget(); + if (!w || w->isWindow() || !w->parentWidget()) + return qApp; + return w->parent(); } /*! \reimp */ @@ -353,11 +345,7 @@ QAccessibleWidget::relations(QAccessible::Relation match /*= QAccessible::AllRel /*! \reimp */ QAccessibleInterface *QAccessibleWidget::parent() const { - Q_ASSERT(widget()); - QObject *parentWidget= widget()->parentWidget(); - if (!parentWidget) - parentWidget = qApp; - return QAccessible::queryAccessibleInterface(parentWidget); + return QAccessible::queryAccessibleInterface(parentObject()); } /*! \reimp */ |