From 937fdde5d3b26291d417f856ee05ba479a6ba730 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 22 Apr 2014 13:32:56 +0200 Subject: Make the Clocks example use the resource system Make the Clocks example use the Qt resource system and the shared main(), in order to have easy deployment to all platforms and support for shadow builds. Task-number: QTBUG-37203 Change-Id: Ia235b6b2397cfaeb20f0c7ea0d6196c603b20099 Reviewed-by: Alan Alpert --- examples/quick/demos/clocks/clocks.pro | 14 ++++++++++++ examples/quick/demos/clocks/clocks.qml | 6 ++--- examples/quick/demos/clocks/clocks.qrc | 15 +++++++++++++ examples/quick/demos/clocks/main.cpp | 41 ++++++++++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 examples/quick/demos/clocks/clocks.pro create mode 100644 examples/quick/demos/clocks/clocks.qrc create mode 100644 examples/quick/demos/clocks/main.cpp (limited to 'examples/quick/demos/clocks') diff --git a/examples/quick/demos/clocks/clocks.pro b/examples/quick/demos/clocks/clocks.pro new file mode 100644 index 0000000000..21d3f7f971 --- /dev/null +++ b/examples/quick/demos/clocks/clocks.pro @@ -0,0 +1,14 @@ +TEMPLATE = app + +QT += qml quick + +SOURCES += main.cpp +RESOURCES += clocks.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/clocks +INSTALLS += target + +OTHER_FILES += \ + clocks.qml \ + content/Clock.qml \ + content/*.png diff --git a/examples/quick/demos/clocks/clocks.qml b/examples/quick/demos/clocks/clocks.qml index ddf9e42ea2..d16e3c5442 100644 --- a/examples/quick/demos/clocks/clocks.qml +++ b/examples/quick/demos/clocks/clocks.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the examples of the Qt Toolkit. @@ -39,7 +39,7 @@ ****************************************************************************/ import QtQuick 2.0 -import "content" +import "content" as Content Rectangle { id: root @@ -54,7 +54,7 @@ Rectangle { snapMode: ListView.SnapOneItem highlightRangeMode: ListView.ApplyRange - delegate: Clock { city: cityName; shift: timeShift } + delegate: Content.Clock { city: cityName; shift: timeShift } model: ListModel { ListElement { cityName: "New York"; timeShift: -4 } ListElement { cityName: "London"; timeShift: 0 } diff --git a/examples/quick/demos/clocks/clocks.qrc b/examples/quick/demos/clocks/clocks.qrc new file mode 100644 index 0000000000..eaff4729ae --- /dev/null +++ b/examples/quick/demos/clocks/clocks.qrc @@ -0,0 +1,15 @@ + + + clocks.qml + content/arrow.png + content/background.png + content/center.png + content/clock-night.png + content/clock.png + content/Clock.qml + content/hour.png + content/minute.png + content/quit.png + content/second.png + + diff --git a/examples/quick/demos/clocks/main.cpp b/examples/quick/demos/clocks/main.cpp new file mode 100644 index 0000000000..f6b7f87d38 --- /dev/null +++ b/examples/quick/demos/clocks/main.cpp @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples 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 Digia Plc and its Subsidiary(-ies) 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$ +** +****************************************************************************/ +#include "../../shared/shared.h" +DECLARATIVE_EXAMPLE_MAIN(demos/clocks/clocks) -- cgit v1.2.3