From 1ef4e4b156be8653af64dbccb47abcccc234246a Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 8 Mar 2013 16:44:52 +0100 Subject: window and Screen example: new properties; splash screen Demonstrates the new properties, how to make a splash screen, and how to make a standalone app with an icon. Combined the Screen info into this example too. Change-Id: I5b731539b39c55327f4e5b93860a880a35835896 Reviewed-by: Richard Moe Gustavsen --- examples/quick/shared/images/qt-logo.png | Bin 0 -> 13923 bytes examples/quick/shared/shared.qrc | 2 ++ 2 files changed, 2 insertions(+) create mode 100644 examples/quick/shared/images/qt-logo.png (limited to 'examples/quick/shared') diff --git a/examples/quick/shared/images/qt-logo.png b/examples/quick/shared/images/qt-logo.png new file mode 100644 index 0000000000..7d3e97eb36 Binary files /dev/null and b/examples/quick/shared/images/qt-logo.png differ diff --git a/examples/quick/shared/shared.qrc b/examples/quick/shared/shared.qrc index 0b574ac879..8912c17831 100644 --- a/examples/quick/shared/shared.qrc +++ b/examples/quick/shared/shared.qrc @@ -8,5 +8,7 @@ CheckBox.qml images/back.png images/next.png + images/qt-logo.png + images/checkmark.png -- cgit v1.2.3 From 43484528552cb2ba3dc1dabfcce22ed40bf4f8db Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 27 May 2013 18:44:34 +0200 Subject: Package dialogs examples into a single executable Introduced tabs and added the C++ boilerplate launcher. Change-Id: Ibb49a182e3928aba5dced097d5307eb7d1f4b42d Reviewed-by: Richard Moe Gustavsen --- examples/quick/shared/TabSet.qml | 101 +++++++++++++++++++++++++++++++++++ examples/quick/shared/images/tab.png | Bin 0 -> 507 bytes examples/quick/shared/qmldir | 1 + examples/quick/shared/shared.h | 2 +- examples/quick/shared/shared.qrc | 2 + 5 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 examples/quick/shared/TabSet.qml create mode 100644 examples/quick/shared/images/tab.png (limited to 'examples/quick/shared') diff --git a/examples/quick/shared/TabSet.qml b/examples/quick/shared/TabSet.qml new file mode 100644 index 0000000000..10263a70ac --- /dev/null +++ b/examples/quick/shared/TabSet.qml @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2013 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$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Item { + id: tabWidget + + // Setting the default property to stack.children means any child items + // of the TabWidget are actually added to the 'stack' item's children. + // See the "Property Binding" + // documentation for details on default properties. + default property alias content: stack.children + + property int current: 0 + + onCurrentChanged: setZOrders() + Component.onCompleted: setZOrders() + + function setZOrders() { + for (var i = 0; i < stack.children.length; ++i) + stack.children[i].z = (i == current ? 1 : 0) + } + + Row { + id: header + + Repeater { + model: stack.children.length + delegate: Rectangle { + width: tabWidget.width / stack.children.length; height: 36 + + Rectangle { + width: parent.width; height: 1 + anchors { bottom: parent.bottom; bottomMargin: 1 } + color: "#acb2c2" + } + BorderImage { + anchors { fill: parent; leftMargin: 2; topMargin: 5; rightMargin: 1 } + border { left: 7; right: 7 } + source: "images/tab.png" + visible: tabWidget.current == index + } + Text { + horizontalAlignment: Qt.AlignHCenter; verticalAlignment: Qt.AlignVCenter + anchors.fill: parent + text: stack.children[index].title + elide: Text.ElideRight + font.bold: tabWidget.current == index + } + MouseArea { + anchors.fill: parent + onClicked: tabWidget.current = index + } + } + } + } + + Item { + id: stack + width: tabWidget.width + anchors.top: header.bottom; anchors.bottom: tabWidget.bottom + } +} diff --git a/examples/quick/shared/images/tab.png b/examples/quick/shared/images/tab.png new file mode 100644 index 0000000000..ad8021605f Binary files /dev/null and b/examples/quick/shared/images/tab.png differ diff --git a/examples/quick/shared/qmldir b/examples/quick/shared/qmldir index cc4eb3c793..4f7c50540d 100644 --- a/examples/quick/shared/qmldir +++ b/examples/quick/shared/qmldir @@ -3,3 +3,4 @@ CheckBox 2.1 CheckBox.qml LauncherList 2.0 LauncherList.qml SimpleLauncherDelegate 2.0 SimpleLauncherDelegate.qml Slider 2.0 Slider.qml +TabSet 2.1 TabSet.qml diff --git a/examples/quick/shared/shared.h b/examples/quick/shared/shared.h index eab15f3e0a..c59e858d47 100644 --- a/examples/quick/shared/shared.h +++ b/examples/quick/shared/shared.h @@ -47,9 +47,9 @@ QQuickView view;\ view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));\ view.setSource(QUrl("qrc:///" #NAME ".qml")); \ + view.setResizeMode(QQuickView::SizeRootObjectToView);\ if (QGuiApplication::platformName() == QLatin1String("qnx") || \ QGuiApplication::platformName() == QLatin1String("eglfs")) {\ - view.setResizeMode(QQuickView::SizeRootObjectToView);\ view.showFullScreen();\ } else {\ view.show();\ diff --git a/examples/quick/shared/shared.qrc b/examples/quick/shared/shared.qrc index 8912c17831..6aaeca5211 100644 --- a/examples/quick/shared/shared.qrc +++ b/examples/quick/shared/shared.qrc @@ -6,9 +6,11 @@ Slider.qml images/slider_handle.png CheckBox.qml + TabSet.qml images/back.png images/next.png images/qt-logo.png images/checkmark.png + images/tab.png -- cgit v1.2.3