From 4ce80b299ccc805b08c1c0227adda92049a2187e Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 21 Oct 2016 21:36:53 +0200 Subject: Fix Shortcut to respect modal popups In the Gallery example, the back navigation shortcut no longer activates when the settings dialog or the about dialog is open. Notice that the back navigation shortcut still activates while the options menu is open. [ChangeLog][Controls][Popup] The QML Shortcut type from QtQuick has been fixed to respect modal popups from QtQuick Controls 2. Task-number: QTBUG-56562 Change-Id: I4c3c762e9db0935ef250ff9f8c553e7d211220c7 Reviewed-by: Mitch Curtis Reviewed-by: Qt CI Bot --- src/imports/templates/qtquicktemplates2plugin.cpp | 19 ++++++ src/quicktemplates2/qquickshortcutcontext.cpp | 79 +++++++++++++++++++++++ src/quicktemplates2/qquickshortcutcontext_p_p.h | 65 +++++++++++++++++++ src/quicktemplates2/quicktemplates2.pri | 2 + 4 files changed, 165 insertions(+) create mode 100644 src/quicktemplates2/qquickshortcutcontext.cpp create mode 100644 src/quicktemplates2/qquickshortcutcontext_p_p.h diff --git a/src/imports/templates/qtquicktemplates2plugin.cpp b/src/imports/templates/qtquicktemplates2plugin.cpp index b0ec18d3..2c87fd45 100644 --- a/src/imports/templates/qtquicktemplates2plugin.cpp +++ b/src/imports/templates/qtquicktemplates2plugin.cpp @@ -65,6 +65,7 @@ #include #include #include +#include #include #include #include @@ -88,6 +89,11 @@ static inline void initResources() #endif } +// qtdeclarative/src/quick/util/qquickshortcut.cpp +typedef bool (*ShortcutContextMatcher)(QObject *, Qt::ShortcutContext); +extern ShortcutContextMatcher qt_quick_shortcut_context_matcher(); +extern void qt_quick_set_shortcut_context_matcher(ShortcutContextMatcher matcher); + QT_BEGIN_NAMESPACE class QtQuickTemplates2Plugin: public QQmlExtensionPlugin @@ -97,12 +103,25 @@ class QtQuickTemplates2Plugin: public QQmlExtensionPlugin public: QtQuickTemplates2Plugin(QObject *parent = nullptr); + ~QtQuickTemplates2Plugin(); + void registerTypes(const char *uri); + +private: + ShortcutContextMatcher originalContextMatcher; }; QtQuickTemplates2Plugin::QtQuickTemplates2Plugin(QObject *parent) : QQmlExtensionPlugin(parent) { initResources(); + + originalContextMatcher = qt_quick_shortcut_context_matcher(); + qt_quick_set_shortcut_context_matcher(QQuickShortcutContext::matcher); +} + +QtQuickTemplates2Plugin::~QtQuickTemplates2Plugin() +{ + qt_quick_set_shortcut_context_matcher(originalContextMatcher); } void QtQuickTemplates2Plugin::registerTypes(const char *uri) diff --git a/src/quicktemplates2/qquickshortcutcontext.cpp b/src/quicktemplates2/qquickshortcutcontext.cpp new file mode 100644 index 00000000..2a3cb68a --- /dev/null +++ b/src/quicktemplates2/qquickshortcutcontext.cpp @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/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 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later 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 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qquickshortcutcontext_p_p.h" +#include "qquickoverlay_p_p.h" +#include "qquickpopup_p.h" + +#include + +QT_BEGIN_NAMESPACE + +static bool isBlockedByPopup(QQuickItem *item) +{ + if (!item || !item->window()) + return false; + + QQuickOverlay *overlay = QQuickOverlay::overlay(item->window()); + const auto popups = QQuickOverlayPrivate::get(overlay)->stackingOrderPopups(); + for (QQuickPopup *popup : popups) { + if (popup->isModal()) + return !popup->popupItem()->isAncestorOf(item); + } + + return false; +} + +bool QQuickShortcutContext::matcher(QObject *obj, Qt::ShortcutContext context) +{ + QQuickItem *item = nullptr; + switch (context) { + case Qt::ApplicationShortcut: + return true; + case Qt::WindowShortcut: + while (obj && !obj->isWindowType()) { + obj = obj->parent(); + item = qobject_cast(obj); + if (item) + obj = item->window(); + } + return obj && obj == QGuiApplication::focusWindow() && !isBlockedByPopup(item); + default: + return false; + } +} + +QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickshortcutcontext_p_p.h b/src/quicktemplates2/qquickshortcutcontext_p_p.h new file mode 100644 index 00000000..3866dfd8 --- /dev/null +++ b/src/quicktemplates2/qquickshortcutcontext_p_p.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/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 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later 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 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QQUICKSHORTCUTCONTEXT_P_P_H +#define QQUICKSHORTCUTCONTEXT_P_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include + +QT_BEGIN_NAMESPACE + +class QObject; + +struct Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickShortcutContext +{ + static bool matcher(QObject *object, Qt::ShortcutContext context); +}; + +QT_END_NAMESPACE + +#endif // QQUICKSHORTCUTCONTEXT_P_P_H diff --git a/src/quicktemplates2/quicktemplates2.pri b/src/quicktemplates2/quicktemplates2.pri index 0a9d2fd5..5877b3d0 100644 --- a/src/quicktemplates2/quicktemplates2.pri +++ b/src/quicktemplates2/quicktemplates2.pri @@ -42,6 +42,7 @@ HEADERS += \ $$PWD/qquickrangeslider_p.h \ $$PWD/qquickscrollbar_p.h \ $$PWD/qquickscrollindicator_p.h \ + $$PWD/qquickshortcutcontext_p_p.h \ $$PWD/qquickslider_p.h \ $$PWD/qquickspinbox_p.h \ $$PWD/qquickstackview_p.h \ @@ -93,6 +94,7 @@ SOURCES += \ $$PWD/qquickrangeslider.cpp \ $$PWD/qquickscrollbar.cpp \ $$PWD/qquickscrollindicator.cpp \ + $$PWD/qquickshortcutcontext.cpp \ $$PWD/qquickslider.cpp \ $$PWD/qquickspinbox.cpp \ $$PWD/qquickstackview.cpp \ -- cgit v1.2.3 From 45a4bafb2f0d7b177a1938f353af1ea103027c68 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 28 Oct 2016 16:41:41 +0200 Subject: Doc: fix some review findings for TabBar Change-Id: Ia5c8c4e4554f3171537184114c25724179843b5e Task-number: QTBUG-55904 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquicktabbar.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/quicktemplates2/qquicktabbar.cpp b/src/quicktemplates2/qquicktabbar.cpp index 6d11f72a..73c7734c 100644 --- a/src/quicktemplates2/qquicktabbar.cpp +++ b/src/quicktemplates2/qquicktabbar.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE \since 5.7 \ingroup qtquickcontrols2-navigation \ingroup qtquickcontrols2-containers - \brief A bar with icons allowing to switch between different views or subtasks. + \brief A bar with tabs that allows the user to switch between different views or subtasks. TabBar provides a tab-based navigation model. @@ -60,6 +60,13 @@ QT_BEGIN_NAMESPACE \snippet qtquickcontrols2-tabbar.qml 1 + As shown above, TabBar is typically populated with a static set of tab buttons + that are defined inline as children of the tab bar. It is also possible to + \l {Container::addItem()}{add}, \l {Container::insertItem()}{insert}, + \l {Container::moveItem()}{move}, and \l {Container::removeItem()}{remove} + items dynamically at run time. The items can be accessed using + \l {Container::}{itemAt()} or \l {Container::}{contentChildren}. + \section2 Resizing Tabs By default, TabBar resizes its buttons to fit the width of the control. @@ -176,8 +183,8 @@ QQuickTabBar::QQuickTabBar(QQuickItem *parent) : This property holds the position of the tab bar. - \note If the tab bar is assigned as a header or footer of ApplicationWindow - or Page, the appropriate position is set automatically. + \note If the tab bar is assigned as a header or footer of \l ApplicationWindow + or \l Page, the appropriate position is set automatically. Possible values: \value TabBar.Header The tab bar is at the top, as a window or page header. -- cgit v1.2.3 From 41c754db53f7139f351346f1659a28fa13d2eb08 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 31 Oct 2016 12:41:04 +0100 Subject: Doc: add links to ToolTip attached properties and methods Change-Id: Ia9edcf69ca4a36f9e50e03787fe82b79aca9d2a3 Task-number: QTBUG-55904 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquicktooltip.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp index a1601ad6..b29e806c 100644 --- a/src/quicktemplates2/qquicktooltip.cpp +++ b/src/quicktemplates2/qquicktooltip.cpp @@ -62,6 +62,8 @@ QT_BEGIN_NAMESPACE \image qtquickcontrols2-tooltip.png + \section2 Attached Tool Tips + The most straight-forward way to setup tool tips for controls is to specify \l text and \l {visible}{visibility} via attached properties. The following example illustrates this approach: @@ -358,6 +360,8 @@ QQuickToolTipAttached::QQuickToolTipAttached(QObject *parent) : This attached property holds the text of the shared tool tip. The property can be attached to any item. + + \sa {Attached Tool Tips} */ QString QQuickToolTipAttached::text() const { @@ -384,7 +388,7 @@ void QQuickToolTipAttached::setText(const QString &text) This attached property holds the delay (milliseconds) of the shared tool tip. The property can be attached to any item. - \sa {Delay and Timeout} + \sa {Attached Tool Tips}, {Delay and Timeout} */ int QQuickToolTipAttached::delay() const { @@ -411,7 +415,7 @@ void QQuickToolTipAttached::setDelay(int delay) This attached property holds the timeout (milliseconds) of the shared tool tip. The property can be attached to any item. - \sa {Delay and Timeout} + \sa {Attached Tool Tips}, {Delay and Timeout} */ int QQuickToolTipAttached::timeout() const { @@ -437,6 +441,8 @@ void QQuickToolTipAttached::setTimeout(int timeout) This attached property holds whether the shared tool tip is visible. The property can be attached to any item. + + \sa {Attached Tool Tips} */ bool QQuickToolTipAttached::isVisible() const { @@ -462,6 +468,8 @@ void QQuickToolTipAttached::setVisible(bool visible) This attached property holds the shared tool tip instance. The property can be attached to any item. + + \sa {Attached Tool Tips} */ QQuickToolTip *QQuickToolTipAttached::toolTip() const { @@ -474,6 +482,8 @@ QQuickToolTip *QQuickToolTipAttached::toolTip() const This attached method shows the shared tooltip with \a text and \a timeout (milliseconds). The method can be attached to any item. + + \sa {Attached Tool Tips} */ void QQuickToolTipAttached::show(const QString &text, int ms) { @@ -495,6 +505,8 @@ void QQuickToolTipAttached::show(const QString &text, int ms) \qmlattachedmethod void QtQuick.Controls::ToolTip::hide() This attached method hides the shared tooltip. The method can be attached to any item. + + \sa {Attached Tool Tips} */ void QQuickToolTipAttached::hide() { -- cgit v1.2.3 From 13d30e0349bbaa0af5bdebbada559da20c696549 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 31 Oct 2016 15:31:46 +0100 Subject: Doc: mention that some SwipeDelegate::swipe properties are read-only Change-Id: Ie9eeecc73cd3fa6d4fd8aa17abb38c4dc03f2024 Task-number: QTBUG-55904 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickswipedelegate.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/quicktemplates2/qquickswipedelegate.cpp b/src/quicktemplates2/qquickswipedelegate.cpp index 0edf7106..b812f939 100644 --- a/src/quicktemplates2/qquickswipedelegate.cpp +++ b/src/quicktemplates2/qquickswipedelegate.cpp @@ -768,13 +768,13 @@ QQuickSwipeDelegate::QQuickSwipeDelegate(QQuickItem *parent) : \li Description \row \li position - \li This property holds the position of the swipe relative to either + \li This read-only property holds the position of the swipe relative to either side of the control. When this value reaches either \c -1.0 (left side) or \c 1.0 (right side) and the mouse button is released, \c complete will be \c true. \row \li complete - \li This property holds whether the control is fully exposed after + \li This read-only property holds whether the control is fully exposed after having been swiped to the left or right. When complete is \c true, any interactive items declared in \c left, @@ -810,19 +810,19 @@ QQuickSwipeDelegate::QQuickSwipeDelegate(QQuickItem *parent) : \include qquickswipedelegate-interaction.qdocinc \row \li leftItem - \li This property holds the item instantiated from the \c left component. + \li This read-only property holds the item instantiated from the \c left component. If \c left has not been set, or the position hasn't changed since creation of the SwipeDelegate, this property will be \c null. \row \li behindItem - \li This property holds the item instantiated from the \c behind component. + \li This read-only property holds the item instantiated from the \c behind component. If \c behind has not been set, or the position hasn't changed since creation of the SwipeDelegate, this property will be \c null. \row \li rightItem - \li This property holds the item instantiated from the \c right component. + \li This read-only property holds the item instantiated from the \c right component. If \c right has not been set, or the position hasn't changed since creation of the SwipeDelegate, this property will be \c null. -- cgit v1.2.3 From 281469e947e6b09a44c296a26db474db815f6238 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 31 Oct 2016 17:01:57 +0100 Subject: Doc: fix review findings for Popup Change-Id: I8494ffe1a46a05a01d31787783b5f8e9cc810f36 Task-number: QTBUG-55904 Reviewed-by: Mitch Curtis --- .../controls/doc/images/qtquickcontrols2-popup.png | Bin 0 -> 21693 bytes .../controls/doc/images/qtquickcontrols2-popup.svg | 391 +++++++++++++++++++++ src/quicktemplates2/qquickpopup.cpp | 148 +++++++- 3 files changed, 528 insertions(+), 11 deletions(-) create mode 100644 src/imports/controls/doc/images/qtquickcontrols2-popup.png create mode 100644 src/imports/controls/doc/images/qtquickcontrols2-popup.svg diff --git a/src/imports/controls/doc/images/qtquickcontrols2-popup.png b/src/imports/controls/doc/images/qtquickcontrols2-popup.png new file mode 100644 index 00000000..4514948d Binary files /dev/null and b/src/imports/controls/doc/images/qtquickcontrols2-popup.png differ diff --git a/src/imports/controls/doc/images/qtquickcontrols2-popup.svg b/src/imports/controls/doc/images/qtquickcontrols2-popup.svg new file mode 100644 index 00000000..1d78addf --- /dev/null +++ b/src/imports/controls/doc/images/qtquickcontrols2-popup.svg @@ -0,0 +1,391 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + Background + Content item + + Available height Available width Width + + Height Popup Bottom padding Top padding Right padding Left padding + diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index d343fad6..6273e4ef 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -57,13 +57,13 @@ QT_BEGIN_NAMESPACE \brief The base type of popup-like user interface controls. Popup is the base type of popup-like user interface controls. It can be - used with Window or ApplicationWindow. + used with \l Window or \l ApplicationWindow. \qml import QtQuick.Window 2.2 import QtQuick.Controls 2.0 - Window { + ApplicationWindow { id: window width: 400 height: 400 @@ -91,8 +91,79 @@ QT_BEGIN_NAMESPACE scene, it is recommended to use ApplicationWindow. ApplicationWindow also provides background dimming effects. - Popup lays out its content in a similar fashion to \l Control. For more - information, see the \l {Control Layout} section of the documentation. + Popup does not provide a layout of its own, but requires you to position + its contents, for instance by creating a \l RowLayout or a \l ColumnLayout. + + Items declared as children of a Popup are automatically parented to the + Popups's \l contentItem. Items created dynamically need to be explicitly + parented to the contentItem. + + \section1 Popup Layout + + The following diagram illustrates the layout of a typical popup: + + \image qtquickcontrols2-popup.png + + The \l implicitWidth and \l implicitHeight of a popup are typically based + on the implicit sizes of the background and the content item plus any + \l padding. These properties determine how large the popup will be when no + explicit \l width or \l height is specified. + + The \l background item fills the entire width and height of the popup, + unless an explicit size has been given for it. + + The geometry of the \l contentItem is determined by the \l padding. + + \section1 Popup Sizing + + If only a single item is used within a Popup, it will resize to fit the + implicit size of its contained item. This makes it particularly suitable + for use together with layouts. + + \code + Popup { + ColumnLayout { + anchors.fill: parent + CheckBox { text: qsTr("E-mail") } + CheckBox { text: qsTr("Calendar") } + CheckBox { text: qsTr("Contacts") } + } + } + \endcode + + Sometimes there might be two items within the popup: + + \code + Popup { + SwipeView { + // ... + } + PageIndicator { + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + } + } + \endcode + + In this case, Popup cannot calculate a sensible implicit size. Since we're + anchoring the \l PageIndicator over the \l SwipeView, we can simply set the + content size to the view's implicit size: + + \code + Popup { + contentWidth: view.implicitWidth + contentHeight: view.implicitHeight + + SwipeView { + id: view + // ... + } + PageIndicator { + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + } + } + \endcode \sa {Popup Controls}, {Customizing Popup}, ApplicationWindow */ @@ -1060,8 +1131,9 @@ void QQuickPopup::setImplicitHeight(qreal height) This property holds the content width. It is used for calculating the total implicit width of the Popup. - \note If only a single item is used within the Popup, the implicit width - of its contained item is used as the content width. + For more information, see \l {Popup Sizing}. + + \sa contentHeight */ qreal QQuickPopup::contentWidth() const { @@ -1085,8 +1157,9 @@ void QQuickPopup::setContentWidth(qreal width) This property holds the content height. It is used for calculating the total implicit height of the Popup. - \note If only a single item is used within the Popup, the implicit height - of its contained item is used as the content height. + For more information, see \l {Popup Sizing}. + + \sa contentWidth */ qreal QQuickPopup::contentHeight() const { @@ -1459,6 +1532,28 @@ void QQuickPopup::resetLocale() \qmlproperty font QtQuick.Controls::Popup::font This property holds the font currently set for the popup. + + Popup propagates explicit font properties to its children. If you change a specific + property on a popup's font, that property propagates to all of the popup's children, + overriding any system defaults for that property. + + \code + Popup { + font.family: "Courier" + + Column { + Label { + text: qsTr("This will use Courier...") + } + + Switch { + text: qsTr("... and so will this") + } + } + } + \endcode + + \sa Control::font, ApplicationWindow::font */ QFont QQuickPopup::font() const { @@ -1798,7 +1893,10 @@ void QQuickPopup::setVisible(bool visible) /*! \qmlproperty real QtQuick.Controls::Popup::opacity - This property holds the opacity of the popup. The default value is \c 1.0. + This property holds the opacity of the popup. Opacity is specified as a number between + \c 0.0 (fully transparent) and \c 1.0 (fully opaque). The default value is \c 1.0. + + \sa visible */ qreal QQuickPopup::opacity() const { @@ -1816,6 +1914,10 @@ void QQuickPopup::setOpacity(qreal opacity) \qmlproperty real QtQuick.Controls::Popup::scale This property holds the scale factor of the popup. The default value is \c 1.0. + + A scale of less than \c 1.0 causes the popup to be rendered at a smaller size, + and a scale greater than \c 1.0 renders the popup at a larger size. A negative + scale causes the popup to be mirrored when rendered. */ qreal QQuickPopup::scale() const { @@ -1891,8 +1993,20 @@ void QQuickPopup::setTransformOrigin(TransformOrigin origin) /*! \qmlproperty Transition QtQuick.Controls::Popup::enter - This property holds the transition that is applied to the content item + This property holds the transition that is applied to the popup item when the popup is opened and enters the screen. + + The following example animates the opacity of the popup when it enters + the screen: + \code + Popup { + enter: Transition { + NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 } + } + } + \endcode + + \sa exit */ QQuickTransition *QQuickPopup::enter() const { @@ -1912,8 +2026,20 @@ void QQuickPopup::setEnter(QQuickTransition *transition) /*! \qmlproperty Transition QtQuick.Controls::Popup::exit - This property holds the transition that is applied to the content item + This property holds the transition that is applied to the popup item when the popup is closed and exits the screen. + + The following example animates the opacity of the popup when it exits + the screen: + \code + Popup { + exit: Transition { + NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 } + } + } + \endcode + + \sa enter */ QQuickTransition *QQuickPopup::exit() const { -- cgit v1.2.3 From b31b4094e1728d839fef30f5128c81451ea75e4a Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 21 Oct 2016 22:10:39 +0200 Subject: QQuickPopup: use QShortcutMap to grab Back & Escape keys This makes CloseOnEscape play well together with QML Shortcut, as illustrated by the Gallery example. For example, navigate to any control page, open the options menu, and hit escape twice. First, the options menu closes, and then the stackview navigates back. Another nice example is to open the style combobox in the settings dialog, while being navigated to one of the control pages, and hit escape three times. First, the combobox closes, then the settings dialog closes, and finally, the stackview navigates back. NOTE: tst_combobox had to be updated, because it was assuming that the popup is closed when escape is released. Now that the system is based on shortcut overrides, it gets closed on press instead. Task-number: QTBUG-56562 Change-Id: I8b8901bcba7deebd82b181af42f335d95a7cb469 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickpopup.cpp | 73 ++++++++++++++++++++++++--- src/quicktemplates2/qquickpopup_p_p.h | 4 ++ src/quicktemplates2/qquickshortcutcontext.cpp | 10 ++-- tests/auto/controls/data/tst_combobox.qml | 1 - 4 files changed, 76 insertions(+), 12 deletions(-) diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index 6273e4ef..518117fa 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -37,9 +37,12 @@ #include "qquickpopup_p.h" #include "qquickpopup_p_p.h" #include "qquickapplicationwindow_p.h" +#include "qquickshortcutcontext_p_p.h" #include "qquickoverlay_p_p.h" #include "qquickcontrol_p_p.h" +#include +#include #include #include #include @@ -433,10 +436,15 @@ public: void resolveFont() override; + int backId; + int escapeId; QQuickPopup *popup; }; -QQuickPopupItemPrivate::QQuickPopupItemPrivate(QQuickPopup *popup) : popup(popup) +QQuickPopupItemPrivate::QQuickPopupItemPrivate(QQuickPopup *popup) + : backId(0), + escapeId(0), + popup(popup) { isTabFence = true; } @@ -479,6 +487,47 @@ void QQuickPopupItem::updatePolish() return QQuickPopupPrivate::get(d->popup)->reposition(); } +void QQuickPopupItem::grabShortcut() +{ +#ifndef QT_NO_SHORTCUT + Q_D(QQuickPopupItem); + QGuiApplicationPrivate *pApp = QGuiApplicationPrivate::instance(); + if (!d->backId) + d->backId = pApp->shortcutMap.addShortcut(this, Qt::Key_Back, Qt::WindowShortcut, QQuickShortcutContext::matcher); + if (!d->escapeId) + d->escapeId = pApp->shortcutMap.addShortcut(this, Qt::Key_Escape, Qt::WindowShortcut, QQuickShortcutContext::matcher); +#endif // QT_NO_SHORTCUT +} + +void QQuickPopupItem::ungrabShortcut() +{ +#ifndef QT_NO_SHORTCUT + Q_D(QQuickPopupItem); + QGuiApplicationPrivate *pApp = QGuiApplicationPrivate::instance(); + if (d->backId) { + pApp->shortcutMap.removeShortcut(d->backId, this); + d->backId = 0; + } + if (d->escapeId) { + pApp->shortcutMap.removeShortcut(d->escapeId, this); + d->escapeId = 0; + } +#endif // QT_NO_SHORTCUT +} + +bool QQuickPopupItem::event(QEvent *event) +{ + Q_D(QQuickPopupItem); + if (event->type() == QEvent::Shortcut) { + QShortcutEvent *se = static_cast(event); + if (se->shortcutId() == d->escapeId || se->shortcutId() == d->backId) { + d->popup->close(); + return true; + } + } + return QQuickItem::event(event); +} + bool QQuickPopupItem::childMouseEventFilter(QQuickItem *child, QEvent *event) { Q_D(QQuickPopupItem); @@ -912,6 +961,7 @@ QQuickPopup::~QQuickPopup() { Q_D(QQuickPopup); setParentItem(nullptr); + d->popupItem->ungrabShortcut(); delete d->popupItem; } @@ -1963,6 +2013,12 @@ void QQuickPopup::setClosePolicy(ClosePolicy policy) if (d->closePolicy == policy) return; d->closePolicy = policy; + if (isVisible()) { + if (policy & QQuickPopup::CloseOnEscape) + d->popupItem->grabShortcut(); + else + d->popupItem->ungrabShortcut(); + } emit closePolicyChanged(); } @@ -2131,12 +2187,6 @@ void QQuickPopup::keyPressEvent(QKeyEvent *event) if (hasActiveFocus() && (event->key() == Qt::Key_Tab || event->key() == Qt::Key_Backtab)) QQuickItemPrivate::focusNextPrev(d->popupItem, event->key() == Qt::Key_Tab); - - if (event->key() != Qt::Key_Escape && event->key() != Qt::Key_Back) - return; - - if (d->closePolicy.testFlag(CloseOnEscape)) - close(); } void QQuickPopup::keyReleaseEvent(QKeyEvent *event) @@ -2233,7 +2283,7 @@ void QQuickPopup::geometryChanged(const QRectF &newGeometry, const QRectF &oldGe void QQuickPopup::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data) { - Q_UNUSED(data); + Q_D(QQuickPopup); switch (change) { case QQuickItem::ItemActiveFocusHasChanged: @@ -2242,6 +2292,13 @@ void QQuickPopup::itemChange(QQuickItem::ItemChange change, const QQuickItem::It case QQuickItem::ItemOpacityHasChanged: emit opacityChanged(); break; + case QQuickItem::ItemVisibleHasChanged: + if (isComponentComplete() && d->closePolicy & CloseOnEscape) { + if (data.boolValue) + d->popupItem->grabShortcut(); + else + d->popupItem->ungrabShortcut(); + } default: break; } diff --git a/src/quicktemplates2/qquickpopup_p_p.h b/src/quicktemplates2/qquickpopup_p_p.h index d2f16e11..96ce2ca0 100644 --- a/src/quicktemplates2/qquickpopup_p_p.h +++ b/src/quicktemplates2/qquickpopup_p_p.h @@ -86,9 +86,13 @@ class QQuickPopupItem : public QQuickControl public: explicit QQuickPopupItem(QQuickPopup *popup); + void grabShortcut(); + void ungrabShortcut(); + protected: void updatePolish() override; + bool event(QEvent *event) override; bool childMouseEventFilter(QQuickItem *child, QEvent *event) override; void focusInEvent(QFocusEvent *event) override; void focusOutEvent(QFocusEvent *event) override; diff --git a/src/quicktemplates2/qquickshortcutcontext.cpp b/src/quicktemplates2/qquickshortcutcontext.cpp index 2a3cb68a..04aa4f4d 100644 --- a/src/quicktemplates2/qquickshortcutcontext.cpp +++ b/src/quicktemplates2/qquickshortcutcontext.cpp @@ -50,8 +50,8 @@ static bool isBlockedByPopup(QQuickItem *item) QQuickOverlay *overlay = QQuickOverlay::overlay(item->window()); const auto popups = QQuickOverlayPrivate::get(overlay)->stackingOrderPopups(); for (QQuickPopup *popup : popups) { - if (popup->isModal()) - return !popup->popupItem()->isAncestorOf(item); + if (popup->isModal() || popup->closePolicy() & QQuickPopup::CloseOnEscape) + return item != popup->popupItem() && !popup->popupItem()->isAncestorOf(item); } return false; @@ -67,8 +67,12 @@ bool QQuickShortcutContext::matcher(QObject *obj, Qt::ShortcutContext context) while (obj && !obj->isWindowType()) { obj = obj->parent(); item = qobject_cast(obj); - if (item) + if (item) { obj = item->window(); + } else if (QQuickPopup *popup = qobject_cast(obj)) { + obj = popup->window(); + item = popup->popupItem(); + } } return obj && obj == QGuiApplication::focusWindow() && !isBlockedByPopup(item); default: diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml index 97ba7ea4..7d7e519f 100644 --- a/tests/auto/controls/data/tst_combobox.qml +++ b/tests/auto/controls/data/tst_combobox.qml @@ -467,7 +467,6 @@ TestCase { // hide popup keyPress(data.key2) compare(control.pressed, data.hidePress) - compare(control.popup.visible, data.showPopup) keyRelease(data.key2) compare(control.pressed, false) tryCompare(control.popup, "visible", !data.hidePopup) -- cgit v1.2.3 From da150839d20a9bfae82b220b3dfe7229d1421e12 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 1 Nov 2016 11:30:16 +0100 Subject: Doc: fix review findings for ApplicationWindow Change-Id: I6a164e1a306db960c1ac3012b72106425a380e75 Task-number: QTBUG-55904 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickapplicationwindow.cpp | 65 ++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 2 deletions(-) diff --git a/src/quicktemplates2/qquickapplicationwindow.cpp b/src/quicktemplates2/qquickapplicationwindow.cpp index d03633a3..f70a6fc1 100644 --- a/src/quicktemplates2/qquickapplicationwindow.cpp +++ b/src/quicktemplates2/qquickapplicationwindow.cpp @@ -89,10 +89,45 @@ QT_BEGIN_NAMESPACE ApplicationWindow supports popups via its \l overlay property, which ensures that popups are displayed above other content and that the - background is dimmed when a modal popup is visible. + background is dimmed when a \l {Popup::}{modal} or \l {Popup::dim} + {dimmed} popup is visible. \note By default, an ApplicationWindow is not visible. + \section2 Attached ApplicationWindow Properties + + Due to how \l {Scope and Naming Resolution} works in QML, it is possible + to reference the \c id of the application root element anywhere in its + child QML objects. Even though this approach is fine for many applications + and use cases, for a generic QML component it may not be acceptable as it + creates a dependency to the surrounding environment. + + ApplicationWindow provides a set of attached properties that can be used + to access the window and its building blocks from places where no direct + access to the window is available, without creating a dependency to a + certain window \c id. A QML component that uses the ApplicationWindow + attached properties works in any window regardless of its \c id. The + following example uses the attached \c overlay property to position the + popup to the center of the window, despite the position of the button + that opens the popup. + + \code + Button { + onClicked: popup.open() + + Popup { + id: popup + + parent: ApplicationWindow.overlay + + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + width: 100 + height: 100 + } + } + \endcode + \sa {Customizing ApplicationWindow}, Page, {Container Controls} */ @@ -314,6 +349,14 @@ void QQuickApplicationWindow::setBackground(QQuickItem *background) This property holds the window header item. The header item is positioned to the top, and resized to the width of the window. The default value is \c null. + \code + ApplicationWindow { + header: TabBar { + // ... + } + } + \endcode + \note Assigning a ToolBar or TabBar as a window header sets the respective \l ToolBar::position or \l TabBar::position property automatically to \c Header. @@ -360,6 +403,14 @@ void QQuickApplicationWindow::setHeader(QQuickItem *header) This property holds the window footer item. The footer item is positioned to the bottom, and resized to the width of the window. The default value is \c null. + \code + ApplicationWindow { + footer: ToolBar { + // ... + } + } + \endcode + \note Assigning a ToolBar or TabBar as a window footer sets the respective \l ToolBar::position or \l TabBar::position property automatically to \c Footer. @@ -719,6 +770,8 @@ QQuickApplicationWindowAttached::QQuickApplicationWindowAttached(QObject *parent This attached property holds the application window. The property can be attached to any item. The value is \c null if the item is not in an ApplicationWindow. + + \sa {Attached ApplicationWindow Properties} */ QQuickApplicationWindow *QQuickApplicationWindowAttached::window() const { @@ -732,6 +785,8 @@ QQuickApplicationWindow *QQuickApplicationWindowAttached::window() const This attached property holds the window content item. The property can be attached to any item. The value is \c null if the item is not in an ApplicationWindow. + + \sa {Attached ApplicationWindow Properties} */ QQuickItem *QQuickApplicationWindowAttached::contentItem() const { @@ -750,7 +805,7 @@ QQuickItem *QQuickApplicationWindowAttached::contentItem() const The value is \c null if the item is not in an ApplicationWindow, or the window has no active focus. - \sa Window::activeFocusItem + \sa Window::activeFocusItem, {Attached ApplicationWindow Properties} */ QQuickItem *QQuickApplicationWindowAttached::activeFocusControl() const { @@ -767,6 +822,8 @@ QQuickItem *QQuickApplicationWindowAttached::activeFocusControl() const This attached property holds the window header item. The property can be attached to any item. The value is \c null if the item is not in an ApplicationWindow, or the window has no header item. + + \sa {Attached ApplicationWindow Properties} */ QQuickItem *QQuickApplicationWindowAttached::header() const { @@ -783,6 +840,8 @@ QQuickItem *QQuickApplicationWindowAttached::header() const This attached property holds the window footer item. The property can be attached to any item. The value is \c null if the item is not in an ApplicationWindow, or the window has no footer item. + + \sa {Attached ApplicationWindow Properties} */ QQuickItem *QQuickApplicationWindowAttached::footer() const { @@ -798,6 +857,8 @@ QQuickItem *QQuickApplicationWindowAttached::footer() const This attached property holds the window overlay item. The property can be attached to any item. The value is \c null if the item is not in an ApplicationWindow. + + \sa {Attached ApplicationWindow Properties} */ QQuickOverlay *QQuickApplicationWindowAttached::overlay() const { -- cgit v1.2.3 From 154c5e32af4d59cd04ac907d3f66cb0807ff14e9 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 1 Nov 2016 12:26:22 +0100 Subject: Doc: fix review findings for ToolButton Change-Id: Id427520a390a2a8cb0bb4ac0f66fef5f96e5b39e Task-number: QTBUG-55904 Reviewed-by: Mitch Curtis --- .../doc/images/qtquickcontrols2-toolbar.png | Bin 3358 -> 1186 bytes .../screenshots/qtquickcontrols2-toolbar.qml | 27 ++++++++++++++++----- src/quicktemplates2/qquicktoolbar.cpp | 17 ++++++++----- src/quicktemplates2/qquicktoolbutton.cpp | 6 ++++- 4 files changed, 37 insertions(+), 13 deletions(-) diff --git a/src/imports/controls/doc/images/qtquickcontrols2-toolbar.png b/src/imports/controls/doc/images/qtquickcontrols2-toolbar.png index f4808ca9..1fe353cc 100644 Binary files a/src/imports/controls/doc/images/qtquickcontrols2-toolbar.png and b/src/imports/controls/doc/images/qtquickcontrols2-toolbar.png differ diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml index fd6754f8..246f3ae5 100644 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml +++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -29,19 +29,34 @@ import QtQuick 2.0 import QtQuick.Layouts 1.0 import QtQuick.Controls 2.0 +Item { + width: children[0].implicitWidth * 2 + height: children[0].implicitHeight + Binding { + target: children[0] + property: "width" + value: width + } //! [1] ToolBar { RowLayout { anchors.fill: parent ToolButton { - text: qsTr("\u25C0 Qt") + text: qsTr("‹") onClicked: stack.pop() } - Item { Layout.fillWidth: true } - Switch { - checked: true - text: qsTr("Notifications") + Label { + text: "Title" + elide: Label.ElideRight + horizontalAlignment: Qt.AlignHCenter + verticalAlignment: Qt.AlignVCenter + Layout.fillWidth: true + } + ToolButton { + text: qsTr("⋮") + onClicked: menu.open() } } } //! [1] +} diff --git a/src/quicktemplates2/qquicktoolbar.cpp b/src/quicktemplates2/qquicktoolbar.cpp index 5a767c73..e6d705ad 100644 --- a/src/quicktemplates2/qquicktoolbar.cpp +++ b/src/quicktemplates2/qquicktoolbar.cpp @@ -69,14 +69,19 @@ QT_BEGIN_NAMESPACE RowLayout { anchors.fill: parent ToolButton { - text: qsTr("\u25C0 %1").arg(Qt.application.name) - enabled: stack.depth > 1 + text: qsTr("‹") onClicked: stack.pop() } - Item { Layout.fillWidth: true } - Switch { - checked: true - text: qsTr("Notifications") + Label { + text: "Title" + elide: Label.ElideRight + horizontalAlignment: Qt.AlignHCenter + verticalAlignment: Qt.AlignVCenter + Layout.fillWidth: true + } + ToolButton { + text: qsTr("⋮") + onClicked: menu.open() } } } diff --git a/src/quicktemplates2/qquicktoolbutton.cpp b/src/quicktemplates2/qquicktoolbutton.cpp index c1f47b97..8009ac28 100644 --- a/src/quicktemplates2/qquicktoolbutton.cpp +++ b/src/quicktemplates2/qquicktoolbutton.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-buttons - \brief A button with a layout suitable for a ToolBar. + \brief A button with a look suitable for a ToolBar. ToolButton is functionally similar to \l Button, but provides a look that is more suitable within a \l ToolBar. @@ -57,6 +57,10 @@ QT_BEGIN_NAMESPACE \snippet qtquickcontrols2-toolbar.qml 1 + ToolButton inherits its API from AbstractButton. For instance, you can set + \l {AbstractButton::text}{text}, and react to \l {AbstractButton::clicked}{clicks} + using the AbstractButton API. + \sa ToolBar, {Customizing ToolButton}, {Button Controls} */ -- cgit v1.2.3 From 6f10ef6e167f4af68439f473842da3b5ea87e4a4 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 1 Nov 2016 14:40:50 +0100 Subject: Doc: add GIF animation for Drawer Change-Id: Ib4c8b5f80e63a322c20caa837632739a3bfee3ee Task-number: QTBUG-55904 Reviewed-by: Mitch Curtis --- .../doc/images/qtquickcontrols2-drawer.gif | Bin 0 -> 55780 bytes src/quicktemplates2/qquickdrawer.cpp | 16 ++-- tests/manual/gifs/data/qtquickcontrols2-drawer.qml | 89 +++++++++++++++++++++ tests/manual/gifs/tst_gifs.cpp | 26 ++++++ 4 files changed, 121 insertions(+), 10 deletions(-) create mode 100644 src/imports/controls/doc/images/qtquickcontrols2-drawer.gif create mode 100644 tests/manual/gifs/data/qtquickcontrols2-drawer.qml diff --git a/src/imports/controls/doc/images/qtquickcontrols2-drawer.gif b/src/imports/controls/doc/images/qtquickcontrols2-drawer.gif new file mode 100644 index 00000000..736f34f6 Binary files /dev/null and b/src/imports/controls/doc/images/qtquickcontrols2-drawer.gif differ diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp index dc427bc9..d210c015 100644 --- a/src/quicktemplates2/qquickdrawer.cpp +++ b/src/quicktemplates2/qquickdrawer.cpp @@ -58,16 +58,12 @@ QT_BEGIN_NAMESPACE Drawer provides a swipe-based side panel, similar to those often used in touch interfaces to provide a central location for navigation. - \table - \row - \li \image qtquickcontrols2-drawer-wireframe.png - Drawer can be positioned at any of the four edges of the content item. \br - In this image, it is against the left edge of the window. - - \li \image qtquickcontrols2-drawer-expanded-wireframe.png - The drawer is then opened by \e "dragging" it out from the left edge \br - of the window. - \endtable + \image qtquickcontrols2-drawer.gif + + Drawer can be positioned at any of the four edges of the content item. + The drawer above is positioned against the left edge of the window. The + drawer is then opened by \e "dragging" it out from the left edge of the + window. \code import QtQuick 2.7 diff --git a/tests/manual/gifs/data/qtquickcontrols2-drawer.qml b/tests/manual/gifs/data/qtquickcontrols2-drawer.qml new file mode 100644 index 00000000..49f2cf50 --- /dev/null +++ b/tests/manual/gifs/data/qtquickcontrols2-drawer.qml @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.6 +import QtQuick.Controls 2.0 +import QtQuick.Window 2.0 + +ApplicationWindow { + id: window + width: 300 + height: 300 + visible: true + + property alias drawer: drawer + + Drawer { + id: drawer + width: window.width * 0.66 + height: window.height + rightPadding: 0 + + Rectangle { + border.width: 1 + anchors.fill: parent + + Label { + text: "Drawer" + font.pixelSize: 32 + anchors.centerIn: parent + } + } + } + + Rectangle { + border.width: 1 + anchors.fill: parent + + Label { + text: "Content" + font.pixelSize: 32 + anchors.centerIn: parent + } + } + + Rectangle { + z: 1 + color: "black" + width: 1 + height: parent.height + parent: window.overlay + } +} diff --git a/tests/manual/gifs/tst_gifs.cpp b/tests/manual/gifs/tst_gifs.cpp index be436b52..c27c522b 100644 --- a/tests/manual/gifs/tst_gifs.cpp +++ b/tests/manual/gifs/tst_gifs.cpp @@ -78,6 +78,7 @@ private slots: void comboBox(); void stackView_data(); void stackView(); + void drawer(); private: void moveSmoothly(QQuickWindow *window, const QPoint &from, const QPoint &to, int movements, @@ -911,6 +912,31 @@ void tst_Gifs::stackView() gifRecorder.waitForFinish(); } +void tst_Gifs::drawer() +{ + GifRecorder gifRecorder; + gifRecorder.setDataDirPath(dataDirPath); + gifRecorder.setOutputDir(outputDir); + gifRecorder.setRecordingDuration(4); + gifRecorder.setHighQuality(true); + gifRecorder.setQmlFileName("qtquickcontrols2-drawer.qml"); + + gifRecorder.start(); + + QQuickWindow *window = gifRecorder.window(); + QObject *drawer = window->property("drawer").value(); + qreal width = drawer->property("width").toReal(); + + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(1, 1), 100); + moveSmoothly(window, QPoint(1, 1), QPoint(width, 1), width, QEasingCurve::InOutBack, 1); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(width, 1), 30); + + QTest::qWait(1000); + QMetaObject::invokeMethod(drawer, "close"); + + gifRecorder.waitForFinish(); +} + QTEST_MAIN(tst_Gifs) #include "tst_gifs.moc" -- cgit v1.2.3 From 07ab335947b4a5cadb2fd1e440ca7db38b82ba1b Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 1 Nov 2016 15:07:51 +0100 Subject: Get rid of the remaining qdoc markers in the Default style Change-Id: Id90911cbac46d2d68284abca08dc7165ace71113 Reviewed-by: Mitch Curtis --- src/imports/controls/BusyIndicator.qml | 2 -- src/imports/controls/Button.qml | 4 ---- src/imports/controls/CheckBox.qml | 4 ---- src/imports/controls/CheckDelegate.qml | 6 ------ src/imports/controls/ComboBox.qml | 10 ---------- src/imports/controls/Dial.qml | 4 ---- src/imports/controls/Drawer.qml | 9 --------- src/imports/controls/Frame.qml | 4 ---- src/imports/controls/GroupBox.qml | 6 ------ src/imports/controls/ItemDelegate.qml | 4 ---- src/imports/controls/Menu.qml | 4 ---- src/imports/controls/MenuItem.qml | 6 ------ src/imports/controls/Page.qml | 4 ---- src/imports/controls/PageIndicator.qml | 4 ---- src/imports/controls/Pane.qml | 4 ---- src/imports/controls/ProgressBar.qml | 4 ---- src/imports/controls/RadioButton.qml | 4 ---- src/imports/controls/RadioDelegate.qml | 6 ------ src/imports/controls/RangeSlider.qml | 6 ------ src/imports/controls/ScrollBar.qml | 2 -- src/imports/controls/ScrollIndicator.qml | 2 -- src/imports/controls/Slider.qml | 4 ---- src/imports/controls/SpinBox.qml | 10 ---------- src/imports/controls/StackView.qml | 12 ------------ src/imports/controls/SwipeDelegate.qml | 4 ---- src/imports/controls/SwipeView.qml | 2 -- src/imports/controls/Switch.qml | 4 ---- src/imports/controls/SwitchDelegate.qml | 6 ------ src/imports/controls/TabBar.qml | 4 ---- src/imports/controls/TabButton.qml | 4 ---- src/imports/controls/TextField.qml | 2 -- src/imports/controls/ToolBar.qml | 4 ---- src/imports/controls/ToolButton.qml | 4 ---- src/imports/controls/ToolTip.qml | 4 ---- src/imports/controls/Tumbler.qml | 4 ---- src/imports/controls/doc/qtquickcontrols2.qdocconf | 1 - src/quicktemplates2/qquickspinbox.cpp | 11 ++++++++++- 37 files changed, 10 insertions(+), 169 deletions(-) diff --git a/src/imports/controls/BusyIndicator.qml b/src/imports/controls/BusyIndicator.qml index 44c61355..9be1f046 100644 --- a/src/imports/controls/BusyIndicator.qml +++ b/src/imports/controls/BusyIndicator.qml @@ -47,7 +47,6 @@ T.BusyIndicator { padding: 6 - //! [contentItem] contentItem: BusyRing { id: ring implicitWidth: 48 @@ -61,5 +60,4 @@ T.BusyIndicator { running: control.visible && control.running } } - //! [contentItem] } diff --git a/src/imports/controls/Button.qml b/src/imports/controls/Button.qml index cf1f6c99..1a974eed 100644 --- a/src/imports/controls/Button.qml +++ b/src/imports/controls/Button.qml @@ -50,7 +50,6 @@ T.Button { leftPadding: padding + 2 rightPadding: padding + 2 - //! [contentItem] contentItem: Text { text: control.text font: control.font @@ -60,9 +59,7 @@ T.Button { verticalAlignment: Text.AlignVCenter elide: Text.ElideRight } - //! [contentItem] - //! [background] background: Rectangle { implicitWidth: 100 implicitHeight: 40 @@ -73,5 +70,4 @@ T.Button { border.color: "#0066ff" border.width: control.visualFocus ? 2 : 0 } - //! [background] } diff --git a/src/imports/controls/CheckBox.qml b/src/imports/controls/CheckBox.qml index 52ce20ef..632097b1 100644 --- a/src/imports/controls/CheckBox.qml +++ b/src/imports/controls/CheckBox.qml @@ -52,15 +52,12 @@ T.CheckBox { padding: 6 spacing: 6 - //! [indicator] indicator: CheckIndicator { x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2 y: control.topPadding + (control.availableHeight - height) / 2 control: control } - //! [indicator] - //! [contentItem] contentItem: Text { leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0 rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0 @@ -74,5 +71,4 @@ T.CheckBox { verticalAlignment: Text.AlignVCenter opacity: enabled ? 1 : 0.3 } - //! [contentItem] } diff --git a/src/imports/controls/CheckDelegate.qml b/src/imports/controls/CheckDelegate.qml index dcef7f77..96cb48e0 100644 --- a/src/imports/controls/CheckDelegate.qml +++ b/src/imports/controls/CheckDelegate.qml @@ -52,7 +52,6 @@ T.CheckDelegate { padding: 12 spacing: 12 - //! [contentItem] contentItem: Text { leftPadding: control.mirrored ? control.indicator.width + control.spacing : 0 rightPadding: !control.mirrored ? control.indicator.width + control.spacing : 0 @@ -65,23 +64,18 @@ T.CheckDelegate { horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } - //! [contentItem] - //! [indicator] indicator: CheckIndicator { x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding y: control.topPadding + (control.availableHeight - height) / 2 control: control } - //! [indicator] - //! [background] background: Rectangle { implicitWidth: 100 implicitHeight: 40 visible: control.down || control.highlighted color: control.down ? "#bdbebf" : "#eeeeee" } - //! [background] } diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml index 791b5da6..31f2e5d9 100644 --- a/src/imports/controls/ComboBox.qml +++ b/src/imports/controls/ComboBox.qml @@ -54,16 +54,13 @@ T.ComboBox { leftPadding: padding + 6 rightPadding: padding + 6 - //! [delegate] delegate: ItemDelegate { width: control.popup.width text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal highlighted: control.highlightedIndex == index } - //! [delegate] - //! [indicator] indicator: Image { x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding y: control.topPadding + (control.availableHeight - height) / 2 @@ -72,9 +69,7 @@ T.ComboBox { sourceSize.height: height opacity: enabled ? 1 : 0.3 } - //! [indicator] - //! [contentItem] contentItem: Text { leftPadding: control.mirrored && control.indicator ? control.indicator.width + control.spacing : 0 rightPadding: !control.mirrored && control.indicator ? control.indicator.width + control.spacing : 0 @@ -87,9 +82,7 @@ T.ComboBox { elide: Text.ElideRight opacity: enabled ? 1 : 0.3 } - //! [contentItem] - //! [background] background: Rectangle { implicitWidth: 120 implicitHeight: 40 @@ -99,9 +92,7 @@ T.ComboBox { border.color: "#0066ff" border.width: control.visualFocus ? 2 : 0 } - //! [background] - //! [popup] popup: T.Popup { y: control.height - (control.visualFocus ? 0 : 1) width: control.width @@ -132,5 +123,4 @@ T.ComboBox { background: Rectangle { } } - //! [popup] } diff --git a/src/imports/controls/Dial.qml b/src/imports/controls/Dial.qml index aa138126..cd4d6ba2 100644 --- a/src/imports/controls/Dial.qml +++ b/src/imports/controls/Dial.qml @@ -45,7 +45,6 @@ T.Dial { implicitWidth: 184 implicitHeight: 184 - //! [background] background: DialRing { width: control.availableWidth height: control.availableHeight @@ -53,9 +52,7 @@ T.Dial { progress: control.position opacity: control.enabled ? 1 : 0.3 } - //! [background] - //! [handle] handle: Image { id: handleItem x: background.x + background.width / 2 - handle.width / 2 @@ -78,5 +75,4 @@ T.Dial { } ] } - //! [handle] } diff --git a/src/imports/controls/Drawer.qml b/src/imports/controls/Drawer.qml index 9791bf0c..6e9ab71f 100644 --- a/src/imports/controls/Drawer.qml +++ b/src/imports/controls/Drawer.qml @@ -53,19 +53,11 @@ T.Drawer { rightPadding: control.edge === Qt.LeftEdge bottomPadding: control.edge === Qt.TopEdge - //! [enter] enter: Transition { SmoothedAnimation { velocity: 5 } } - //! [enter] - - //! [exit] exit: Transition { SmoothedAnimation { velocity: 5 } } - //! [exit] - //! [contentItem] contentItem: Item { } - //! [contentItem] - //! [background] background: Rectangle { Rectangle { readonly property bool horizontal: control.edge === Qt.LeftEdge || control.edge === Qt.RightEdge @@ -76,5 +68,4 @@ T.Drawer { y: control.edge === Qt.TopEdge ? parent.height - 1 : 0 } } - //! [background] } diff --git a/src/imports/controls/Frame.qml b/src/imports/controls/Frame.qml index cb2ffd35..b7968cb4 100644 --- a/src/imports/controls/Frame.qml +++ b/src/imports/controls/Frame.qml @@ -48,14 +48,10 @@ T.Frame { padding: 12 - //! [contentItem] contentItem: Item { } - //! [contentItem] - //! [background] background: Rectangle { color: "transparent" border.color: "#bdbebf" } - //! [background] } diff --git a/src/imports/controls/GroupBox.qml b/src/imports/controls/GroupBox.qml index 0e9d79fc..31f4963f 100644 --- a/src/imports/controls/GroupBox.qml +++ b/src/imports/controls/GroupBox.qml @@ -52,11 +52,8 @@ T.GroupBox { padding: 12 topPadding: padding + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0) - //! [contentItem] contentItem: Item { } - //! [contentItem] - //! [label] label: Text { x: control.leftPadding width: control.availableWidth @@ -68,9 +65,7 @@ T.GroupBox { horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } - //! [label] - //! [background] background: Rectangle { y: control.topPadding - control.padding width: parent.width @@ -79,5 +74,4 @@ T.GroupBox { color: "transparent" border.color: "#bdbebf" } - //! [background] } diff --git a/src/imports/controls/ItemDelegate.qml b/src/imports/controls/ItemDelegate.qml index d884a328..519ef3bf 100644 --- a/src/imports/controls/ItemDelegate.qml +++ b/src/imports/controls/ItemDelegate.qml @@ -50,7 +50,6 @@ T.ItemDelegate { padding: 12 spacing: 12 - //! [contentItem] contentItem: Text { leftPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0 rightPadding: !control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0 @@ -63,14 +62,11 @@ T.ItemDelegate { horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } - //! [contentItem] - //! [background] background: Rectangle { implicitWidth: 100 implicitHeight: 40 visible: control.down || control.highlighted || control.visualFocus color: control.visualFocus ? (control.pressed ? "#cce0ff" : "#e5efff") : (control.down ? "#bdbebf" : "#eeeeee") } - //! [background] } diff --git a/src/imports/controls/Menu.qml b/src/imports/controls/Menu.qml index e349a89d..d9a97cee 100644 --- a/src/imports/controls/Menu.qml +++ b/src/imports/controls/Menu.qml @@ -48,7 +48,6 @@ T.Menu { margins: 0 - //! [contentItem] contentItem: ListView { implicitHeight: contentHeight model: control.contentModel @@ -60,14 +59,11 @@ T.Menu { ScrollIndicator.vertical: ScrollIndicator {} } - //! [contentItem] - //! [background] background: Rectangle { implicitWidth: 200 implicitHeight: 40 color: "#ffffff" border.color: "#353637" } - //! [background] } diff --git a/src/imports/controls/MenuItem.qml b/src/imports/controls/MenuItem.qml index ead943b0..69f00900 100644 --- a/src/imports/controls/MenuItem.qml +++ b/src/imports/controls/MenuItem.qml @@ -49,7 +49,6 @@ T.MenuItem { padding: 6 - //! [contentItem] contentItem: Text { leftPadding: control.checkable && !control.mirrored ? control.indicator.width + control.spacing : 0 rightPadding: control.checkable && control.mirrored ? control.indicator.width + control.spacing : 0 @@ -62,9 +61,7 @@ T.MenuItem { horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } - //! [contentItem] - //! [indicator] indicator: Image { x: control.mirrored ? control.width - width - control.rightPadding : control.leftPadding y: control.topPadding + (control.availableHeight - height) / 2 @@ -72,9 +69,7 @@ T.MenuItem { visible: control.checked source: control.checkable ? "qrc:/qt-project.org/imports/QtQuick/Controls.2/images/check.png" : "" } - //! [indicator] - //! [background] background: Item { implicitWidth: 200 implicitHeight: 40 @@ -87,5 +82,4 @@ T.MenuItem { color: control.visualFocus || control.down ? "#eeeeee" : "transparent" } } - //! [background] } diff --git a/src/imports/controls/Page.qml b/src/imports/controls/Page.qml index 3cbb1569..4ed7efb1 100644 --- a/src/imports/controls/Page.qml +++ b/src/imports/controls/Page.qml @@ -40,13 +40,9 @@ import QtQuick.Templates 2.0 as T T.Page { id: control - //! [contentItem] contentItem: Item { } - //! [contentItem] - //! [background] background: Rectangle { color: "#ffffff" } - //! [background] } diff --git a/src/imports/controls/PageIndicator.qml b/src/imports/controls/PageIndicator.qml index 5b61acd5..933bc839 100644 --- a/src/imports/controls/PageIndicator.qml +++ b/src/imports/controls/PageIndicator.qml @@ -48,7 +48,6 @@ T.PageIndicator { padding: 6 spacing: 6 - //! [delegate] delegate: Rectangle { implicitWidth: 8 implicitHeight: 8 @@ -59,9 +58,7 @@ T.PageIndicator { opacity: index === currentIndex ? 0.95 : pressed ? 0.7 : 0.45 Behavior on opacity { OpacityAnimator { duration: 100 } } } - //! [delegate] - //! [contentItem] contentItem: Row { spacing: control.spacing @@ -70,5 +67,4 @@ T.PageIndicator { delegate: control.delegate } } - //! [contentItem] } diff --git a/src/imports/controls/Pane.qml b/src/imports/controls/Pane.qml index eb79129c..feb8eb58 100644 --- a/src/imports/controls/Pane.qml +++ b/src/imports/controls/Pane.qml @@ -48,13 +48,9 @@ T.Pane { padding: 12 - //! [contentItem] contentItem: Item { } - //! [contentItem] - //! [background] background: Rectangle { color: "#ffffff" } - //! [background] } diff --git a/src/imports/controls/ProgressBar.qml b/src/imports/controls/ProgressBar.qml index fb312b18..45e990ee 100644 --- a/src/imports/controls/ProgressBar.qml +++ b/src/imports/controls/ProgressBar.qml @@ -47,7 +47,6 @@ T.ProgressBar { implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding) - //! [contentItem] contentItem: ProgressStrip { id: strip implicitHeight: 6 @@ -61,9 +60,7 @@ T.ProgressBar { running: control.visible && control.indeterminate } } - //! [contentItem] - //! [background] background: Rectangle { implicitWidth: 200 implicitHeight: 6 @@ -74,5 +71,4 @@ T.ProgressBar { color: "#e4e4e4" } - //! [background] } diff --git a/src/imports/controls/RadioButton.qml b/src/imports/controls/RadioButton.qml index a1a5d1a1..1100273a 100644 --- a/src/imports/controls/RadioButton.qml +++ b/src/imports/controls/RadioButton.qml @@ -52,15 +52,12 @@ T.RadioButton { padding: 6 spacing: 6 - //! [indicator] indicator: RadioIndicator { x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2 y: control.topPadding + (control.availableHeight - height) / 2 control: control } - //! [indicator] - //! [contentItem] contentItem: Text { leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0 rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0 @@ -74,5 +71,4 @@ T.RadioButton { verticalAlignment: Text.AlignVCenter opacity: enabled ? 1 : 0.3 } - //! [contentItem] } diff --git a/src/imports/controls/RadioDelegate.qml b/src/imports/controls/RadioDelegate.qml index d745054a..620417a8 100644 --- a/src/imports/controls/RadioDelegate.qml +++ b/src/imports/controls/RadioDelegate.qml @@ -52,7 +52,6 @@ T.RadioDelegate { padding: 12 spacing: 12 - //! [contentItem] contentItem: Text { leftPadding: control.mirrored ? control.indicator.width + control.spacing : 0 rightPadding: !control.mirrored ? control.indicator.width + control.spacing : 0 @@ -65,23 +64,18 @@ T.RadioDelegate { horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } - //! [contentItem] - //! [indicator] indicator: RadioIndicator { x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding y: control.topPadding + (control.availableHeight - height) / 2 control: control } - //! [indicator] - //! [background] background: Rectangle { implicitWidth: 100 implicitHeight: 40 visible: control.down || control.highlighted color: control.down ? "#bdbebf" : "#eeeeee" } - //! [background] } diff --git a/src/imports/controls/RangeSlider.qml b/src/imports/controls/RangeSlider.qml index dae3ffe7..181550a4 100644 --- a/src/imports/controls/RangeSlider.qml +++ b/src/imports/controls/RangeSlider.qml @@ -49,7 +49,6 @@ T.RangeSlider { padding: 6 - //! [firstHandle] first.handle: Rectangle { x: control.leftPadding + (horizontal ? control.first.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2) y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.first.visualPosition * (control.availableHeight - height)) @@ -62,9 +61,7 @@ T.RangeSlider { readonly property bool horizontal: control.orientation === Qt.Horizontal } - //! [firstHandle] - //! [secondHandle] second.handle: Rectangle { x: control.leftPadding + (horizontal ? control.second.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2) y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.second.visualPosition * (control.availableHeight - height)) @@ -77,9 +74,7 @@ T.RangeSlider { readonly property bool horizontal: control.orientation === Qt.Horizontal } - //! [secondHandle] - //! [background] background: Rectangle { x: control.leftPadding + (horizontal ? 0 : (control.availableWidth - width) / 2) y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : 0) @@ -93,5 +88,4 @@ T.RangeSlider { readonly property bool horizontal: control.orientation === Qt.Horizontal } - //! [background] } diff --git a/src/imports/controls/ScrollBar.qml b/src/imports/controls/ScrollBar.qml index 8ccbc328..c77463aa 100644 --- a/src/imports/controls/ScrollBar.qml +++ b/src/imports/controls/ScrollBar.qml @@ -47,7 +47,6 @@ T.ScrollBar { padding: 2 - //! [contentItem] contentItem: Rectangle { id: handle @@ -73,5 +72,4 @@ T.ScrollBar { } } } - //! [contentItem] } diff --git a/src/imports/controls/ScrollIndicator.qml b/src/imports/controls/ScrollIndicator.qml index cd7b53fd..c129e5b8 100644 --- a/src/imports/controls/ScrollIndicator.qml +++ b/src/imports/controls/ScrollIndicator.qml @@ -47,7 +47,6 @@ T.ScrollIndicator { padding: 2 - //! [contentItem] contentItem: Rectangle { id: indicator @@ -74,5 +73,4 @@ T.ScrollIndicator { } ] } - //! [contentItem] } diff --git a/src/imports/controls/Slider.qml b/src/imports/controls/Slider.qml index 31f4a989..5e4dc699 100644 --- a/src/imports/controls/Slider.qml +++ b/src/imports/controls/Slider.qml @@ -47,7 +47,6 @@ T.Slider { padding: 6 - //! [handle] handle: Rectangle { x: control.leftPadding + (horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2) y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height)) @@ -60,9 +59,7 @@ T.Slider { readonly property bool horizontal: control.orientation === Qt.Horizontal } - //! [handle] - //! [background] background: Rectangle { x: control.leftPadding + (horizontal ? 0 : (control.availableWidth - width) / 2) y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : 0) @@ -76,5 +73,4 @@ T.Slider { readonly property bool horizontal: control.orientation === Qt.Horizontal } - //! [background] } diff --git a/src/imports/controls/SpinBox.qml b/src/imports/controls/SpinBox.qml index de1228d1..dee368e2 100644 --- a/src/imports/controls/SpinBox.qml +++ b/src/imports/controls/SpinBox.qml @@ -54,15 +54,12 @@ T.SpinBox { leftPadding: padding + (control.mirrored ? (up.indicator ? up.indicator.width : 0) : (down.indicator ? down.indicator.width : 0)) rightPadding: padding + (control.mirrored ? (down.indicator ? down.indicator.width : 0) : (up.indicator ? up.indicator.width : 0)) - //! [validator] validator: IntValidator { locale: control.locale.name bottom: Math.min(control.from, control.to) top: Math.max(control.from, control.to) } - //! [validator] - //! [contentItem] contentItem: TextInput { z: 2 text: control.textFromValue(control.value, control.locale) @@ -90,9 +87,7 @@ T.SpinBox { border.width: 2 } } - //! [contentItem] - //! [up.indicator] up.indicator: Rectangle { x: control.mirrored ? 0 : parent.width - width height: parent.height @@ -115,9 +110,7 @@ T.SpinBox { color: enabled ? "#353637" : "#bdbebf" } } - //! [up.indicator] - //! [down.indicator] down.indicator: Rectangle { x: control.mirrored ? parent.width - width : 0 height: parent.height @@ -133,12 +126,9 @@ T.SpinBox { color: enabled ? "#353637" : "#bdbebf" } } - //! [down.indicator] - //! [background] background: Rectangle { implicitWidth: 140 border.color: "#e0e0e0" } - //! [background] } diff --git a/src/imports/controls/StackView.qml b/src/imports/controls/StackView.qml index aa95c6a7..f70ecf97 100644 --- a/src/imports/controls/StackView.qml +++ b/src/imports/controls/StackView.qml @@ -41,39 +41,27 @@ import QtQuick.Templates 2.0 as T T.StackView { id: control - //! [popEnter] popEnter: Transition { XAnimator { from: (control.mirrored ? -1 : 1) * -control.width; to: 0; duration: 400; easing.type: Easing.OutCubic } } - //! [popEnter] - //! [popExit] popExit: Transition { XAnimator { from: 0; to: (control.mirrored ? -1 : 1) * control.width; duration: 400; easing.type: Easing.OutCubic } } - //! [popExit] - //! [pushEnter] pushEnter: Transition { XAnimator { from: (control.mirrored ? -1 : 1) * control.width; to: 0; duration: 400; easing.type: Easing.OutCubic } } - //! [pushEnter] - //! [pushExit] pushExit: Transition { XAnimator { from: 0; to: (control.mirrored ? -1 : 1) * -control.width; duration: 400; easing.type: Easing.OutCubic } } - //! [pushExit] - //! [replaceEnter] replaceEnter: Transition { XAnimator { from: (control.mirrored ? -1 : 1) * control.width; to: 0; duration: 400; easing.type: Easing.OutCubic } } - //! [replaceEnter] - //! [replaceExit] replaceExit: Transition { XAnimator { from: 0; to: (control.mirrored ? -1 : 1) * -control.width; duration: 400; easing.type: Easing.OutCubic } } - //! [replaceExit] } diff --git a/src/imports/controls/SwipeDelegate.qml b/src/imports/controls/SwipeDelegate.qml index 7ffd5a29..6c84dae0 100644 --- a/src/imports/controls/SwipeDelegate.qml +++ b/src/imports/controls/SwipeDelegate.qml @@ -50,7 +50,6 @@ T.SwipeDelegate { padding: 12 spacing: 12 - //! [contentItem] contentItem: Text { leftPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0 rightPadding: !control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0 @@ -71,9 +70,7 @@ T.SwipeDelegate { } } } - //! [contentItem] - //! [background] background: Rectangle { color: control.visualFocus ? (control.down ? "#cce0ff" : "#e5efff") : (control.down ? "#bdbebf" : "#ffffff") @@ -85,5 +82,4 @@ T.SwipeDelegate { } } } - //! [background] } diff --git a/src/imports/controls/SwipeView.qml b/src/imports/controls/SwipeView.qml index 71676f12..48147d86 100644 --- a/src/imports/controls/SwipeView.qml +++ b/src/imports/controls/SwipeView.qml @@ -48,7 +48,6 @@ T.SwipeView { Accessible.role: Accessible.PageTabList - //! [contentItem] contentItem: ListView { model: control.contentModel currentIndex: control.currentIndex @@ -63,5 +62,4 @@ T.SwipeView { preferredHighlightEnd: 0 highlightMoveDuration: 250 } - //! [contentItem] } diff --git a/src/imports/controls/Switch.qml b/src/imports/controls/Switch.qml index 0810626f..b4717d05 100644 --- a/src/imports/controls/Switch.qml +++ b/src/imports/controls/Switch.qml @@ -52,15 +52,12 @@ T.Switch { padding: 6 spacing: 6 - //! [indicator] indicator: SwitchIndicator { x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2 y: control.topPadding + (control.availableHeight - height) / 2 control: control } - //! [indicator] - //! [contentItem] contentItem: Text { leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0 rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0 @@ -73,5 +70,4 @@ T.Switch { horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } - //! [contentItem] } diff --git a/src/imports/controls/SwitchDelegate.qml b/src/imports/controls/SwitchDelegate.qml index 430fc8ec..f5383628 100644 --- a/src/imports/controls/SwitchDelegate.qml +++ b/src/imports/controls/SwitchDelegate.qml @@ -52,15 +52,12 @@ T.SwitchDelegate { padding: 12 spacing: 12 - //! [indicator] indicator: SwitchIndicator { x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2 y: control.topPadding + (control.availableHeight - height) / 2 control: control } - //! [indicator] - //! [contentItem] contentItem: Text { leftPadding: control.indicator && !control.mirrored ? 0 : control.indicator.width + control.spacing rightPadding: control.indicator && control.mirrored ? 0 : control.indicator.width + control.spacing @@ -73,14 +70,11 @@ T.SwitchDelegate { horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } - //! [contentItem] - //! [background] background: Rectangle { implicitWidth: 100 implicitHeight: 40 visible: control.down || control.highlighted color: control.down ? "#bdbebf" : "#eeeeee" } - //! [background] } diff --git a/src/imports/controls/TabBar.qml b/src/imports/controls/TabBar.qml index 6a575167..22b5329e 100644 --- a/src/imports/controls/TabBar.qml +++ b/src/imports/controls/TabBar.qml @@ -47,7 +47,6 @@ T.TabBar { spacing: 1 - //! [contentItem] contentItem: ListView { implicitWidth: contentWidth implicitHeight: 40 @@ -66,9 +65,6 @@ T.TabBar { preferredHighlightBegin: 40 preferredHighlightEnd: width - 40 } - //! [contentItem] - //! [background] background: Rectangle { } - //! [background] } diff --git a/src/imports/controls/TabButton.qml b/src/imports/controls/TabButton.qml index 56b57602..2c5b2708 100644 --- a/src/imports/controls/TabButton.qml +++ b/src/imports/controls/TabButton.qml @@ -48,7 +48,6 @@ T.TabButton { padding: 6 - //! [contentItem] contentItem: Text { text: control.text font: control.font @@ -58,12 +57,9 @@ T.TabButton { horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } - //! [contentItem] - //! [background] background: Rectangle { implicitHeight: 40 color: control.down ? (control.checked ? "#e4e4e4" : "#585a5c") : (control.checked ? "transparent" : "#353637") } - //! [background] } diff --git a/src/imports/controls/TextField.qml b/src/imports/controls/TextField.qml index 35703940..fc07e7bb 100644 --- a/src/imports/controls/TextField.qml +++ b/src/imports/controls/TextField.qml @@ -72,7 +72,6 @@ T.TextField { elide: Text.ElideRight } - //! [background] background: Rectangle { implicitWidth: 200 implicitHeight: 40 @@ -80,5 +79,4 @@ T.TextField { color: control.enabled ? "#ffffff" : "#353637" border.color: control.activeFocus ? "#0066ff" : (control.enabled ? "#bdbebf" : "transparent") } - //! [background] } diff --git a/src/imports/controls/ToolBar.qml b/src/imports/controls/ToolBar.qml index a787df61..02b6c6f3 100644 --- a/src/imports/controls/ToolBar.qml +++ b/src/imports/controls/ToolBar.qml @@ -46,14 +46,10 @@ T.ToolBar { contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) - //! [contentItem] contentItem: Item { } - //! [contentItem] - //! [background] background: Rectangle { implicitHeight: 40 color: "#eeeeee" } - //! [background] } diff --git a/src/imports/controls/ToolButton.qml b/src/imports/controls/ToolButton.qml index 2887d6b4..1fda5ba3 100644 --- a/src/imports/controls/ToolButton.qml +++ b/src/imports/controls/ToolButton.qml @@ -48,7 +48,6 @@ T.ToolButton { padding: 6 - //! [contentItem] contentItem: Text { text: control.text font: control.font @@ -57,9 +56,7 @@ T.ToolButton { horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } - //! [contentItem] - //! [background] background: Rectangle { implicitWidth: 40 implicitHeight: 40 @@ -68,5 +65,4 @@ T.ToolButton { opacity: control.down ? 1.0 : control.enabled && (control.checked || control.highlighted) ? 0.5 : 0 visible: control.down || (control.enabled && (control.checked || control.highlighted)) } - //! [background] } diff --git a/src/imports/controls/ToolTip.qml b/src/imports/controls/ToolTip.qml index 876e2274..322757c7 100644 --- a/src/imports/controls/ToolTip.qml +++ b/src/imports/controls/ToolTip.qml @@ -54,17 +54,13 @@ T.ToolTip { closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent - //! [contentItem] contentItem: Text { text: control.text font: control.font // TODO: wrapMode: Label.Wrap } - //! [contentItem] - //! [background] background: Rectangle { border.color: "#353637" } - //! [background] } diff --git a/src/imports/controls/Tumbler.qml b/src/imports/controls/Tumbler.qml index 13bc0859..571d8089 100644 --- a/src/imports/controls/Tumbler.qml +++ b/src/imports/controls/Tumbler.qml @@ -43,7 +43,6 @@ T.Tumbler { implicitWidth: 60 implicitHeight: 200 - //! [delegate] delegate: Text { id: label text: modelData @@ -53,9 +52,7 @@ T.Tumbler { horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } - //! [delegate] - //! [contentItem] contentItem: PathView { id: pathView model: control.model @@ -77,5 +74,4 @@ T.Tumbler { property real delegateHeight: control.availableHeight / control.visibleItemCount } - //! [contentItem] } diff --git a/src/imports/controls/doc/qtquickcontrols2.qdocconf b/src/imports/controls/doc/qtquickcontrols2.qdocconf index e83e418e..a9a48343 100644 --- a/src/imports/controls/doc/qtquickcontrols2.qdocconf +++ b/src/imports/controls/doc/qtquickcontrols2.qdocconf @@ -35,7 +35,6 @@ depends = qtcore qtgui qtdoc qtqml qtquick qtquickdialogs qtquickcontrols qtquic # Note: paths passed to \example command must contain the parent directory, e.g. # \example controls/tabs exampledirs += ../../../../examples/quickcontrols2 \ - ../ \ ../../../quicktemplates2 \ ../../calendar \ ../../../../tests/auto/controls/data \ diff --git a/src/quicktemplates2/qquickspinbox.cpp b/src/quicktemplates2/qquickspinbox.cpp index 2939a0ea..466f1b89 100644 --- a/src/quicktemplates2/qquickspinbox.cpp +++ b/src/quicktemplates2/qquickspinbox.cpp @@ -420,7 +420,16 @@ void QQuickSpinBox::setEditable(bool editable) This property holds the input text validator for editable spinboxes. By default, SpinBox uses \l IntValidator to accept input of integer numbers. - \snippet SpinBox.qml validator + \code + SpinBox { + id: control + validator: IntValidator { + locale: control.locale.name + bottom: Math.min(control.from, control.to) + top: Math.max(control.from, control.to) + } + } + \endcode \sa editable, textFromValue, valueFromText, {Control::locale}{locale} */ -- cgit v1.2.3 From c7fdb444a4a9f3cbcf4bbfe8d0deaeb7388e7f98 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 1 Nov 2016 15:53:52 +0100 Subject: Doc: add GIF to SwipeView detailed description The wireframe is still used on the "Navigation Controls" page. Change-Id: I8e8c2bf0f5d46179c115d548efda2ea114a4431e Task-number: QTBUG-55904 Reviewed-by: Mitch Curtis --- .../doc/images/qtquickcontrols2-swipeview.gif | Bin 0 -> 35983 bytes src/quicktemplates2/qquickswipeview.cpp | 2 +- .../gifs/data/qtquickcontrols2-swipeview.qml | 89 +++++++++++++++++++++ tests/manual/gifs/tst_gifs.cpp | 26 ++++++ 4 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 src/imports/controls/doc/images/qtquickcontrols2-swipeview.gif create mode 100644 tests/manual/gifs/data/qtquickcontrols2-swipeview.qml diff --git a/src/imports/controls/doc/images/qtquickcontrols2-swipeview.gif b/src/imports/controls/doc/images/qtquickcontrols2-swipeview.gif new file mode 100644 index 00000000..4af26c10 Binary files /dev/null and b/src/imports/controls/doc/images/qtquickcontrols2-swipeview.gif differ diff --git a/src/quicktemplates2/qquickswipeview.cpp b/src/quicktemplates2/qquickswipeview.cpp index e5c98f4d..37115c0a 100644 --- a/src/quicktemplates2/qquickswipeview.cpp +++ b/src/quicktemplates2/qquickswipeview.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE SwipeView provides a swipe-based navigation model. - \image qtquickcontrols2-swipeview-wireframe.png + \image qtquickcontrols2-swipeview.gif SwipeView is populated with a set of pages. One page is visible at a time. The user can navigate between the pages by swiping sideways. Notice that diff --git a/tests/manual/gifs/data/qtquickcontrols2-swipeview.qml b/tests/manual/gifs/data/qtquickcontrols2-swipeview.qml new file mode 100644 index 00000000..d721591a --- /dev/null +++ b/tests/manual/gifs/data/qtquickcontrols2-swipeview.qml @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.6 +import QtQuick.Window 2.0 +import QtQuick.Controls 2.0 + +Window { + width: 300 + height: 300 + visible: true + + property alias swipeView: view + + Rectangle { + border.width: 1 + anchors.fill: parent + } + + SwipeView { + id: view + anchors.fill: parent + + Label { + text: "First\nPage" + horizontalAlignment: Qt.AlignHCenter + verticalAlignment: Qt.AlignVCenter + } + + Label { + text: "Second\nPage" + horizontalAlignment: Qt.AlignHCenter + verticalAlignment: Qt.AlignVCenter + } + + Label { + text: "Third\nPage" + horizontalAlignment: Qt.AlignHCenter + verticalAlignment: Qt.AlignVCenter + } + } + + PageIndicator { + id: indicator + + count: view.count + currentIndex: view.currentIndex + + anchors.bottom: view.bottom + anchors.horizontalCenter: parent.horizontalCenter + } +} diff --git a/tests/manual/gifs/tst_gifs.cpp b/tests/manual/gifs/tst_gifs.cpp index c27c522b..5cb1f109 100644 --- a/tests/manual/gifs/tst_gifs.cpp +++ b/tests/manual/gifs/tst_gifs.cpp @@ -60,6 +60,7 @@ private slots: void button(); void tabBar(); void menu(); + void swipeView(); void swipeDelegate_data(); void swipeDelegate(); void swipeDelegateBehind(); @@ -481,6 +482,31 @@ void tst_Gifs::menu() gifRecorder.waitForFinish(); } +void tst_Gifs::swipeView() +{ + GifRecorder gifRecorder; + gifRecorder.setDataDirPath(dataDirPath); + gifRecorder.setOutputDir(outputDir); + gifRecorder.setRecordingDuration(8); + gifRecorder.setQmlFileName(QStringLiteral("qtquickcontrols2-swipeview.qml")); + gifRecorder.setHighQuality(true); + + gifRecorder.start(); + + QQuickWindow *window = gifRecorder.window(); + QQuickItem *swipeView = window->property("swipeView").value(); + QVERIFY(swipeView); + + QTest::qWait(1200); + swipeView->setProperty("currentIndex", 1); + QTest::qWait(2000); + swipeView->setProperty("currentIndex", 2); + QTest::qWait(2000); + swipeView->setProperty("currentIndex", 0); + + gifRecorder.waitForFinish(); +} + void tst_Gifs::swipeDelegate_data() { QTest::addColumn("qmlFileName"); -- cgit v1.2.3 From a706965798e5485550c2781854bf0d2d8fda2379 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 1 Nov 2016 20:14:28 +0100 Subject: ComboBox: fix accessibility support Change-Id: Icd196b3cd66b5b31a664c845e78953b4606022b7 Reviewed-by: Liang Qi --- src/quicktemplates2/qquickcombobox.cpp | 19 +++++++++++++++++++ src/quicktemplates2/qquickcombobox_p.h | 5 +++++ tests/auto/accessibility/data/combobox.qml | 13 +++++++++++++ tests/auto/accessibility/tst_accessibility.cpp | 1 + 4 files changed, 38 insertions(+) create mode 100644 tests/auto/accessibility/data/combobox.qml diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp index 52ee2b49..5194582b 100644 --- a/src/quicktemplates2/qquickcombobox.cpp +++ b/src/quicktemplates2/qquickcombobox.cpp @@ -273,6 +273,8 @@ void QQuickComboBoxPrivate::updateCurrentText() QString text = q->textAt(currentIndex); if (currentText != text) { currentText = text; + if (!hasDisplayText) + q->setAccessibleName(text); emit q->currentTextChanged(); } if (!hasDisplayText && displayText != text) { @@ -564,6 +566,7 @@ void QQuickComboBox::setDisplayText(const QString &text) return; d->displayText = text; + setAccessibleName(text); emit displayTextChanged(); } @@ -965,4 +968,20 @@ QFont QQuickComboBox::defaultFont() const return QQuickControlPrivate::themeFont(QPlatformTheme::ComboMenuItemFont); } +#ifndef QT_NO_ACCESSIBILITY +QAccessible::Role QQuickComboBox::accessibleRole() const +{ + return QAccessible::ComboBox; +} + +void QQuickComboBox::accessibilityActiveChanged(bool active) +{ + Q_D(QQuickComboBox); + QQuickControl::accessibilityActiveChanged(active); + + if (active) + setAccessibleName(d->hasDisplayText ? d->displayText : d->currentText); +} +#endif // QT_NO_ACCESSIBILITY + QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickcombobox_p.h b/src/quicktemplates2/qquickcombobox_p.h index 26b7688e..4cbdd77b 100644 --- a/src/quicktemplates2/qquickcombobox_p.h +++ b/src/quicktemplates2/qquickcombobox_p.h @@ -146,6 +146,11 @@ protected: QFont defaultFont() const override; +#ifndef QT_NO_ACCESSIBILITY + QAccessible::Role accessibleRole() const override; + void accessibilityActiveChanged(bool active) override; +#endif + private: Q_DISABLE_COPY(QQuickComboBox) Q_DECLARE_PRIVATE(QQuickComboBox) diff --git a/tests/auto/accessibility/data/combobox.qml b/tests/auto/accessibility/data/combobox.qml new file mode 100644 index 00000000..3bf972e9 --- /dev/null +++ b/tests/auto/accessibility/data/combobox.qml @@ -0,0 +1,13 @@ +import QtQuick 2.5 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.0 + +Window { + visible: true + + ComboBox { + id: button + objectName: "combobox" + model: ["ComboBox"] + } +} diff --git a/tests/auto/accessibility/tst_accessibility.cpp b/tests/auto/accessibility/tst_accessibility.cpp index e97e4702..ad6c06ca 100644 --- a/tests/auto/accessibility/tst_accessibility.cpp +++ b/tests/auto/accessibility/tst_accessibility.cpp @@ -73,6 +73,7 @@ void tst_accessibility::a11y_data() QTest::newRow("BusyIndicator") << "busyindicator" << 0x00000027 << ""; //QAccessible::Indicator QTest::newRow("Button") << "button" << 0x0000002B << "Button"; //QAccessible::Button QTest::newRow("CheckBox") << "checkbox" << 0x0000002C << "CheckBox"; //QAccessible::CheckBox + QTest::newRow("ComboBox") << "combobox" << 0x0000002E << "ComboBox"; //QAccessible::ComboBox // Frame // GroupBox QTest::newRow("Label") << "label" << 0x00000029 << "Label"; //QAccessible::StaticText -- cgit v1.2.3 From 244e423d6b58438a2b7f653827412815a335c276 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 1 Nov 2016 21:08:41 +0100 Subject: Page: fix accessibility support Change-Id: If7d15d914e35a675dcd456a4aa561a3280c2308a Reviewed-by: Liang Qi --- src/quicktemplates2/qquickpage.cpp | 10 ++++++++++ src/quicktemplates2/qquickpage_p.h | 1 + tests/auto/accessibility/data/page.qml | 13 +++++++++++++ tests/auto/accessibility/tst_accessibility.cpp | 1 + 4 files changed, 25 insertions(+) create mode 100644 tests/auto/accessibility/data/page.qml diff --git a/src/quicktemplates2/qquickpage.cpp b/src/quicktemplates2/qquickpage.cpp index 9ee0970b..a0de71db 100644 --- a/src/quicktemplates2/qquickpage.cpp +++ b/src/quicktemplates2/qquickpage.cpp @@ -211,6 +211,7 @@ void QQuickPage::setTitle(const QString &title) return; d->title = title; + setAccessibleName(title); emit titleChanged(); } @@ -382,6 +383,15 @@ QAccessible::Role QQuickPage::accessibleRole() const { return QAccessible::PageTab; } + +void QQuickPage::accessibilityActiveChanged(bool active) +{ + Q_D(QQuickPage); + QQuickControl::accessibilityActiveChanged(active); + + if (active) + setAccessibleName(d->title); +} #endif QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickpage_p.h b/src/quicktemplates2/qquickpage_p.h index 2cb77378..64f7602f 100644 --- a/src/quicktemplates2/qquickpage_p.h +++ b/src/quicktemplates2/qquickpage_p.h @@ -93,6 +93,7 @@ protected: #ifndef QT_NO_ACCESSIBILITY QAccessible::Role accessibleRole() const override; + void accessibilityActiveChanged(bool active) override; #endif private: diff --git a/tests/auto/accessibility/data/page.qml b/tests/auto/accessibility/data/page.qml new file mode 100644 index 00000000..c4058b29 --- /dev/null +++ b/tests/auto/accessibility/data/page.qml @@ -0,0 +1,13 @@ +import QtQuick 2.5 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.0 + +Window { + visible: true + + Page { + id: page + objectName: "page" + title: "Page" + } +} diff --git a/tests/auto/accessibility/tst_accessibility.cpp b/tests/auto/accessibility/tst_accessibility.cpp index ad6c06ca..e486e6f9 100644 --- a/tests/auto/accessibility/tst_accessibility.cpp +++ b/tests/auto/accessibility/tst_accessibility.cpp @@ -78,6 +78,7 @@ void tst_accessibility::a11y_data() // GroupBox QTest::newRow("Label") << "label" << 0x00000029 << "Label"; //QAccessible::StaticText QTest::newRow("Menu") << "menu" << 0x0000000B << ""; //QAccessible::PopupMenu + QTest::newRow("Page") << "page" << 0x00000025 << "Page"; //QAccessible::PageTab QTest::newRow("PageIndicator") << "pageindicator" << 0x00000027 << ""; //QAccessible::Indicator QTest::newRow("Popup") << "popup" << 0x00000080 << ""; //QAccessible::LayeredPane QTest::newRow("ProgressBar") << "progressbar" << 0x00000030 << ""; //QAccessible::ProgressBar -- cgit v1.2.3 From a115ec5d1b8598191003fd1fff6f8e43fe9e042f Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 1 Nov 2016 21:02:02 +0100 Subject: GroupBox: fix accessibility support Change-Id: Ifbbc701a996ed9ddb13f7d16843d0af5ee480ca1 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickgroupbox.cpp | 17 +++++++++++++++++ src/quicktemplates2/qquickgroupbox_p.h | 5 +++++ tests/auto/accessibility/data/groupbox.qml | 13 +++++++++++++ tests/auto/accessibility/tst_accessibility.cpp | 2 +- 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 tests/auto/accessibility/data/groupbox.qml diff --git a/src/quicktemplates2/qquickgroupbox.cpp b/src/quicktemplates2/qquickgroupbox.cpp index 5a5a8005..996351a7 100644 --- a/src/quicktemplates2/qquickgroupbox.cpp +++ b/src/quicktemplates2/qquickgroupbox.cpp @@ -118,6 +118,7 @@ void QQuickGroupBox::setTitle(const QString &title) return; d->title = title; + setAccessibleName(title); emit titleChanged(); } @@ -152,4 +153,20 @@ QFont QQuickGroupBox::defaultFont() const return QQuickControlPrivate::themeFont(QPlatformTheme::GroupBoxTitleFont); } +#ifndef QT_NO_ACCESSIBILITY +QAccessible::Role QQuickGroupBox::accessibleRole() const +{ + return QAccessible::Grouping; +} + +void QQuickGroupBox::accessibilityActiveChanged(bool active) +{ + Q_D(QQuickGroupBox); + QQuickFrame::accessibilityActiveChanged(active); + + if (active) + setAccessibleName(d->title); +} +#endif // QT_NO_ACCESSIBILITY + QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickgroupbox_p.h b/src/quicktemplates2/qquickgroupbox_p.h index 0f1bdc54..98f6ad06 100644 --- a/src/quicktemplates2/qquickgroupbox_p.h +++ b/src/quicktemplates2/qquickgroupbox_p.h @@ -76,6 +76,11 @@ Q_SIGNALS: protected: QFont defaultFont() const override; +#ifndef QT_NO_ACCESSIBILITY + QAccessible::Role accessibleRole() const override; + void accessibilityActiveChanged(bool active) override; +#endif + private: Q_DISABLE_COPY(QQuickGroupBox) Q_DECLARE_PRIVATE(QQuickGroupBox) diff --git a/tests/auto/accessibility/data/groupbox.qml b/tests/auto/accessibility/data/groupbox.qml new file mode 100644 index 00000000..e454cbfd --- /dev/null +++ b/tests/auto/accessibility/data/groupbox.qml @@ -0,0 +1,13 @@ +import QtQuick 2.5 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.0 + +Window { + visible: true + + GroupBox { + id: groupbox + objectName: "groupbox" + title: "GroupBox" + } +} diff --git a/tests/auto/accessibility/tst_accessibility.cpp b/tests/auto/accessibility/tst_accessibility.cpp index e486e6f9..80f0a5b0 100644 --- a/tests/auto/accessibility/tst_accessibility.cpp +++ b/tests/auto/accessibility/tst_accessibility.cpp @@ -75,7 +75,7 @@ void tst_accessibility::a11y_data() QTest::newRow("CheckBox") << "checkbox" << 0x0000002C << "CheckBox"; //QAccessible::CheckBox QTest::newRow("ComboBox") << "combobox" << 0x0000002E << "ComboBox"; //QAccessible::ComboBox // Frame - // GroupBox + QTest::newRow("GroupBox") << "groupbox" << 0x00000014 << "GroupBox"; //QAccessible::Grouping QTest::newRow("Label") << "label" << 0x00000029 << "Label"; //QAccessible::StaticText QTest::newRow("Menu") << "menu" << 0x0000000B << ""; //QAccessible::PopupMenu QTest::newRow("Page") << "page" << 0x00000025 << "Page"; //QAccessible::PageTab -- cgit v1.2.3 From c0b1a37f96b5faa4bea1d860489b0990750682d5 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 1 Nov 2016 20:14:28 +0100 Subject: tst_accessibility: add some missing controls Change-Id: Ice26b851009c1e0e457976d85c918d31dcf96dc5 Reviewed-by: Liang Qi --- tests/auto/accessibility/data/checkdelegate.qml | 13 +++++++++++++ tests/auto/accessibility/data/itemdelegate.qml | 13 +++++++++++++ tests/auto/accessibility/data/menuitem.qml | 13 +++++++++++++ tests/auto/accessibility/data/pane.qml | 12 ++++++++++++ tests/auto/accessibility/data/switchdelegate.qml | 13 +++++++++++++ tests/auto/accessibility/tst_accessibility.cpp | 6 ++++++ 6 files changed, 70 insertions(+) create mode 100644 tests/auto/accessibility/data/checkdelegate.qml create mode 100644 tests/auto/accessibility/data/itemdelegate.qml create mode 100644 tests/auto/accessibility/data/menuitem.qml create mode 100644 tests/auto/accessibility/data/pane.qml create mode 100644 tests/auto/accessibility/data/switchdelegate.qml diff --git a/tests/auto/accessibility/data/checkdelegate.qml b/tests/auto/accessibility/data/checkdelegate.qml new file mode 100644 index 00000000..d7f786da --- /dev/null +++ b/tests/auto/accessibility/data/checkdelegate.qml @@ -0,0 +1,13 @@ +import QtQuick 2.5 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.0 + +Window { + visible: true + + CheckDelegate { + id: checkdelegate + objectName: "checkdelegate" + text: "CheckDelegate" + } +} diff --git a/tests/auto/accessibility/data/itemdelegate.qml b/tests/auto/accessibility/data/itemdelegate.qml new file mode 100644 index 00000000..10880c28 --- /dev/null +++ b/tests/auto/accessibility/data/itemdelegate.qml @@ -0,0 +1,13 @@ +import QtQuick 2.5 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.0 + +Window { + visible: true + + ItemDelegate { + id: itemdelegate + objectName: "itemdelegate" + text: "ItemDelegate" + } +} diff --git a/tests/auto/accessibility/data/menuitem.qml b/tests/auto/accessibility/data/menuitem.qml new file mode 100644 index 00000000..9f7c2a85 --- /dev/null +++ b/tests/auto/accessibility/data/menuitem.qml @@ -0,0 +1,13 @@ +import QtQuick 2.5 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.0 + +Window { + visible: true + + MenuItem { + id: menuitem + objectName: "menuitem" + text: "MenuItem" + } +} diff --git a/tests/auto/accessibility/data/pane.qml b/tests/auto/accessibility/data/pane.qml new file mode 100644 index 00000000..9b99d790 --- /dev/null +++ b/tests/auto/accessibility/data/pane.qml @@ -0,0 +1,12 @@ +import QtQuick 2.5 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.0 + +Window { + visible: true + + Pane { + id: pane + objectName: "pane" + } +} diff --git a/tests/auto/accessibility/data/switchdelegate.qml b/tests/auto/accessibility/data/switchdelegate.qml new file mode 100644 index 00000000..ae9b95f1 --- /dev/null +++ b/tests/auto/accessibility/data/switchdelegate.qml @@ -0,0 +1,13 @@ +import QtQuick 2.5 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.0 + +Window { + visible: true + + SwitchDelegate { + id: switchdelegate + objectName: "switchdelegate" + text: "SwitchDelegate" + } +} diff --git a/tests/auto/accessibility/tst_accessibility.cpp b/tests/auto/accessibility/tst_accessibility.cpp index 80f0a5b0..527fc678 100644 --- a/tests/auto/accessibility/tst_accessibility.cpp +++ b/tests/auto/accessibility/tst_accessibility.cpp @@ -73,13 +73,17 @@ void tst_accessibility::a11y_data() QTest::newRow("BusyIndicator") << "busyindicator" << 0x00000027 << ""; //QAccessible::Indicator QTest::newRow("Button") << "button" << 0x0000002B << "Button"; //QAccessible::Button QTest::newRow("CheckBox") << "checkbox" << 0x0000002C << "CheckBox"; //QAccessible::CheckBox + QTest::newRow("CheckDelegate") << "checkdelegate" << 0x0000002C << "CheckDelegate"; //QAccessible::CheckBox QTest::newRow("ComboBox") << "combobox" << 0x0000002E << "ComboBox"; //QAccessible::ComboBox // Frame QTest::newRow("GroupBox") << "groupbox" << 0x00000014 << "GroupBox"; //QAccessible::Grouping + QTest::newRow("ItemDelegate") << "itemdelegate" << 0x00000022 << "ItemDelegate"; //QAccessible::ListItem QTest::newRow("Label") << "label" << 0x00000029 << "Label"; //QAccessible::StaticText QTest::newRow("Menu") << "menu" << 0x0000000B << ""; //QAccessible::PopupMenu + QTest::newRow("MenuItem") << "menuitem" << 0x0000000C << "MenuItem"; //QAccessible::MenuItem QTest::newRow("Page") << "page" << 0x00000025 << "Page"; //QAccessible::PageTab QTest::newRow("PageIndicator") << "pageindicator" << 0x00000027 << ""; //QAccessible::Indicator + QTest::newRow("Pane") << "pane" << 0x00000010 << ""; //QAccessible::Pane QTest::newRow("Popup") << "popup" << 0x00000080 << ""; //QAccessible::LayeredPane QTest::newRow("ProgressBar") << "progressbar" << 0x00000030 << ""; //QAccessible::ProgressBar QTest::newRow("RadioButton") << "radiobutton" << 0x0000002D << "RadioButton"; //QAccessible::RadioButton @@ -90,12 +94,14 @@ void tst_accessibility::a11y_data() QTest::newRow("SpinBox") << "spinbox" << 0x00000034 << ""; //QAccessible::SpinBox // StackView QTest::newRow("Switch") << "switch" << 0x0000002B << "Switch"; //QAccessible::Button + QTest::newRow("SwitchDelegate") << "switchdelegate" << 0x00000022 << "SwitchDelegate"; //QAccessible::ListItem QTest::newRow("TabBar") << "tabbar" << 0x0000003C << ""; //QAccessible::PageTabList QTest::newRow("TabButton") << "tabbutton" << 0x00000025 << "TabButton"; //QAccessible::PageTab QTest::newRow("TextArea") << "textarea" << 0x0000002A << ""; //QAccessible::Accessible.EditableText QTest::newRow("TextField") << "textfield" << 0x0000002A << ""; //QAccessible::Accessible.EditableText QTest::newRow("ToolBar") << "toolbar" << 0x00000016 << ""; //QAccessible::ToolBar QTest::newRow("ToolButton") << "toolbutton" << 0x0000002B << "ToolButton"; //QAccessible::Button + // ToolTip QTest::newRow("Dial") << "dial" << 0x00000031 << ""; //QAccessible::Dial // Drawer -- cgit v1.2.3 From 2f1e983aaf7afc8ac0ed572a48d9444acab51d00 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 1 Nov 2016 21:41:21 +0100 Subject: QQuickPopup: let subclasses control accessibility attributes Required for QQuickToolTip (text) and QQuickDialog (title). Change-Id: Ia4a4c948548b05e69bd6319228d73c3baed44abe Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickpopup.cpp | 36 +++++++++++++++++++++++++++++++++++ src/quicktemplates2/qquickpopup_p.h | 7 +++++++ src/quicktemplates2/qquickpopup_p_p.h | 1 + 3 files changed, 44 insertions(+) diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index 518117fa..10657e90 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -648,6 +648,13 @@ QAccessible::Role QQuickPopupItem::accessibleRole() const Q_D(const QQuickPopupItem); return d->popup->accessibleRole(); } + +void QQuickPopupItem::accessibilityActiveChanged(bool active) +{ + Q_D(const QQuickPopupItem); + QQuickControl::accessibilityActiveChanged(active); + d->popup->accessibilityActiveChanged(active); +} #endif // QT_NO_ACCESSIBILITY QQuickPopupPositioner::QQuickPopupPositioner(QQuickPopupPrivate *popup) : @@ -2351,8 +2358,37 @@ QAccessible::Role QQuickPopup::accessibleRole() const { return QAccessible::LayeredPane; } + +void QQuickPopup::accessibilityActiveChanged(bool active) +{ + Q_UNUSED(active); +} #endif // QT_NO_ACCESSIBILITY +QString QQuickPopup::accessibleName() const +{ + Q_D(const QQuickPopup); + return d->popupItem->accessibleName(); +} + +void QQuickPopup::setAccessibleName(const QString &name) +{ + Q_D(QQuickPopup); + d->popupItem->setAccessibleName(name); +} + +QVariant QQuickPopup::accessibleProperty(const char *propertyName) +{ + Q_D(const QQuickPopup); + return d->popupItem->accessibleProperty(propertyName); +} + +bool QQuickPopup::setAccessibleProperty(const char *propertyName, const QVariant &value) +{ + Q_D(QQuickPopup); + return d->popupItem->setAccessibleProperty(propertyName, value); +} + QT_END_NAMESPACE #include "moc_qquickpopup_p.cpp" diff --git a/src/quicktemplates2/qquickpopup_p.h b/src/quicktemplates2/qquickpopup_p.h index a024c68f..6393dcdc 100644 --- a/src/quicktemplates2/qquickpopup_p.h +++ b/src/quicktemplates2/qquickpopup_p.h @@ -359,8 +359,15 @@ protected: #ifndef QT_NO_ACCESSIBILITY virtual QAccessible::Role accessibleRole() const; + virtual void accessibilityActiveChanged(bool active); #endif + QString accessibleName() const; + void setAccessibleName(const QString &name); + + QVariant accessibleProperty(const char *propertyName); + bool setAccessibleProperty(const char *propertyName, const QVariant &value); + private: Q_DISABLE_COPY(QQuickPopup) Q_DECLARE_PRIVATE(QQuickPopup) diff --git a/src/quicktemplates2/qquickpopup_p_p.h b/src/quicktemplates2/qquickpopup_p_p.h index 96ce2ca0..0c12b077 100644 --- a/src/quicktemplates2/qquickpopup_p_p.h +++ b/src/quicktemplates2/qquickpopup_p_p.h @@ -116,6 +116,7 @@ protected: #ifndef QT_NO_ACCESSIBILITY QAccessible::Role accessibleRole() const override; + void accessibilityActiveChanged(bool active) override; #endif private: -- cgit v1.2.3 From 31c51eb402c67c9a01b9f0cf108195db699e2a9c Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 1 Nov 2016 21:46:19 +0100 Subject: ToolTip: fix accessibility support Change-Id: I4623b1f1ee1e10c4233e89bf42e6720bbf3a5c73 Reviewed-by: Liang Qi Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquicktooltip.cpp | 10 ++++++++++ src/quicktemplates2/qquicktooltip_p.h | 1 + tests/auto/accessibility/data/tooltip.qml | 13 +++++++++++++ tests/auto/accessibility/tst_accessibility.cpp | 2 +- 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 tests/auto/accessibility/data/tooltip.qml diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp index b29e806c..3bd47457 100644 --- a/src/quicktemplates2/qquicktooltip.cpp +++ b/src/quicktemplates2/qquicktooltip.cpp @@ -188,6 +188,7 @@ void QQuickToolTip::setText(const QString &text) return; d->text = text; + setAccessibleName(text); emit textChanged(); } @@ -307,6 +308,15 @@ QAccessible::Role QQuickToolTip::accessibleRole() const { return QAccessible::ToolTip; } + +void QQuickToolTip::accessibilityActiveChanged(bool active) +{ + Q_D(QQuickToolTip); + QQuickPopup::accessibilityActiveChanged(active); + + if (active) + setAccessibleName(d->text); +} #endif class QQuickToolTipAttachedPrivate : public QObjectPrivate diff --git a/src/quicktemplates2/qquicktooltip_p.h b/src/quicktemplates2/qquicktooltip_p.h index 730e38d9..9b628747 100644 --- a/src/quicktemplates2/qquicktooltip_p.h +++ b/src/quicktemplates2/qquicktooltip_p.h @@ -92,6 +92,7 @@ protected: #ifndef QT_NO_ACCESSIBILITY QAccessible::Role accessibleRole() const override; + void accessibilityActiveChanged(bool active) override; #endif private: diff --git a/tests/auto/accessibility/data/tooltip.qml b/tests/auto/accessibility/data/tooltip.qml new file mode 100644 index 00000000..4a2f16b5 --- /dev/null +++ b/tests/auto/accessibility/data/tooltip.qml @@ -0,0 +1,13 @@ +import QtQuick 2.5 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.0 + +Window { + visible: true + + ToolTip { + id: tooltip + objectName: "tooltip" + text: "ToolTip" + } +} diff --git a/tests/auto/accessibility/tst_accessibility.cpp b/tests/auto/accessibility/tst_accessibility.cpp index 527fc678..208f4ff7 100644 --- a/tests/auto/accessibility/tst_accessibility.cpp +++ b/tests/auto/accessibility/tst_accessibility.cpp @@ -101,7 +101,7 @@ void tst_accessibility::a11y_data() QTest::newRow("TextField") << "textfield" << 0x0000002A << ""; //QAccessible::Accessible.EditableText QTest::newRow("ToolBar") << "toolbar" << 0x00000016 << ""; //QAccessible::ToolBar QTest::newRow("ToolButton") << "toolbutton" << 0x0000002B << "ToolButton"; //QAccessible::Button - // ToolTip + QTest::newRow("ToolTip") << "tooltip" << 0x0000000D << "ToolTip"; //QAccessible::ToolTip QTest::newRow("Dial") << "dial" << 0x00000031 << ""; //QAccessible::Dial // Drawer -- cgit v1.2.3 From 189fe8349943a928dd0af50e90b8232a4bbe6acc Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 1 Nov 2016 21:05:32 +0100 Subject: Frame: fix accessibility support Change-Id: I79f06e3a60151ab4e35b6290fbfe022ed20665e3 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickframe.cpp | 7 +++++++ src/quicktemplates2/qquickframe_p.h | 4 ++++ tests/auto/accessibility/data/frame.qml | 12 ++++++++++++ tests/auto/accessibility/tst_accessibility.cpp | 2 +- 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 tests/auto/accessibility/data/frame.qml diff --git a/src/quicktemplates2/qquickframe.cpp b/src/quicktemplates2/qquickframe.cpp index bcc387c1..d51ea60a 100644 --- a/src/quicktemplates2/qquickframe.cpp +++ b/src/quicktemplates2/qquickframe.cpp @@ -78,4 +78,11 @@ QQuickFrame::QQuickFrame(QQuickFramePrivate &dd, QQuickItem *parent) : { } +#ifndef QT_NO_ACCESSIBILITY +QAccessible::Role QQuickFrame::accessibleRole() const +{ + return QAccessible::Border; +} +#endif // QT_NO_ACCESSIBILITY + QT_END_NAMESPACE diff --git a/src/quicktemplates2/qquickframe_p.h b/src/quicktemplates2/qquickframe_p.h index 12a65afd..093da248 100644 --- a/src/quicktemplates2/qquickframe_p.h +++ b/src/quicktemplates2/qquickframe_p.h @@ -64,6 +64,10 @@ public: protected: QQuickFrame(QQuickFramePrivate &dd, QQuickItem *parent); +#ifndef QT_NO_ACCESSIBILITY + QAccessible::Role accessibleRole() const override; +#endif + private: Q_DISABLE_COPY(QQuickFrame) Q_DECLARE_PRIVATE(QQuickFrame) diff --git a/tests/auto/accessibility/data/frame.qml b/tests/auto/accessibility/data/frame.qml new file mode 100644 index 00000000..8efe3079 --- /dev/null +++ b/tests/auto/accessibility/data/frame.qml @@ -0,0 +1,12 @@ +import QtQuick 2.5 +import QtQuick.Window 2.2 +import QtQuick.Controls 2.0 + +Window { + visible: true + + Frame { + id: frame + objectName: "frame" + } +} diff --git a/tests/auto/accessibility/tst_accessibility.cpp b/tests/auto/accessibility/tst_accessibility.cpp index 208f4ff7..c1c9cb25 100644 --- a/tests/auto/accessibility/tst_accessibility.cpp +++ b/tests/auto/accessibility/tst_accessibility.cpp @@ -75,7 +75,7 @@ void tst_accessibility::a11y_data() QTest::newRow("CheckBox") << "checkbox" << 0x0000002C << "CheckBox"; //QAccessible::CheckBox QTest::newRow("CheckDelegate") << "checkdelegate" << 0x0000002C << "CheckDelegate"; //QAccessible::CheckBox QTest::newRow("ComboBox") << "combobox" << 0x0000002E << "ComboBox"; //QAccessible::ComboBox - // Frame + QTest::newRow("Frame") << "frame" << 0x00000013 << ""; //QAccessible::Border QTest::newRow("GroupBox") << "groupbox" << 0x00000014 << "GroupBox"; //QAccessible::Grouping QTest::newRow("ItemDelegate") << "itemdelegate" << 0x00000022 << "ItemDelegate"; //QAccessible::ListItem QTest::newRow("Label") << "label" << 0x00000029 << "Label"; //QAccessible::StaticText -- cgit v1.2.3 From 08325282ecf445267255abf1aa184a09795cedae Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 2 Nov 2016 08:21:37 +0100 Subject: Cleanup and speedup tst_accessibility Before: Totals: 37 passed, 0 failed, 0 skipped, 0 blacklisted, 6919ms After: Totals: 37 passed, 0 failed, 0 skipped, 0 blacklisted, 599ms Change-Id: I8376d74a265d30956cba1f2e290333a8efd70067 Reviewed-by: Mitch Curtis --- tests/auto/accessibility/data/busyindicator.qml | 10 +-------- tests/auto/accessibility/data/button.qml | 11 ++-------- tests/auto/accessibility/data/checkbox.qml | 11 ++-------- tests/auto/accessibility/data/checkdelegate.qml | 11 ++-------- tests/auto/accessibility/data/combobox.qml | 11 ++-------- tests/auto/accessibility/data/control.qml | 10 +-------- tests/auto/accessibility/data/dayofweekrow-2.qml | 10 +-------- tests/auto/accessibility/data/dayofweekrow.qml | 11 ++-------- tests/auto/accessibility/data/dial.qml | 10 +-------- tests/auto/accessibility/data/frame.qml | 10 +-------- tests/auto/accessibility/data/groupbox.qml | 11 ++-------- tests/auto/accessibility/data/itemdelegate.qml | 11 ++-------- tests/auto/accessibility/data/label.qml | 11 ++-------- tests/auto/accessibility/data/menu.qml | 10 +-------- tests/auto/accessibility/data/menuitem.qml | 11 ++-------- tests/auto/accessibility/data/monthgrid-2.qml | 11 ++-------- tests/auto/accessibility/data/monthgrid.qml | 13 +++-------- tests/auto/accessibility/data/page.qml | 11 ++-------- tests/auto/accessibility/data/pageindicator.qml | 10 +-------- tests/auto/accessibility/data/pane.qml | 10 +-------- tests/auto/accessibility/data/popup.qml | 10 +-------- tests/auto/accessibility/data/progressbar.qml | 15 ++++--------- tests/auto/accessibility/data/radiobutton.qml | 11 ++-------- tests/auto/accessibility/data/rangeslider.qml | 21 ++++++------------ tests/auto/accessibility/data/scrollbar.qml | 10 +-------- tests/auto/accessibility/data/scrollindicator.qml | 10 +-------- tests/auto/accessibility/data/slider.qml | 19 ++++++---------- tests/auto/accessibility/data/spinbox.qml | 17 +++++---------- tests/auto/accessibility/data/switch.qml | 11 ++-------- tests/auto/accessibility/data/switchdelegate.qml | 11 ++-------- tests/auto/accessibility/data/tabbar.qml | 10 +-------- tests/auto/accessibility/data/tabbutton.qml | 15 ++----------- tests/auto/accessibility/data/textarea.qml | 11 ++-------- tests/auto/accessibility/data/textfield.qml | 11 ++-------- tests/auto/accessibility/data/toolbar.qml | 10 +-------- tests/auto/accessibility/data/toolbutton.qml | 11 ++-------- tests/auto/accessibility/data/tooltip.qml | 11 ++-------- .../auto/accessibility/data/weeknumbercolumn-2.qml | 10 +-------- tests/auto/accessibility/data/weeknumbercolumn.qml | 11 ++-------- tests/auto/accessibility/tst_accessibility.cpp | 25 ++++++---------------- 40 files changed, 86 insertions(+), 388 deletions(-) diff --git a/tests/auto/accessibility/data/busyindicator.qml b/tests/auto/accessibility/data/busyindicator.qml index 4bde9634..b15ea80a 100644 --- a/tests/auto/accessibility/data/busyindicator.qml +++ b/tests/auto/accessibility/data/busyindicator.qml @@ -1,12 +1,4 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - BusyIndicator { - id: busyindicator - objectName: "busyindicator" - } -} +BusyIndicator { } diff --git a/tests/auto/accessibility/data/button.qml b/tests/auto/accessibility/data/button.qml index 75925185..0fd14210 100644 --- a/tests/auto/accessibility/data/button.qml +++ b/tests/auto/accessibility/data/button.qml @@ -1,13 +1,6 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - Button { - id: button - objectName: "button" - text: "Button" - } +Button { + text: "Button" } diff --git a/tests/auto/accessibility/data/checkbox.qml b/tests/auto/accessibility/data/checkbox.qml index 9700663d..e70d7d83 100644 --- a/tests/auto/accessibility/data/checkbox.qml +++ b/tests/auto/accessibility/data/checkbox.qml @@ -1,13 +1,6 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - CheckBox { - id: checkbox - objectName: "checkbox" - text: "CheckBox" - } +CheckBox { + text: "CheckBox" } diff --git a/tests/auto/accessibility/data/checkdelegate.qml b/tests/auto/accessibility/data/checkdelegate.qml index d7f786da..0a1a4a4f 100644 --- a/tests/auto/accessibility/data/checkdelegate.qml +++ b/tests/auto/accessibility/data/checkdelegate.qml @@ -1,13 +1,6 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - CheckDelegate { - id: checkdelegate - objectName: "checkdelegate" - text: "CheckDelegate" - } +CheckDelegate { + text: "CheckDelegate" } diff --git a/tests/auto/accessibility/data/combobox.qml b/tests/auto/accessibility/data/combobox.qml index 3bf972e9..42e4d47b 100644 --- a/tests/auto/accessibility/data/combobox.qml +++ b/tests/auto/accessibility/data/combobox.qml @@ -1,13 +1,6 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - ComboBox { - id: button - objectName: "combobox" - model: ["ComboBox"] - } +ComboBox { + model: ["ComboBox"] } diff --git a/tests/auto/accessibility/data/control.qml b/tests/auto/accessibility/data/control.qml index ceaba509..4831a6c6 100644 --- a/tests/auto/accessibility/data/control.qml +++ b/tests/auto/accessibility/data/control.qml @@ -1,12 +1,4 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - Control { - id: control - objectName: "control" - } -} +Control { } diff --git a/tests/auto/accessibility/data/dayofweekrow-2.qml b/tests/auto/accessibility/data/dayofweekrow-2.qml index 26569836..265f975a 100644 --- a/tests/auto/accessibility/data/dayofweekrow-2.qml +++ b/tests/auto/accessibility/data/dayofweekrow-2.qml @@ -1,12 +1,4 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import Qt.labs.calendar 1.0 -Window { - visible: true - - DayOfWeekRow { - id: dayofweekrow - objectName: "dayofweekrow" - } -} +DayOfWeekRow { } diff --git a/tests/auto/accessibility/data/dayofweekrow.qml b/tests/auto/accessibility/data/dayofweekrow.qml index c799aba1..a3ab92dd 100644 --- a/tests/auto/accessibility/data/dayofweekrow.qml +++ b/tests/auto/accessibility/data/dayofweekrow.qml @@ -1,13 +1,6 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import Qt.labs.calendar 1.0 -Window { - visible: true - - DayOfWeekRow { - id: dayofweekrow - objectName: "dayofweekrow" - Accessible.name: "DayOfWeekRow" - } +DayOfWeekRow { + Accessible.name: "DayOfWeekRow" } diff --git a/tests/auto/accessibility/data/dial.qml b/tests/auto/accessibility/data/dial.qml index 6b2333b1..39b85550 100644 --- a/tests/auto/accessibility/data/dial.qml +++ b/tests/auto/accessibility/data/dial.qml @@ -1,12 +1,4 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - Dial { - id: dial - objectName: "dial" - } -} +Dial { } diff --git a/tests/auto/accessibility/data/frame.qml b/tests/auto/accessibility/data/frame.qml index 8efe3079..6fcbab23 100644 --- a/tests/auto/accessibility/data/frame.qml +++ b/tests/auto/accessibility/data/frame.qml @@ -1,12 +1,4 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - Frame { - id: frame - objectName: "frame" - } -} +Frame { } diff --git a/tests/auto/accessibility/data/groupbox.qml b/tests/auto/accessibility/data/groupbox.qml index e454cbfd..c48b4847 100644 --- a/tests/auto/accessibility/data/groupbox.qml +++ b/tests/auto/accessibility/data/groupbox.qml @@ -1,13 +1,6 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - GroupBox { - id: groupbox - objectName: "groupbox" - title: "GroupBox" - } +GroupBox { + title: "GroupBox" } diff --git a/tests/auto/accessibility/data/itemdelegate.qml b/tests/auto/accessibility/data/itemdelegate.qml index 10880c28..9b647315 100644 --- a/tests/auto/accessibility/data/itemdelegate.qml +++ b/tests/auto/accessibility/data/itemdelegate.qml @@ -1,13 +1,6 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - ItemDelegate { - id: itemdelegate - objectName: "itemdelegate" - text: "ItemDelegate" - } +ItemDelegate { + text: "ItemDelegate" } diff --git a/tests/auto/accessibility/data/label.qml b/tests/auto/accessibility/data/label.qml index 409898d4..bb87a4e9 100644 --- a/tests/auto/accessibility/data/label.qml +++ b/tests/auto/accessibility/data/label.qml @@ -1,13 +1,6 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - Label { - id: label - objectName: "label" - text: "Label" - } +Label { + text: "Label" } diff --git a/tests/auto/accessibility/data/menu.qml b/tests/auto/accessibility/data/menu.qml index bb777064..def3020b 100644 --- a/tests/auto/accessibility/data/menu.qml +++ b/tests/auto/accessibility/data/menu.qml @@ -1,12 +1,4 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - Menu { - id: menu - objectName: "menu" - } -} +Menu { } diff --git a/tests/auto/accessibility/data/menuitem.qml b/tests/auto/accessibility/data/menuitem.qml index 9f7c2a85..70c2ff33 100644 --- a/tests/auto/accessibility/data/menuitem.qml +++ b/tests/auto/accessibility/data/menuitem.qml @@ -1,13 +1,6 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - MenuItem { - id: menuitem - objectName: "menuitem" - text: "MenuItem" - } +MenuItem { + text: "MenuItem" } diff --git a/tests/auto/accessibility/data/monthgrid-2.qml b/tests/auto/accessibility/data/monthgrid-2.qml index 76af6646..603a208b 100644 --- a/tests/auto/accessibility/data/monthgrid-2.qml +++ b/tests/auto/accessibility/data/monthgrid-2.qml @@ -1,13 +1,6 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import Qt.labs.calendar 1.0 -Window { - visible: true - - MonthGrid { - id: monthgrid - objectName: "monthgrid" - title: "MonthGrid" - } +MonthGrid { + title: "MonthGrid" } diff --git a/tests/auto/accessibility/data/monthgrid.qml b/tests/auto/accessibility/data/monthgrid.qml index 7c8d6451..92a45f0f 100644 --- a/tests/auto/accessibility/data/monthgrid.qml +++ b/tests/auto/accessibility/data/monthgrid.qml @@ -1,14 +1,7 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import Qt.labs.calendar 1.0 -Window { - visible: true - - MonthGrid { - id: monthgrid - objectName: "monthgrid" - title: "MonthGrid" - Accessible.name: title - } +MonthGrid { + title: "MonthGrid" + Accessible.name: title } diff --git a/tests/auto/accessibility/data/page.qml b/tests/auto/accessibility/data/page.qml index c4058b29..59139855 100644 --- a/tests/auto/accessibility/data/page.qml +++ b/tests/auto/accessibility/data/page.qml @@ -1,13 +1,6 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - Page { - id: page - objectName: "page" - title: "Page" - } +Page { + title: "Page" } diff --git a/tests/auto/accessibility/data/pageindicator.qml b/tests/auto/accessibility/data/pageindicator.qml index b42d3f9e..bb69a27a 100644 --- a/tests/auto/accessibility/data/pageindicator.qml +++ b/tests/auto/accessibility/data/pageindicator.qml @@ -1,12 +1,4 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - PageIndicator { - id: pageindicator - objectName: "pageindicator" - } -} +PageIndicator { } diff --git a/tests/auto/accessibility/data/pane.qml b/tests/auto/accessibility/data/pane.qml index 9b99d790..1de210ec 100644 --- a/tests/auto/accessibility/data/pane.qml +++ b/tests/auto/accessibility/data/pane.qml @@ -1,12 +1,4 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - Pane { - id: pane - objectName: "pane" - } -} +Pane { } diff --git a/tests/auto/accessibility/data/popup.qml b/tests/auto/accessibility/data/popup.qml index 70fe2e5f..05e968e5 100644 --- a/tests/auto/accessibility/data/popup.qml +++ b/tests/auto/accessibility/data/popup.qml @@ -1,12 +1,4 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - Popup { - id: popup - objectName: "popup" - } -} +Popup { } diff --git a/tests/auto/accessibility/data/progressbar.qml b/tests/auto/accessibility/data/progressbar.qml index 283db003..5e9b11f1 100644 --- a/tests/auto/accessibility/data/progressbar.qml +++ b/tests/auto/accessibility/data/progressbar.qml @@ -1,15 +1,8 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - ProgressBar { - id: progressbar - objectName: "progressbar" - from: 0 - to: 100 - value: 50 - } +ProgressBar { + from: 0 + to: 100 + value: 50 } diff --git a/tests/auto/accessibility/data/radiobutton.qml b/tests/auto/accessibility/data/radiobutton.qml index 1883fff8..58bdf225 100644 --- a/tests/auto/accessibility/data/radiobutton.qml +++ b/tests/auto/accessibility/data/radiobutton.qml @@ -1,13 +1,6 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - RadioButton { - id: radiobutton - objectName: "radiobutton" - text: "RadioButton" - } +RadioButton { + text: "RadioButton" } diff --git a/tests/auto/accessibility/data/rangeslider.qml b/tests/auto/accessibility/data/rangeslider.qml index ce3dc872..45b1d4ae 100644 --- a/tests/auto/accessibility/data/rangeslider.qml +++ b/tests/auto/accessibility/data/rangeslider.qml @@ -1,18 +1,11 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - RangeSlider { - id: rangeSlider - objectName: "rangeslider" - from: 0 - to: 100 - first.value: 25 - second.value: 75 - stepSize: 1 - orientation: "Horizontal" - } +RangeSlider { + from: 0 + to: 100 + first.value: 25 + second.value: 75 + stepSize: 1 + orientation: Qt.Horizontal } diff --git a/tests/auto/accessibility/data/scrollbar.qml b/tests/auto/accessibility/data/scrollbar.qml index 2e360422..f0598b4b 100644 --- a/tests/auto/accessibility/data/scrollbar.qml +++ b/tests/auto/accessibility/data/scrollbar.qml @@ -1,12 +1,4 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - ScrollBar { - id: scrollbar - objectName: "scrollbar" - } -} +ScrollBar { } diff --git a/tests/auto/accessibility/data/scrollindicator.qml b/tests/auto/accessibility/data/scrollindicator.qml index e933dece..4cb81c4e 100644 --- a/tests/auto/accessibility/data/scrollindicator.qml +++ b/tests/auto/accessibility/data/scrollindicator.qml @@ -1,12 +1,4 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - ScrollIndicator { - id: scrollindicator - objectName: "scrollindicator" - } -} +ScrollIndicator { } diff --git a/tests/auto/accessibility/data/slider.qml b/tests/auto/accessibility/data/slider.qml index 060bb66c..775ce7d0 100644 --- a/tests/auto/accessibility/data/slider.qml +++ b/tests/auto/accessibility/data/slider.qml @@ -1,17 +1,10 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - Slider { - id: slider - objectName: "slider" - from: 0 - to: 100 - value: 50 - stepSize: 1 - orientation: "Horizontal" - } +Slider { + from: 0 + to: 100 + value: 50 + stepSize: 1 + orientation: Qt.Horizontal } diff --git a/tests/auto/accessibility/data/spinbox.qml b/tests/auto/accessibility/data/spinbox.qml index 9d29bccc..029cbc65 100644 --- a/tests/auto/accessibility/data/spinbox.qml +++ b/tests/auto/accessibility/data/spinbox.qml @@ -1,16 +1,9 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - SpinBox { - id: spinbox - objectName: "spinbox" - from: 0 - to: 100 - value: 50 - stepSize: 1 - } +SpinBox { + from: 0 + to: 100 + value: 50 + stepSize: 1 } diff --git a/tests/auto/accessibility/data/switch.qml b/tests/auto/accessibility/data/switch.qml index 9913e3f1..8bb43893 100644 --- a/tests/auto/accessibility/data/switch.qml +++ b/tests/auto/accessibility/data/switch.qml @@ -1,13 +1,6 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - Switch { - //id: switch - objectName: "switch" - text: "Switch" - } +Switch { + text: "Switch" } diff --git a/tests/auto/accessibility/data/switchdelegate.qml b/tests/auto/accessibility/data/switchdelegate.qml index ae9b95f1..9f2324c0 100644 --- a/tests/auto/accessibility/data/switchdelegate.qml +++ b/tests/auto/accessibility/data/switchdelegate.qml @@ -1,13 +1,6 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - SwitchDelegate { - id: switchdelegate - objectName: "switchdelegate" - text: "SwitchDelegate" - } +SwitchDelegate { + text: "SwitchDelegate" } diff --git a/tests/auto/accessibility/data/tabbar.qml b/tests/auto/accessibility/data/tabbar.qml index 127c4e81..4b1f73a1 100644 --- a/tests/auto/accessibility/data/tabbar.qml +++ b/tests/auto/accessibility/data/tabbar.qml @@ -1,12 +1,4 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - TabBar { - id: tabbar - objectName: "tabbar" - } -} +TabBar { } diff --git a/tests/auto/accessibility/data/tabbutton.qml b/tests/auto/accessibility/data/tabbutton.qml index cfb04ca2..6b979bc8 100644 --- a/tests/auto/accessibility/data/tabbutton.qml +++ b/tests/auto/accessibility/data/tabbutton.qml @@ -1,17 +1,6 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - TabBar { - id: tabbar - objectName: "TabBar" - TabButton { - id: tabbutton - objectName: "tabbutton" - text: "TabButton" - } - } +TabButton { + text: "TabButton" } diff --git a/tests/auto/accessibility/data/textarea.qml b/tests/auto/accessibility/data/textarea.qml index 381c08bd..93b5b220 100644 --- a/tests/auto/accessibility/data/textarea.qml +++ b/tests/auto/accessibility/data/textarea.qml @@ -1,13 +1,6 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - TextArea { - id: textarea - objectName: "textarea" - text: "TextArea" - } +TextArea { + text: "TextArea" } diff --git a/tests/auto/accessibility/data/textfield.qml b/tests/auto/accessibility/data/textfield.qml index 5db46d82..06ba1a58 100644 --- a/tests/auto/accessibility/data/textfield.qml +++ b/tests/auto/accessibility/data/textfield.qml @@ -1,13 +1,6 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - TextField { - id: textfield - objectName: "textfield" - text: "TextField" - } +TextField { + text: "TextField" } diff --git a/tests/auto/accessibility/data/toolbar.qml b/tests/auto/accessibility/data/toolbar.qml index c0503aef..7b3ba07f 100644 --- a/tests/auto/accessibility/data/toolbar.qml +++ b/tests/auto/accessibility/data/toolbar.qml @@ -1,12 +1,4 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - ToolBar { - id: toolbar - objectName: "toolbar" - } -} +ToolBar { } diff --git a/tests/auto/accessibility/data/toolbutton.qml b/tests/auto/accessibility/data/toolbutton.qml index 63aacddc..79f155ec 100644 --- a/tests/auto/accessibility/data/toolbutton.qml +++ b/tests/auto/accessibility/data/toolbutton.qml @@ -1,13 +1,6 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - ToolButton { - id: toolbutton - objectName: "toolbutton" - text: "ToolButton" - } +ToolButton { + text: "ToolButton" } diff --git a/tests/auto/accessibility/data/tooltip.qml b/tests/auto/accessibility/data/tooltip.qml index 4a2f16b5..1d1bae28 100644 --- a/tests/auto/accessibility/data/tooltip.qml +++ b/tests/auto/accessibility/data/tooltip.qml @@ -1,13 +1,6 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import QtQuick.Controls 2.0 -Window { - visible: true - - ToolTip { - id: tooltip - objectName: "tooltip" - text: "ToolTip" - } +ToolTip { + text: "ToolTip" } diff --git a/tests/auto/accessibility/data/weeknumbercolumn-2.qml b/tests/auto/accessibility/data/weeknumbercolumn-2.qml index bc3b1739..7d682315 100644 --- a/tests/auto/accessibility/data/weeknumbercolumn-2.qml +++ b/tests/auto/accessibility/data/weeknumbercolumn-2.qml @@ -1,12 +1,4 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import Qt.labs.calendar 1.0 -Window { - visible: true - - WeekNumberColumn { - id: weeknumbercolumn - objectName: "weeknumbercolumn" - } -} +WeekNumberColumn { } diff --git a/tests/auto/accessibility/data/weeknumbercolumn.qml b/tests/auto/accessibility/data/weeknumbercolumn.qml index 7fadb5da..6b024872 100644 --- a/tests/auto/accessibility/data/weeknumbercolumn.qml +++ b/tests/auto/accessibility/data/weeknumbercolumn.qml @@ -1,13 +1,6 @@ import QtQuick 2.5 -import QtQuick.Window 2.2 import Qt.labs.calendar 1.0 -Window { - visible: true - - WeekNumberColumn { - id: weeknumbercolumn - objectName: "weeknumbercolumn" - Accessible.name: "WeekNumberColumn" - } +WeekNumberColumn { + Accessible.name: "WeekNumberColumn" } diff --git a/tests/auto/accessibility/tst_accessibility.cpp b/tests/auto/accessibility/tst_accessibility.cpp index c1c9cb25..1086c17e 100644 --- a/tests/auto/accessibility/tst_accessibility.cpp +++ b/tests/auto/accessibility/tst_accessibility.cpp @@ -34,27 +34,21 @@ ** ****************************************************************************/ -#include -#include +#include #include #include #include -#include #include #include #include "../shared/util.h" -#include "../shared/visualtestutil.h" #ifndef QT_NO_ACCESSIBILITY #include #endif -using namespace QQuickVisualTestUtil; - class tst_accessibility : public QQmlDataTest { Q_OBJECT -public: private slots: void a11y_data(); @@ -127,7 +121,6 @@ void tst_accessibility::a11y() QFETCH(int, role); QFETCH(QString, text); - QQmlComponent component(&engine); QString fn = name; #ifdef QT_NO_ACCESSIBILITY if (name == QLatin1Literal("dayofweekrow") @@ -135,20 +128,16 @@ void tst_accessibility::a11y() || name == QLatin1Literal("weeknumbercolumn")) fn += QLatin1Literal("-2"); #endif + + QQmlComponent component(&engine); component.loadUrl(testFileUrl(fn + ".qml")); - QObject* created = component.create(); - QVERIFY2(created, qPrintable(component.errorString())); - QScopedPointer cleanup(created); - QVERIFY(!cleanup.isNull()); - QQuickWindow* window = qobject_cast(created); - QVERIFY(window); - window->show(); - QVERIFY(QTest::qWaitForWindowActive(window)); + QScopedPointer object(component.create()); + QVERIFY2(!object.isNull(), qPrintable(component.errorString())); - QQuickItem *item = findItem(window->contentItem(), name); + QQuickItem *item = qobject_cast(object.data()); if (!item) { - QQuickPopup *popup = window->contentItem()->findChild(name); + QQuickPopup *popup = qobject_cast(object.data()); if (popup) item = popup->popupItem(); } -- cgit v1.2.3 From 359b307398100ec4a7c427ad55f669fd36e4331d Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 1 Nov 2016 14:44:00 +0100 Subject: Doc: show the non-wrapping Dial GIF in the detailed description There was no screenshot in the detailed description. This helps to see right away what kind of control it is. Change-Id: I0ecc585a5e6f650112e88bb3b37a2f5140d41261 Task-number: QTBUG-55904 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickdial.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/quicktemplates2/qquickdial.cpp b/src/quicktemplates2/qquickdial.cpp index 48d02faa..abce2e33 100644 --- a/src/quicktemplates2/qquickdial.cpp +++ b/src/quicktemplates2/qquickdial.cpp @@ -55,6 +55,8 @@ QT_BEGIN_NAMESPACE such as stereos or industrial equipment. It allows the user to specify a value within a range. + \image qtquickcontrols2-dial-no-wrap.gif + The value of the dial is set with the \l value property. The range is set with the \l from and \l to properties. To enable or disable wrapping, use the \l wrap property. -- cgit v1.2.3 From ac53939d496c2b3802f785d2bdf0047ecad7f876 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 1 Nov 2016 16:36:28 +0100 Subject: Doc: BusyIndicator vs. indeterminate ProgressBar Change-Id: I48bb051bdfe18923749f71f9f0be39a0361723f5 Task-number: QTBUG-55904 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickbusyindicator.cpp | 12 ++++++++++++ src/quicktemplates2/qquickprogressbar.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/quicktemplates2/qquickbusyindicator.cpp b/src/quicktemplates2/qquickbusyindicator.cpp index 73181ec7..dc7acbd4 100644 --- a/src/quicktemplates2/qquickbusyindicator.cpp +++ b/src/quicktemplates2/qquickbusyindicator.cpp @@ -61,6 +61,18 @@ QT_BEGIN_NAMESPACE } \endqml + BusyIndicator is similar to an indeterminate \l ProgressBar. Both can be + used to indicate background activity. The main difference is visual, and + that ProgressBar can also present a concrete amount of progress (when it + can be determined). Due to the visual difference, busy indicators and + indeterminate progress bars fit different places in user interfaces. + Typical places for a busy indicator: + \list + \li in the corner of a \l ToolBar + \li as an overlay on top of a \l Page + \li on the side of an \l ItemDelegate + \endlist + \sa {Customizing BusyIndicator}, {Indicator Controls}, ProgressBar */ diff --git a/src/quicktemplates2/qquickprogressbar.cpp b/src/quicktemplates2/qquickprogressbar.cpp index 7bf30318..5d5503e6 100644 --- a/src/quicktemplates2/qquickprogressbar.cpp +++ b/src/quicktemplates2/qquickprogressbar.cpp @@ -59,6 +59,30 @@ QT_BEGIN_NAMESPACE } \endcode + ProgressBar also supports a special \l indeterminate mode, which is useful, + for example, when unable to determine the size of the item being downloaded, + or if the download progress gets interrupted due to a network disconnection. + + \image qtquickcontrols2-progressbar-indeterminate.gif + + \code + ProgressBar { + indeterminate: true + } + \endcode + + The indeterminate mode is similar to a \l BusyIndicator. Both can be used + to indicate background activity. The main difference is visual, and that + ProgressBar can also present a concrete amount of progress (when it can be + determined). Due to the visual difference, indeterminate progress bars and + busy indicators fit different places in user interfaces. Typical places for + an indeterminate progress bar: + \list + \li at the bottom of a \l ToolBar + \li inline within the content of a \l Page + \li in an \l ItemDelegate to show the progress of a particular item + \endlist + \sa {Customizing ProgressBar}, BusyIndicator, {Indicator Controls} */ -- cgit v1.2.3 From 43419084fe3c7489adcca3307b2643f70bd7094c Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 2 Nov 2016 11:09:35 +0100 Subject: Doc: revise brief descriptions Change-Id: If7bdd4c11aaeb2df87622c769b1a65ac82ac7e73 Task-number: QTBUG-55904 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquickabstractbutton.cpp | 2 +- src/quicktemplates2/qquickapplicationwindow.cpp | 2 +- src/quicktemplates2/qquickbusyindicator.cpp | 2 +- src/quicktemplates2/qquickbutton.cpp | 2 +- src/quicktemplates2/qquickbuttongroup.cpp | 2 +- src/quicktemplates2/qquickcheckbox.cpp | 2 +- src/quicktemplates2/qquickcheckdelegate.cpp | 2 +- src/quicktemplates2/qquickcombobox.cpp | 2 +- src/quicktemplates2/qquickcontainer.cpp | 2 +- src/quicktemplates2/qquickcontrol.cpp | 2 +- src/quicktemplates2/qquickdial.cpp | 2 +- src/quicktemplates2/qquickdrawer.cpp | 2 +- src/quicktemplates2/qquickframe.cpp | 2 +- src/quicktemplates2/qquickgroupbox.cpp | 2 +- src/quicktemplates2/qquickitemdelegate.cpp | 2 +- src/quicktemplates2/qquicklabel.cpp | 2 +- src/quicktemplates2/qquickmenu.cpp | 2 +- src/quicktemplates2/qquickmenuitem.cpp | 2 +- src/quicktemplates2/qquickpage.cpp | 2 +- src/quicktemplates2/qquickpopup.cpp | 2 +- src/quicktemplates2/qquickradiobutton.cpp | 2 +- src/quicktemplates2/qquickradiodelegate.cpp | 2 +- src/quicktemplates2/qquickrangeslider.cpp | 2 +- src/quicktemplates2/qquickscrollbar.cpp | 2 +- src/quicktemplates2/qquickscrollindicator.cpp | 2 +- src/quicktemplates2/qquickslider.cpp | 2 +- src/quicktemplates2/qquickspinbox.cpp | 2 +- src/quicktemplates2/qquickswipedelegate.cpp | 2 +- src/quicktemplates2/qquickswitch.cpp | 2 +- src/quicktemplates2/qquickswitchdelegate.cpp | 2 +- src/quicktemplates2/qquicktabbar.cpp | 2 +- src/quicktemplates2/qquicktabbutton.cpp | 2 +- src/quicktemplates2/qquicktextarea.cpp | 2 +- src/quicktemplates2/qquicktextfield.cpp | 2 +- src/quicktemplates2/qquicktoolbar.cpp | 2 +- src/quicktemplates2/qquicktoolbutton.cpp | 2 +- src/quicktemplates2/qquicktumbler.cpp | 2 +- 37 files changed, 37 insertions(+), 37 deletions(-) diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp index 7e8c6ced..d922cfb1 100644 --- a/src/quicktemplates2/qquickabstractbutton.cpp +++ b/src/quicktemplates2/qquickabstractbutton.cpp @@ -56,7 +56,7 @@ static const int AUTO_REPEAT_INTERVAL = 100; \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-buttons - \brief Base type of all button controls. + \brief Abstract base type providing functionality common to buttons. AbstractButton provides the interface for controls with button-like behavior; for example, push buttons and checkable controls like diff --git a/src/quicktemplates2/qquickapplicationwindow.cpp b/src/quicktemplates2/qquickapplicationwindow.cpp index f70a6fc1..3a454353 100644 --- a/src/quicktemplates2/qquickapplicationwindow.cpp +++ b/src/quicktemplates2/qquickapplicationwindow.cpp @@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-containers - \brief Provides a top-level application window. + \brief Styled top-level window with support for a header and footer. ApplicationWindow is a \l Window which makes it convenient to add a \l header and \l footer item to the window. diff --git a/src/quicktemplates2/qquickbusyindicator.cpp b/src/quicktemplates2/qquickbusyindicator.cpp index dc7acbd4..2cd3f62d 100644 --- a/src/quicktemplates2/qquickbusyindicator.cpp +++ b/src/quicktemplates2/qquickbusyindicator.cpp @@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-indicators - \brief Indicates activity while content is being loaded. + \brief Indicates background activity, for example, while content is being loaded. \image qtquickcontrols2-busyindicator.gif diff --git a/src/quicktemplates2/qquickbutton.cpp b/src/quicktemplates2/qquickbutton.cpp index fc34aba4..ca6d4551 100644 --- a/src/quicktemplates2/qquickbutton.cpp +++ b/src/quicktemplates2/qquickbutton.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-buttons - \brief A push-button control that can be clicked by the user. + \brief Push-button that can be clicked to perform a command or answer a question. \image qtquickcontrols2-button.gif diff --git a/src/quicktemplates2/qquickbuttongroup.cpp b/src/quicktemplates2/qquickbuttongroup.cpp index 3d3e9c05..6ed75a2b 100644 --- a/src/quicktemplates2/qquickbuttongroup.cpp +++ b/src/quicktemplates2/qquickbuttongroup.cpp @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup utilities - \brief A mutually-exclusive group of checkable controls. + \brief Mutually-exclusive group of checkable buttons. ButtonGroup is a non-visual, mutually exclusive group of buttons. It is used with controls such as RadioButton, where only one of the options diff --git a/src/quicktemplates2/qquickcheckbox.cpp b/src/quicktemplates2/qquickcheckbox.cpp index ae967c34..fd5ab6ba 100644 --- a/src/quicktemplates2/qquickcheckbox.cpp +++ b/src/quicktemplates2/qquickcheckbox.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-buttons - \brief An option button that can be checked or unchecked. + \brief Check button that can be toggled on or off. \image qtquickcontrols2-checkbox.gif diff --git a/src/quicktemplates2/qquickcheckdelegate.cpp b/src/quicktemplates2/qquickcheckdelegate.cpp index 304d2b6c..51bc8501 100644 --- a/src/quicktemplates2/qquickcheckdelegate.cpp +++ b/src/quicktemplates2/qquickcheckdelegate.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-delegates - \brief An item delegate that can be checked or unchecked. + \brief Item delegate with a check indicator that can be toggled on or off. \image qtquickcontrols2-checkdelegate.gif diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp index 5194582b..442c43a4 100644 --- a/src/quicktemplates2/qquickcombobox.cpp +++ b/src/quicktemplates2/qquickcombobox.cpp @@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-input - \brief A combined button and popup list taking minimal space. + \brief Combined button and popup list for selecting options. \image qtquickcontrols2-combobox.gif diff --git a/src/quicktemplates2/qquickcontainer.cpp b/src/quicktemplates2/qquickcontainer.cpp index be2acf39..c95cfc75 100644 --- a/src/quicktemplates2/qquickcontainer.cpp +++ b/src/quicktemplates2/qquickcontainer.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-containers - \brief A container control base type. + \brief Abstract base type providing functionality common to containers. Container is the base type of container-like user interface controls that allow dynamic insertion and removal of items. diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp index f18483e7..cb891ee9 100644 --- a/src/quicktemplates2/qquickcontrol.cpp +++ b/src/quicktemplates2/qquickcontrol.cpp @@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE \instantiates QQuickControl \inqmlmodule QtQuick.Controls \since 5.7 - \brief The base type of user interface controls. + \brief Abstract base type providing functionality common to all controls. Control is the base type of user interface controls. It receives input events from the window system, and paints a representation of itself on diff --git a/src/quicktemplates2/qquickdial.cpp b/src/quicktemplates2/qquickdial.cpp index abce2e33..22c1133b 100644 --- a/src/quicktemplates2/qquickdial.cpp +++ b/src/quicktemplates2/qquickdial.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-input - \brief A circular dial that is rotated to set a value. + \brief Circular dial that is rotated to set a value. The Dial is similar to a traditional dial knob that is found on devices such as stereos or industrial equipment. It allows the user to specify a diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp index d210c015..1dae911e 100644 --- a/src/quicktemplates2/qquickdrawer.cpp +++ b/src/quicktemplates2/qquickdrawer.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE \since 5.7 \ingroup qtquickcontrols2-navigation \ingroup qtquickcontrols2-popups - \brief Provides a swipe-based side panel. + \brief Side panel that can be opened and closed using a swipe gesture. Drawer provides a swipe-based side panel, similar to those often used in touch interfaces to provide a central location for navigation. diff --git a/src/quicktemplates2/qquickframe.cpp b/src/quicktemplates2/qquickframe.cpp index d51ea60a..9deef6be 100644 --- a/src/quicktemplates2/qquickframe.cpp +++ b/src/quicktemplates2/qquickframe.cpp @@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-containers - \brief A logical group of controls within a visual frame. + \brief Visual frame for a logical group of controls. Frame is used to layout a logical group of controls together within a visual frame. Frame does not provide a layout of its own, but requires diff --git a/src/quicktemplates2/qquickgroupbox.cpp b/src/quicktemplates2/qquickgroupbox.cpp index 996351a7..dd6d1883 100644 --- a/src/quicktemplates2/qquickgroupbox.cpp +++ b/src/quicktemplates2/qquickgroupbox.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-containers - \brief A logical group of controls within a titled visual frame. + \brief Visual frame and title for a logical group of controls. GroupBox is used to layout a logical group of controls together, within a \l {title}{titled} visual frame. GroupBox does not provide a layout of its own, but diff --git a/src/quicktemplates2/qquickitemdelegate.cpp b/src/quicktemplates2/qquickitemdelegate.cpp index 9b21eb30..411cb224 100644 --- a/src/quicktemplates2/qquickitemdelegate.cpp +++ b/src/quicktemplates2/qquickitemdelegate.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE \instantiates QQuickItemDelegate \inqmlmodule QtQuick.Controls \since 5.7 - \brief A standard view item that can be used in various views and controls. + \brief Basic item delegate that can be used in various views and controls. \image qtquickcontrols2-itemdelegate.gif diff --git a/src/quicktemplates2/qquicklabel.cpp b/src/quicktemplates2/qquicklabel.cpp index b3596022..ebd1755a 100644 --- a/src/quicktemplates2/qquicklabel.cpp +++ b/src/quicktemplates2/qquicklabel.cpp @@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup text - \brief A text label with inherited styling and font. + \brief Styled text label with inherited font. Label extends \l Text with styling and \l {Control::font}{font} inheritance. The default colors and font are style specific. Label diff --git a/src/quicktemplates2/qquickmenu.cpp b/src/quicktemplates2/qquickmenu.cpp index 509a4022..2203e574 100644 --- a/src/quicktemplates2/qquickmenu.cpp +++ b/src/quicktemplates2/qquickmenu.cpp @@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE \since 5.7 \ingroup qtquickcontrols2-menus \ingroup qtquickcontrols2-popups - \brief A menu control that can be used as a context menu or popup menu. + \brief Menu popup that can be used as a context menu or popup menu. \image qtquickcontrols2-menu.png diff --git a/src/quicktemplates2/qquickmenuitem.cpp b/src/quicktemplates2/qquickmenuitem.cpp index 902889b0..564d3f38 100644 --- a/src/quicktemplates2/qquickmenuitem.cpp +++ b/src/quicktemplates2/qquickmenuitem.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-menus - \brief A menu item within a Menu. + \brief Presents an item within a Menu. MenuItem is a convenience type that implements the AbstractButton API, providing a familiar way to respond to menu items being \l triggered, for diff --git a/src/quicktemplates2/qquickpage.cpp b/src/quicktemplates2/qquickpage.cpp index a0de71db..c71ecd42 100644 --- a/src/quicktemplates2/qquickpage.cpp +++ b/src/quicktemplates2/qquickpage.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-containers - \brief A control that makes it convenient to add a header and footer to a page. + \brief Styled page control with support for a header and footer. Page is a container control which makes it convenient to add a \l header and \l footer item to a page. diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp index 10657e90..21303ffe 100644 --- a/src/quicktemplates2/qquickpopup.cpp +++ b/src/quicktemplates2/qquickpopup.cpp @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-popups - \brief The base type of popup-like user interface controls. + \brief Base type of popup-like user interface controls. Popup is the base type of popup-like user interface controls. It can be used with \l Window or \l ApplicationWindow. diff --git a/src/quicktemplates2/qquickradiobutton.cpp b/src/quicktemplates2/qquickradiobutton.cpp index a8d11377..acddb50d 100644 --- a/src/quicktemplates2/qquickradiobutton.cpp +++ b/src/quicktemplates2/qquickradiobutton.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-buttons - \brief An option button that can be toggled on or off. + \brief Exclusive radio button that can be toggled on or off. \image qtquickcontrols2-radiobutton.gif diff --git a/src/quicktemplates2/qquickradiodelegate.cpp b/src/quicktemplates2/qquickradiodelegate.cpp index bf3557e8..4580dcf2 100644 --- a/src/quicktemplates2/qquickradiodelegate.cpp +++ b/src/quicktemplates2/qquickradiodelegate.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-delegates - \brief An item delegate that can be checked or unchecked. + \brief Exclusive item delegate with a radio indicator that can be toggled on or off. \image qtquickcontrols2-radiodelegate.gif diff --git a/src/quicktemplates2/qquickrangeslider.cpp b/src/quicktemplates2/qquickrangeslider.cpp index 316efb31..17871cfe 100644 --- a/src/quicktemplates2/qquickrangeslider.cpp +++ b/src/quicktemplates2/qquickrangeslider.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-input - \brief A slider control used to select a range of values. + \brief Used to select a range of values by sliding two handles along a track. \image qtquickcontrols2-rangeslider.gif diff --git a/src/quicktemplates2/qquickscrollbar.cpp b/src/quicktemplates2/qquickscrollbar.cpp index d3a2355c..5d921fe3 100644 --- a/src/quicktemplates2/qquickscrollbar.cpp +++ b/src/quicktemplates2/qquickscrollbar.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-indicators - \brief An interactive scroll bar control. + \brief Vertical or horizontal interactive scroll bar. \image qtquickcontrols2-scrollbar.gif diff --git a/src/quicktemplates2/qquickscrollindicator.cpp b/src/quicktemplates2/qquickscrollindicator.cpp index 91d03ec9..968f671d 100644 --- a/src/quicktemplates2/qquickscrollindicator.cpp +++ b/src/quicktemplates2/qquickscrollindicator.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-indicators - \brief A non-interactive scroll indicator control. + \brief Vertical or horizontal non-interactive scroll indicator. \image qtquickcontrols2-scrollindicator.gif diff --git a/src/quicktemplates2/qquickslider.cpp b/src/quicktemplates2/qquickslider.cpp index e0df7e69..e403aa6d 100644 --- a/src/quicktemplates2/qquickslider.cpp +++ b/src/quicktemplates2/qquickslider.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-input - \brief Selects a value by sliding a handle along a track. + \brief Used to select a value by sliding a handle along a track. \image qtquickcontrols2-slider.gif diff --git a/src/quicktemplates2/qquickspinbox.cpp b/src/quicktemplates2/qquickspinbox.cpp index 466f1b89..79ec5da0 100644 --- a/src/quicktemplates2/qquickspinbox.cpp +++ b/src/quicktemplates2/qquickspinbox.cpp @@ -57,7 +57,7 @@ static const int AUTO_REPEAT_INTERVAL = 100; \inqmlmodule QtQuick.Controls \since 5.7 \ingroup input - \brief A spinbox control that allows the user to select from a set of preset values. + \brief Allows the user to select from a set of preset values. \image qtquickcontrols2-spinbox.png diff --git a/src/quicktemplates2/qquickswipedelegate.cpp b/src/quicktemplates2/qquickswipedelegate.cpp index b812f939..3dec1f2e 100644 --- a/src/quicktemplates2/qquickswipedelegate.cpp +++ b/src/quicktemplates2/qquickswipedelegate.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-delegates - \brief A swipable item delegate. + \brief Swipable item delegate. SwipeDelegate presents a view item that can be swiped left or right to expose more options or information. It is used as a delegate in views such diff --git a/src/quicktemplates2/qquickswitch.cpp b/src/quicktemplates2/qquickswitch.cpp index 8c3d9f0b..fa08a1d8 100644 --- a/src/quicktemplates2/qquickswitch.cpp +++ b/src/quicktemplates2/qquickswitch.cpp @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-buttons - \brief An option button that can be toggled on or off. + \brief Switch button that can be toggled on or off. \image qtquickcontrols2-switch.gif diff --git a/src/quicktemplates2/qquickswitchdelegate.cpp b/src/quicktemplates2/qquickswitchdelegate.cpp index edfb15d5..81e282d9 100644 --- a/src/quicktemplates2/qquickswitchdelegate.cpp +++ b/src/quicktemplates2/qquickswitchdelegate.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-delegates - \brief An item delegate that can be toggled on or off. + \brief Item delegate with a switch indicator that can be toggled on or off. \image qtquickcontrols2-switchdelegate.gif diff --git a/src/quicktemplates2/qquicktabbar.cpp b/src/quicktemplates2/qquicktabbar.cpp index 73c7734c..ee3436f9 100644 --- a/src/quicktemplates2/qquicktabbar.cpp +++ b/src/quicktemplates2/qquicktabbar.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE \since 5.7 \ingroup qtquickcontrols2-navigation \ingroup qtquickcontrols2-containers - \brief A bar with tabs that allows the user to switch between different views or subtasks. + \brief Allows the user to switch between different views or subtasks. TabBar provides a tab-based navigation model. diff --git a/src/quicktemplates2/qquicktabbutton.cpp b/src/quicktemplates2/qquicktabbutton.cpp index 3f097947..b5cbdd12 100644 --- a/src/quicktemplates2/qquicktabbutton.cpp +++ b/src/quicktemplates2/qquicktabbutton.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-navigation - \brief A tab button control that can be used in a TabBar. + \brief Button with a look suitable for a TabBar. \image qtquickcontrols2-tabbutton.png diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp index ee20d477..a66d7bf5 100644 --- a/src/quicktemplates2/qquicktextarea.cpp +++ b/src/quicktemplates2/qquicktextarea.cpp @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-input - \brief A multi line text input control. + \brief Multi-line text input area. TextArea is a multi-line text editor. TextArea extends TextEdit with a \l {placeholderText}{placeholder text} functionality, and adds decoration. diff --git a/src/quicktemplates2/qquicktextfield.cpp b/src/quicktemplates2/qquicktextfield.cpp index 7882b642..610df907 100644 --- a/src/quicktemplates2/qquicktextfield.cpp +++ b/src/quicktemplates2/qquicktextfield.cpp @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-input - \brief A single line text input control. + \brief Single-line text input field. TextField is a single line text editor. TextField extends TextInput with a \l {placeholderText}{placeholder text} functionality, and adds decoration. diff --git a/src/quicktemplates2/qquicktoolbar.cpp b/src/quicktemplates2/qquicktoolbar.cpp index e6d705ad..12ecb702 100644 --- a/src/quicktemplates2/qquicktoolbar.cpp +++ b/src/quicktemplates2/qquicktoolbar.cpp @@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-containers - \brief A container for context-sensitive controls. + \brief Container for context-sensitive controls. ToolBar is a container of application-wide and context sensitive actions and controls, such as navigation buttons and search fields. diff --git a/src/quicktemplates2/qquicktoolbutton.cpp b/src/quicktemplates2/qquicktoolbutton.cpp index 8009ac28..e8827b4c 100644 --- a/src/quicktemplates2/qquicktoolbutton.cpp +++ b/src/quicktemplates2/qquicktoolbutton.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-buttons - \brief A button with a look suitable for a ToolBar. + \brief Button with a look suitable for a ToolBar. ToolButton is functionally similar to \l Button, but provides a look that is more suitable within a \l ToolBar. diff --git a/src/quicktemplates2/qquicktumbler.cpp b/src/quicktemplates2/qquicktumbler.cpp index ba026571..9f19f661 100644 --- a/src/quicktemplates2/qquicktumbler.cpp +++ b/src/quicktemplates2/qquicktumbler.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE \inqmlmodule QtQuick.Controls \since 5.7 \ingroup qtquickcontrols2-input - \brief A spinnable wheel of items that can be selected. + \brief Spinnable wheel of items that can be selected. \image qtquickcontrols2-tumbler-wrap.gif -- cgit v1.2.3 From 814601e9cdf5895152cedcd1968fd2a4eecd3cd3 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 2 Nov 2016 11:26:08 +0100 Subject: Doc: tweak BusyIndicator's GIF Make it running at start to ensure that the first frame serves as a good screenshot. When GIF animations were disabled (Qt Creator), the first frame was empty. Change-Id: I2a0acf0cf428a0175c141a7841ec327bc15dfade Task-number: QTBUG-55904 Reviewed-by: Mitch Curtis --- .../doc/images/qtquickcontrols2-busyindicator.gif | Bin 3241 -> 17357 bytes .../gifs/data/qtquickcontrols2-busyindicator.qml | 2 +- tests/manual/gifs/tst_gifs.cpp | 8 ++++---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/imports/controls/doc/images/qtquickcontrols2-busyindicator.gif b/src/imports/controls/doc/images/qtquickcontrols2-busyindicator.gif index 31ab2d1c..653d200f 100644 Binary files a/src/imports/controls/doc/images/qtquickcontrols2-busyindicator.gif and b/src/imports/controls/doc/images/qtquickcontrols2-busyindicator.gif differ diff --git a/tests/manual/gifs/data/qtquickcontrols2-busyindicator.qml b/tests/manual/gifs/data/qtquickcontrols2-busyindicator.qml index f4a51afb..5c655cab 100644 --- a/tests/manual/gifs/data/qtquickcontrols2-busyindicator.qml +++ b/tests/manual/gifs/data/qtquickcontrols2-busyindicator.qml @@ -51,7 +51,7 @@ Window { BusyIndicator { id: busyIndicator - running: false + running: true anchors.centerIn: parent } } diff --git a/tests/manual/gifs/tst_gifs.cpp b/tests/manual/gifs/tst_gifs.cpp index 5cb1f109..d3fb5f6d 100644 --- a/tests/manual/gifs/tst_gifs.cpp +++ b/tests/manual/gifs/tst_gifs.cpp @@ -352,7 +352,7 @@ void tst_Gifs::busyIndicator() GifRecorder gifRecorder; gifRecorder.setDataDirPath(dataDirPath); gifRecorder.setOutputDir(outputDir); - gifRecorder.setRecordingDuration(3); + gifRecorder.setRecordingDuration(6); gifRecorder.setHighQuality(true); gifRecorder.setQmlFileName("qtquickcontrols2-busyindicator.qml"); @@ -360,17 +360,17 @@ void tst_Gifs::busyIndicator() QQuickWindow *window = gifRecorder.window(); // Record nothing for a bit to make it smoother. - QTest::qWait(400); + QTest::qWait(800 * 2); QQuickItem *busyIndicator = window->property("busyIndicator").value(); QVERIFY(busyIndicator); - busyIndicator->setProperty("running", true); + busyIndicator->setProperty("running", false); // 800 ms is the duration of one rotation animation cycle for BusyIndicator. QTest::qWait(800 * 2); - busyIndicator->setProperty("running", false); + busyIndicator->setProperty("running", true); gifRecorder.waitForFinish(); } -- cgit v1.2.3