diff options
17 files changed, 109 insertions, 169 deletions
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkbox.gif b/src/imports/controls/doc/images/qtquickcontrols2-checkbox.gif Binary files differindex beacdb37..d70c0ee4 100644 --- a/src/imports/controls/doc/images/qtquickcontrols2-checkbox.gif +++ b/src/imports/controls/doc/images/qtquickcontrols2-checkbox.gif diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkbox.png b/src/imports/controls/doc/images/qtquickcontrols2-checkbox.png Binary files differdeleted file mode 100644 index a824949c..00000000 --- a/src/imports/controls/doc/images/qtquickcontrols2-checkbox.png +++ /dev/null diff --git a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-checked.png b/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-checked.png Binary files differdeleted file mode 100644 index d22a595b..00000000 --- a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-checked.png +++ /dev/null diff --git a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-disabled.png b/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-disabled.png Binary files differdeleted file mode 100644 index 11a99d6f..00000000 --- a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-disabled.png +++ /dev/null diff --git a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-focused.png b/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-focused.png Binary files differdeleted file mode 100644 index d7c79ed1..00000000 --- a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-focused.png +++ /dev/null diff --git a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-normal.png b/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-normal.png Binary files differdeleted file mode 100644 index 8a49bf58..00000000 --- a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-normal.png +++ /dev/null diff --git a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton.gif b/src/imports/controls/doc/images/qtquickcontrols2-radiobutton.gif Binary files differnew file mode 100644 index 00000000..4cbf3ed9 --- /dev/null +++ b/src/imports/controls/doc/images/qtquickcontrols2-radiobutton.gif diff --git a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton.png b/src/imports/controls/doc/images/qtquickcontrols2-radiobutton.png Binary files differdeleted file mode 100644 index 6c217968..00000000 --- a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton.png +++ /dev/null diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-checked.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-checked.qml deleted file mode 100644 index c1b1acce..00000000 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-checked.qml +++ /dev/null @@ -1,34 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -RadioButton { - text: "Checked" - checked: true -} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-disabled.qml deleted file mode 100644 index 7ab68910..00000000 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-disabled.qml +++ /dev/null @@ -1,34 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -RadioButton { - text: "Disabled" - enabled: false -} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-focused.qml deleted file mode 100644 index 316a4653..00000000 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-focused.qml +++ /dev/null @@ -1,34 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -RadioButton { - text: "Focused" - focus: true -} diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-normal.qml deleted file mode 100644 index b5ea853b..00000000 --- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-normal.qml +++ /dev/null @@ -1,33 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** 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 Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: http://www.gnu.org/copyleft/fdl.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -RadioButton { - text: "Normal" -} diff --git a/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc index d6a9ac78..5e2c9370 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc @@ -66,7 +66,7 @@ \section1 CheckBox Control - \image qtquickcontrols2-checkbox.png + \image qtquickcontrols2-checkbox.gif \l CheckBox is used to build multi-selection option lists. Any number of options can be selected, including none, but the options should @@ -102,7 +102,7 @@ \section1 RadioButton Control - \image qtquickcontrols2-radiobutton.png + \image qtquickcontrols2-radiobutton.gif \l RadioButton is used to select only one option from a set of options. Selecting one option automatically deselects the one selected before. diff --git a/src/quicktemplates2/qquickradiobutton.cpp b/src/quicktemplates2/qquickradiobutton.cpp index 2aafbfbd..6037ff0d 100644 --- a/src/quicktemplates2/qquickradiobutton.cpp +++ b/src/quicktemplates2/qquickradiobutton.cpp @@ -50,21 +50,12 @@ QT_BEGIN_NAMESPACE \ingroup qtquickcontrols2-buttons \brief An option button that can be toggled on or off. + \image qtquickcontrols2-radiobutton.gif + RadioButton presents an option button that can be toggled on (checked) or off (unchecked). Radio buttons are typically used to select one option from a set of options. - \table - \row \li \image qtquickcontrols2-radiobutton-normal.png - \li A radio button in its normal state. - \row \li \image qtquickcontrols2-radiobutton-checked.png - \li A radio button that is checked. - \row \li \image qtquickcontrols2-radiobutton-focused.png - \li A radio button that has active focus. - \row \li \image qtquickcontrols2-radiobutton-disabled.png - \li A radio button that is disabled. - \endtable - Radio buttons are \l {AbstractButton::autoExclusive}{auto-exclusive} by default. Only one button can be checked at any time amongst radio buttons that belong to the same parent item; checking another button diff --git a/tests/manual/gifs/data/qtquickcontrols2-checkbox.qml b/tests/manual/gifs/data/qtquickcontrols2-checkbox.qml index ef53721d..3195c1c9 100644 --- a/tests/manual/gifs/data/qtquickcontrols2-checkbox.qml +++ b/tests/manual/gifs/data/qtquickcontrols2-checkbox.qml @@ -48,8 +48,8 @@ Window { height: column.implicitHeight visible: true - property alias second: second - property alias third: third + property alias control2: control2 + property alias control3: control3 ColumnLayout { id: column @@ -60,11 +60,11 @@ Window { text: qsTr("First") } CheckBox { - id: second + id: control2 text: qsTr("Second") } CheckBox { - id: third + id: control3 checked: true text: qsTr("Third") } diff --git a/tests/manual/gifs/data/qtquickcontrols2-radiobutton.qml b/tests/manual/gifs/data/qtquickcontrols2-radiobutton.qml new file mode 100644 index 00000000..576668f3 --- /dev/null +++ b/tests/manual/gifs/data/qtquickcontrols2-radiobutton.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** 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.Layouts 1.1 +import QtQuick.Window 2.0 + +Window { + width: column.implicitWidth + height: column.implicitHeight + visible: true + + property alias control1: control1 + property alias control2: control2 + property alias control3: control3 + + ColumnLayout { + id: column + anchors.centerIn: parent + + RadioButton { + id: control1 + text: qsTr("First") + checked: true + } + RadioButton { + id: control2 + text: qsTr("Second") + } + RadioButton { + id: control3 + text: qsTr("Third") + } + } +} diff --git a/tests/manual/gifs/tst_gifs.cpp b/tests/manual/gifs/tst_gifs.cpp index 8da12347..a54dd961 100644 --- a/tests/manual/gifs/tst_gifs.cpp +++ b/tests/manual/gifs/tst_gifs.cpp @@ -65,12 +65,13 @@ private slots: void delegates(); void dial_data(); void dial(); - void checkBox(); void scrollBar(); void progressBar_data(); void progressBar(); void triState_data(); void triState(); + void checkables_data(); + void checkables(); private: void moveSmoothly(QQuickWindow *window, const QPoint &from, const QPoint &to, int movements, @@ -613,30 +614,40 @@ void tst_Gifs::dial() gifRecorder.waitForFinish(); } -void tst_Gifs::checkBox() +void tst_Gifs::checkables_data() { + QTest::addColumn<QString>("name"); + QTest::addColumn<QVector<int> >("pressIndices"); + + QTest::newRow("checkbox") << "checkbox" << (QVector<int>() << 1 << 2 << 2 << 1); + QTest::newRow("radiobutton") << "radiobutton" << (QVector<int>() << 1 << 2 << 1 << 0); +} + +void tst_Gifs::checkables() +{ + QFETCH(QString, name); + QFETCH(QVector<int>, pressIndices); + GifRecorder gifRecorder; gifRecorder.setDataDirPath(dataDirPath); gifRecorder.setOutputDir(outputDir); - gifRecorder.setRecordingDuration(5); - gifRecorder.setQmlFileName("qtquickcontrols2-checkbox.qml"); + gifRecorder.setRecordingDuration(6); + gifRecorder.setQmlFileName(QString::fromLatin1("qtquickcontrols2-%1.qml").arg(name)); gifRecorder.start(); QQuickWindow *window = gifRecorder.window(); - QQuickItem *second = window->property("second").value<QQuickItem*>(); - QVERIFY(second); - QQuickItem *third = window->property("third").value<QQuickItem*>(); - QVERIFY(third); - - QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, - second->mapToScene(QPointF(second->width() / 2, second->height() / 2)).toPoint(), 400); - QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, - third->mapToScene(QPointF(third->width() / 2, third->height() / 2)).toPoint(), 800); - QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, - third->mapToScene(QPointF(third->width() / 2, third->height() / 2)).toPoint(), 800); - QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, - second->mapToScene(QPointF(second->width() / 2, second->height() / 2)).toPoint(), 800); + + for (int i = 0; i < pressIndices.size(); ++i) { + const int pressIndex = pressIndices.at(i); + const char *controlId = qPrintable(QString::fromLatin1("control%1").arg(pressIndex + 1)); + QQuickItem *control = window->property(controlId).value<QQuickItem*>(); + QVERIFY(control); + + const QPoint pos = control->mapToScene(QPointF(control->width() / 2, control->height() / 2)).toPoint(); + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, pos, 800); + QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, pos, 300); + } gifRecorder.waitForFinish(); } |