diff options
-rw-r--r-- | src/imports/controls/doc/images/qtquickcontrols2-checkbox-tristate.gif | bin | 4033 -> 8784 bytes | |||
-rw-r--r-- | src/imports/controls/doc/images/qtquickcontrols2-checkdelegate-tristate.gif | bin | 0 -> 10487 bytes | |||
-rw-r--r-- | src/imports/controls/doc/images/qtquickcontrols2-checkdelegate.gif | bin | 14330 -> 15290 bytes | |||
-rw-r--r-- | src/imports/controls/doc/images/qtquickcontrols2-itemdelegate.gif | bin | 14448 -> 16287 bytes | |||
-rw-r--r-- | src/imports/controls/doc/images/qtquickcontrols2-radiodelegate.gif | bin | 16357 -> 16859 bytes | |||
-rw-r--r-- | src/quicktemplates2/qquickcheckdelegate.cpp | 4 | ||||
-rw-r--r-- | tests/manual/gifs/data/qtquickcontrols2-checkdelegate-tristate.qml | 81 | ||||
-rw-r--r-- | tests/manual/gifs/tst_gifs.cpp | 40 |
8 files changed, 114 insertions, 11 deletions
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-tristate.gif b/src/imports/controls/doc/images/qtquickcontrols2-checkbox-tristate.gif Binary files differindex 50986f1b..56a15867 100644 --- a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-tristate.gif +++ b/src/imports/controls/doc/images/qtquickcontrols2-checkbox-tristate.gif diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate-tristate.gif b/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate-tristate.gif Binary files differnew file mode 100644 index 00000000..8d058d6c --- /dev/null +++ b/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate-tristate.gif diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate.gif b/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate.gif Binary files differindex d379f63c..da3fab98 100644 --- a/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate.gif +++ b/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate.gif diff --git a/src/imports/controls/doc/images/qtquickcontrols2-itemdelegate.gif b/src/imports/controls/doc/images/qtquickcontrols2-itemdelegate.gif Binary files differindex 0e8554ff..dccb6efc 100644 --- a/src/imports/controls/doc/images/qtquickcontrols2-itemdelegate.gif +++ b/src/imports/controls/doc/images/qtquickcontrols2-itemdelegate.gif diff --git a/src/imports/controls/doc/images/qtquickcontrols2-radiodelegate.gif b/src/imports/controls/doc/images/qtquickcontrols2-radiodelegate.gif Binary files differindex 851064e9..b6afd6fe 100644 --- a/src/imports/controls/doc/images/qtquickcontrols2-radiodelegate.gif +++ b/src/imports/controls/doc/images/qtquickcontrols2-radiodelegate.gif diff --git a/src/quicktemplates2/qquickcheckdelegate.cpp b/src/quicktemplates2/qquickcheckdelegate.cpp index 249aaa95..304d2b6c 100644 --- a/src/quicktemplates2/qquickcheckdelegate.cpp +++ b/src/quicktemplates2/qquickcheckdelegate.cpp @@ -108,6 +108,10 @@ QQuickCheckDelegate::QQuickCheckDelegate(QQuickItem *parent) : This property determines whether the check delegate has three states. + In the animation below, the first checkdelegate is tri-state: + + \image qtquickcontrols2-checkdelegate-tristate.gif + The default is \c false, i.e., the delegate has only two states. */ bool QQuickCheckDelegate::isTristate() const diff --git a/tests/manual/gifs/data/qtquickcontrols2-checkdelegate-tristate.qml b/tests/manual/gifs/data/qtquickcontrols2-checkdelegate-tristate.qml new file mode 100644 index 00000000..eddb71d5 --- /dev/null +++ b/tests/manual/gifs/data/qtquickcontrols2-checkdelegate-tristate.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** 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.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.0 + +Window { + id: window + width: 170 + height: column.implicitHeight + visible: true + + property alias english: english + property alias norwegian: norwegian + + ColumnLayout { + id: column + anchors.fill: parent + + CheckDelegate { + text: qsTr("Languages") + checkState: english.checked && norwegian.checked + ? Qt.Checked : (english.checked || norwegian.checked) ? Qt.PartiallyChecked : Qt.Unchecked + tristate: true + Layout.fillWidth: true + } + CheckDelegate { + id: english + text: qsTr("English") + checked: true + leftPadding: indicator.width + 14 + Layout.fillWidth: true + } + CheckDelegate { + id: norwegian + text: qsTr("Norwegian") + checked: true + leftPadding: indicator.width + 14 + Layout.fillWidth: true + } + } +} diff --git a/tests/manual/gifs/tst_gifs.cpp b/tests/manual/gifs/tst_gifs.cpp index a788ff0a..8da12347 100644 --- a/tests/manual/gifs/tst_gifs.cpp +++ b/tests/manual/gifs/tst_gifs.cpp @@ -66,10 +66,11 @@ private slots: void dial_data(); void dial(); void checkBox(); - void checkBoxTriState(); void scrollBar(); void progressBar_data(); void progressBar(); + void triState_data(); + void triState(); private: void moveSmoothly(QQuickWindow *window, const QPoint &from, const QPoint &to, int movements, @@ -640,13 +641,23 @@ void tst_Gifs::checkBox() gifRecorder.waitForFinish(); } -void tst_Gifs::checkBoxTriState() +void tst_Gifs::triState_data() { + QTest::addColumn<QString>("name"); + + QTest::newRow("checkbox-tristate") << "checkbox-tristate"; + QTest::newRow("checkdelegate-tristate") << "checkdelegate-tristate"; +} + +void tst_Gifs::triState() +{ + QFETCH(QString, name); + GifRecorder gifRecorder; gifRecorder.setDataDirPath(dataDirPath); gifRecorder.setOutputDir(outputDir); gifRecorder.setRecordingDuration(6); - gifRecorder.setQmlFileName("qtquickcontrols2-checkbox-tristate.qml"); + gifRecorder.setQmlFileName(QString::fromLatin1("qtquickcontrols2-%1.qml").arg(name)); gifRecorder.start(); @@ -656,14 +667,21 @@ void tst_Gifs::checkBoxTriState() QQuickItem *norwegian = window->property("norwegian").value<QQuickItem*>(); QVERIFY(norwegian); - QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, - english->mapToScene(QPointF(english->width() / 2, english->height() / 2)).toPoint(), 1000); - QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, - norwegian->mapToScene(QPointF(norwegian->width() / 2, norwegian->height() / 2)).toPoint(), 1000); - QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, - norwegian->mapToScene(QPointF(norwegian->width() / 2, norwegian->height() / 2)).toPoint(), 1000); - QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, - english->mapToScene(QPointF(english->width() / 2, english->height() / 2)).toPoint(), 1000); + const QPoint englishCenter = english->mapToScene( + QPointF(english->width() / 2, english->height() / 2)).toPoint(); + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, englishCenter, 1000); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, englishCenter, 300); + + const QPoint norwegianCenter = norwegian->mapToScene( + QPointF(norwegian->width() / 2, norwegian->height() / 2)).toPoint(); + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, norwegianCenter, 1000); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, norwegianCenter, 300); + + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, norwegianCenter, 1000); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, norwegianCenter, 300); + + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, englishCenter, 1000); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, englishCenter, 300); gifRecorder.waitForFinish(); } |