From 78179e8b77fddbc6f017e5007fe157425a8eb6e4 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 6 Oct 2016 12:44:04 +0200 Subject: ScrollIndicator: replace PNGs with GIFs Change-Id: I04d55b0e2e089cb55c26b921409ff2e5e58f55d9 Task-number: QTBUG-55904 Reviewed-by: J-P Nurmi --- .../images/qtquickcontrols2-scrollindicator.gif | Bin 0 -> 42352 bytes .../images/qtquickcontrols2-scrollindicator.png | Bin 387 -> 0 bytes .../doc/src/qtquickcontrols2-indicators.qdoc | 2 +- src/quicktemplates2/qquickscrollindicator.cpp | 4 +- .../gifs/data/qtquickcontrols2-scrollindicator.qml | 67 +++++++++++++++++++++ tests/manual/gifs/tst_gifs.cpp | 31 ++++++++++ 6 files changed, 101 insertions(+), 3 deletions(-) create mode 100644 src/imports/controls/doc/images/qtquickcontrols2-scrollindicator.gif delete mode 100644 src/imports/controls/doc/images/qtquickcontrols2-scrollindicator.png create mode 100644 tests/manual/gifs/data/qtquickcontrols2-scrollindicator.qml diff --git a/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator.gif b/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator.gif new file mode 100644 index 00000000..73007820 Binary files /dev/null and b/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator.gif differ diff --git a/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator.png b/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator.png deleted file mode 100644 index ea0923cc..00000000 Binary files a/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator.png and /dev/null differ diff --git a/src/imports/controls/doc/src/qtquickcontrols2-indicators.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-indicators.qdoc index 47e6be82..03750844 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-indicators.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-indicators.qdoc @@ -62,7 +62,7 @@ \section1 ScrollIndicator Control - \image qtquickcontrols2-scrollindicator.png + \image qtquickcontrols2-scrollindicator.gif \l ScrollIndicator is a non-interactive indicator that indicates the current scroll position, and can be used to scroll to a specific position in a diff --git a/src/quicktemplates2/qquickscrollindicator.cpp b/src/quicktemplates2/qquickscrollindicator.cpp index 1c2700bc..48adda0a 100644 --- a/src/quicktemplates2/qquickscrollindicator.cpp +++ b/src/quicktemplates2/qquickscrollindicator.cpp @@ -52,12 +52,12 @@ QT_BEGIN_NAMESPACE \ingroup qtquickcontrols2-indicators \brief A non-interactive scroll indicator control. + \image qtquickcontrols2-scrollindicator.gif + ScrollIndicator is a non-interactive indicator that indicates the current scroll position. A scroll indicator can be either \l vertical or \l horizontal, and can be attached to any \l Flickable, such as \l ListView and \l GridView. - \image qtquickcontrols2-scrollindicator.png - \code Flickable { // ... diff --git a/tests/manual/gifs/data/qtquickcontrols2-scrollindicator.qml b/tests/manual/gifs/data/qtquickcontrols2-scrollindicator.qml new file mode 100644 index 00000000..091e5250 --- /dev/null +++ b/tests/manual/gifs/data/qtquickcontrols2-scrollindicator.qml @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** 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: 100 + height: 120 + visible: true + color: "#eeeeee" + + ListView { + anchors.fill: parent + + ScrollIndicator.vertical: ScrollIndicator { + active: true + } + + model: 10 + delegate: Label { + text: qsTr("Item %1").arg(index + 1) + width: 100 + height: 40 + leftPadding: 10 + verticalAlignment: Text.AlignVCenter + } + } +} diff --git a/tests/manual/gifs/tst_gifs.cpp b/tests/manual/gifs/tst_gifs.cpp index a54dd961..33964aec 100644 --- a/tests/manual/gifs/tst_gifs.cpp +++ b/tests/manual/gifs/tst_gifs.cpp @@ -66,6 +66,7 @@ private slots: void dial_data(); void dial(); void scrollBar(); + void scrollIndicator(); void progressBar_data(); void progressBar(); void triState_data(); @@ -730,6 +731,36 @@ void tst_Gifs::scrollBar() gifRecorder.waitForFinish(); } +void tst_Gifs::scrollIndicator() +{ + GifRecorder gifRecorder; + gifRecorder.setDataDirPath(dataDirPath); + gifRecorder.setOutputDir(outputDir); + gifRecorder.setRecordingDuration(6); + gifRecorder.setQmlFileName("qtquickcontrols2-scrollindicator.qml"); + + gifRecorder.start(); + + // Flick in the center of the screen to show that there's a scroll indicator. + QQuickWindow *window = gifRecorder.window(); + const QPoint windowBottom = QPoint(0, window->height() - 1); + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, windowBottom, 100); + QTest::mouseMove(window, windowBottom - QPoint(0, 10), 30); + QTest::mouseMove(window, windowBottom - QPoint(0, 30), 30); + QTest::mouseMove(window, windowBottom - QPoint(0, 60), 30); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, windowBottom - QPoint(0, 100), 30); + + // Scroll back down. + const QPoint windowTop = QPoint(0, 0); + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, windowTop, 2000); + QTest::mouseMove(window, windowTop + QPoint(0, 10), 30); + QTest::mouseMove(window, windowTop + QPoint(0, 30), 30); + QTest::mouseMove(window, windowTop + QPoint(0, 60), 30); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, windowTop + QPoint(0, 100), 30); + + gifRecorder.waitForFinish(); +} + void tst_Gifs::progressBar_data() { QTest::addColumn("indeterminate"); -- cgit v1.2.3