From 4446847282855b00e66dc61e6a07edcad6939e63 Mon Sep 17 00:00:00 2001 From: artoka Date: Thu, 17 Nov 2011 15:49:42 +0100 Subject: cppextensions/qgraphicslayouts examples modifications Modified projects to use centralized qmlapplicationviewer, removed duplicated files and modified project files according to the changes. Merge-request: 2719 Reviewed-by: Casper van Donderen --- .../qgraphicsgridlayout/gridlayout.qrc | 9 +- .../qgraphicslayouts/qgraphicsgridlayout/main.cpp | 12 +-- .../qgraphicsgridlayout/qgraphicsgridlayout.pro | 55 +++++++++++- .../qgraphicsgridlayout/qgraphicsgridlayout.qml | 100 --------------------- .../qgraphicsgridlayout/qgraphicsgridlayout.qml | 100 +++++++++++++++++++++ .../qgraphicslinearlayout/linearlayout.qrc | 9 +- .../qgraphicslinearlayout/main.cpp | 12 +-- .../qgraphicslinearlayout.pro | 52 ++++++++++- .../qgraphicslinearlayout.qml | 79 ---------------- .../qgraphicslinearlayout.qml | 79 ++++++++++++++++ 10 files changed, 299 insertions(+), 208 deletions(-) delete mode 100644 examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/qgraphicsgridlayout.qml create mode 100644 examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/qml/qgraphicsgridlayout/qgraphicsgridlayout.qml delete mode 100644 examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/qgraphicslinearlayout.qml create mode 100644 examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/qml/qgraphicslinearlayout/qgraphicslinearlayout.qml diff --git a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/gridlayout.qrc b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/gridlayout.qrc index bdf8312..112b6f0 100644 --- a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/gridlayout.qrc +++ b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/gridlayout.qrc @@ -1,6 +1,5 @@ - - - qgraphicsgridlayout.qml - + + + qml/qgraphicsgridlayout/qgraphicsgridlayout.qml + - diff --git a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/main.cpp b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/main.cpp index 6525cb3..2c42cd9 100644 --- a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/main.cpp +++ b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/main.cpp @@ -39,10 +39,9 @@ ****************************************************************************/ #include "gridlayout.h" - +#include "qmlapplicationviewer.h" #include #include - #include int main(int argc, char* argv[]) @@ -53,11 +52,12 @@ int main(int argc, char* argv[]) qmlRegisterInterface("QGraphicsLayout"); qmlRegisterType("GridLayouts", 4, 7, "GraphicsGridLayout"); - QDeclarativeView view; - view.setSource(QUrl(":qgraphicsgridlayout.qml")); - view.show(); + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile("qml/qgraphicsgridlayout/qgraphicsgridlayout.qml"); + viewer.showExpanded(); return app.exec(); -}; +} diff --git a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/qgraphicsgridlayout.pro b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/qgraphicsgridlayout.pro index ae6373d..d39a50f 100644 --- a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/qgraphicsgridlayout.pro +++ b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/qgraphicsgridlayout.pro @@ -1,7 +1,53 @@ -TEMPLATE = app -TARGET = qgraphicsgridlayout -QT += declarative +#TEMPLATE = app +#TARGET = qgraphicsgridlayout +#QT += declarative +#SOURCES += \ +# gridlayout.cpp \ +# main.cpp + +#HEADERS += \ +# gridlayout.h + +#RESOURCES += \ +# gridlayout.qrc + + + + +# Add more folders to ship with the application, here +folder_01.source = qml/qgraphicsgridlayout +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +symbian:TARGET.UID3 = 0xE7E0DF63 + +# Smart Installer package's UID +# This UID is from the protected range and therefore the package will +# fail to install if self-signed. By default qmake uses the unprotected +# range value if unprotected UID is defined for the application and +# 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Allow network access on Symbian +symbian:TARGET.CAPABILITY += NetworkServices + +# If your application uses the Qt Mobility libraries, uncomment the following +# lines and add the respective components to the MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# Speed up launching on MeeGo/Harmattan when using applauncherd daemon +# CONFIG += qdeclarative-boostable + +# Add dependency to Symbian components +# CONFIG += qt-components +QT += network + +# The .cpp file which was generated for your project. Feel free to hack it. SOURCES += \ gridlayout.cpp \ main.cpp @@ -12,4 +58,7 @@ HEADERS += \ RESOURCES += \ gridlayout.qrc +# Please do not modify the following two lines. Required for deployment. +include(../../../../tools/qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/qgraphicsgridlayout.qml b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/qgraphicsgridlayout.qml deleted file mode 100644 index 6780a5a..0000000 --- a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/qgraphicsgridlayout.qml +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** 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 Nokia Corporation 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 1.0 -import GridLayouts 4.7 - -Item { - width: 400 - height: 400 - - QGraphicsWidget { - size.width: parent.width - size.height: parent.height - - /* - Below we create a grid layout using the GraphicsGridLayout item - (defined by the GraphicsGridLayoutObject class in gridlayout.h). - - The row, column etc. are set through attached properties on - GraphicsGridLayout, using the properties defined in the - GridLayoutAttached class (also defined in gridlayout.h). - */ - - layout: GraphicsGridLayout { - LayoutItem { - GraphicsGridLayout.row: 0 - GraphicsGridLayout.column: 0 - minimumSize: "100x100" - maximumSize: "300x300" - preferredSize: "200x200" - Rectangle { color: "red"; anchors.fill: parent } - } - LayoutItem { - GraphicsGridLayout.row: 0 - GraphicsGridLayout.column: 1 - minimumSize: "100x100" - maximumSize: "200x200" - preferredSize: "200x200" - Rectangle { color: "orange"; anchors.fill: parent } - } - LayoutItem { - GraphicsGridLayout.row: 1 - GraphicsGridLayout.column: 0 - GraphicsGridLayout.columnSpan: 2 - minimumSize: "100x100" - Rectangle { color: "yellow"; anchors.fill: parent } - } - LayoutItem { - GraphicsGridLayout.row: 2 - GraphicsGridLayout.column: 0 - preferredSize: "200x200" - Rectangle { color: "green"; anchors.fill: parent } - } - LayoutItem { - GraphicsGridLayout.row: 2 - GraphicsGridLayout.column: 1 - preferredSize: "200x200" - Rectangle { color: "blue"; anchors.fill: parent } - } - } - } -} - diff --git a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/qml/qgraphicsgridlayout/qgraphicsgridlayout.qml b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/qml/qgraphicsgridlayout/qgraphicsgridlayout.qml new file mode 100644 index 0000000..6780a5a --- /dev/null +++ b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicsgridlayout/qml/qgraphicsgridlayout/qgraphicsgridlayout.qml @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation 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 1.0 +import GridLayouts 4.7 + +Item { + width: 400 + height: 400 + + QGraphicsWidget { + size.width: parent.width + size.height: parent.height + + /* + Below we create a grid layout using the GraphicsGridLayout item + (defined by the GraphicsGridLayoutObject class in gridlayout.h). + + The row, column etc. are set through attached properties on + GraphicsGridLayout, using the properties defined in the + GridLayoutAttached class (also defined in gridlayout.h). + */ + + layout: GraphicsGridLayout { + LayoutItem { + GraphicsGridLayout.row: 0 + GraphicsGridLayout.column: 0 + minimumSize: "100x100" + maximumSize: "300x300" + preferredSize: "200x200" + Rectangle { color: "red"; anchors.fill: parent } + } + LayoutItem { + GraphicsGridLayout.row: 0 + GraphicsGridLayout.column: 1 + minimumSize: "100x100" + maximumSize: "200x200" + preferredSize: "200x200" + Rectangle { color: "orange"; anchors.fill: parent } + } + LayoutItem { + GraphicsGridLayout.row: 1 + GraphicsGridLayout.column: 0 + GraphicsGridLayout.columnSpan: 2 + minimumSize: "100x100" + Rectangle { color: "yellow"; anchors.fill: parent } + } + LayoutItem { + GraphicsGridLayout.row: 2 + GraphicsGridLayout.column: 0 + preferredSize: "200x200" + Rectangle { color: "green"; anchors.fill: parent } + } + LayoutItem { + GraphicsGridLayout.row: 2 + GraphicsGridLayout.column: 1 + preferredSize: "200x200" + Rectangle { color: "blue"; anchors.fill: parent } + } + } + } +} + diff --git a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/linearlayout.qrc b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/linearlayout.qrc index 93a3533..9686f9b 100644 --- a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/linearlayout.qrc +++ b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/linearlayout.qrc @@ -1,6 +1,5 @@ - - - qgraphicslinearlayout.qml - + + + qml/qgraphicslinearlayout/qgraphicslinearlayout.qml + - diff --git a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/main.cpp b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/main.cpp index f8d08c2..3299c70 100644 --- a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/main.cpp +++ b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/main.cpp @@ -39,10 +39,9 @@ ****************************************************************************/ #include "linearlayout.h" - +#include "qmlapplicationviewer.h" #include #include - #include int main(int argc, char* argv[]) @@ -54,11 +53,12 @@ int main(int argc, char* argv[]) qmlRegisterType("LinearLayouts", 4, 7, "GraphicsLinearLayoutStretchItem"); qmlRegisterType("LinearLayouts", 4, 7, "GraphicsLinearLayout"); - QDeclarativeView view; - view.setSource(QUrl(":qgraphicslinearlayout.qml")); - view.show(); + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.setMainQmlFile("qml/qgraphicslinearlayout/qgraphicslinearlayout.qml"); + viewer.showExpanded(); return app.exec(); -}; +} diff --git a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/qgraphicslinearlayout.pro b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/qgraphicslinearlayout.pro index 79eb6ff..0e83cfa 100644 --- a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/qgraphicslinearlayout.pro +++ b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/qgraphicslinearlayout.pro @@ -1,7 +1,49 @@ -TEMPLATE = app -TARGET = qgraphicslinearlayout -QT += declarative +#TEMPLATE = app +#TARGET = qgraphicslinearlayout +#QT += declarative +#SOURCES += \ +# linearlayout.cpp \ +# main.cpp + +#HEADERS += \ +# linearlayout.h + +#RESOURCES += \ +# linearlayout.qrc + +# Add more folders to ship with the application, here +folder_01.source = qml/qgraphicslinearlayout +folder_01.target = qml +DEPLOYMENTFOLDERS = folder_01 + +# Additional import path used to resolve QML modules in Creator's code model +QML_IMPORT_PATH = + +symbian:TARGET.UID3 = 0xE7D233DA + +# Smart Installer package's UID +# This UID is from the protected range and therefore the package will +# fail to install if self-signed. By default qmake uses the unprotected +# range value if unprotected UID is defined for the application and +# 0x2002CCCF value if protected UID is given to the application +#symbian:DEPLOYMENT.installer_header = 0x2002CCCF + +# Allow network access on Symbian +symbian:TARGET.CAPABILITY += NetworkServices + +# If your application uses the Qt Mobility libraries, uncomment the following +# lines and add the respective components to the MOBILITY variable. +# CONFIG += mobility +# MOBILITY += + +# Speed up launching on MeeGo/Harmattan when using applauncherd daemon +# CONFIG += qdeclarative-boostable + +# Add dependency to Symbian components +# CONFIG += qt-components + +# The .cpp file which was generated for your project. Feel free to hack it. SOURCES += \ linearlayout.cpp \ main.cpp @@ -12,4 +54,6 @@ HEADERS += \ RESOURCES += \ linearlayout.qrc - +# Please do not modify the following two lines. Required for deployment. +include(../../../../tools/qmlapplicationviewer/qmlapplicationviewer.pri) +qtcAddDeployment() diff --git a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/qgraphicslinearlayout.qml b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/qgraphicslinearlayout.qml deleted file mode 100644 index a7d79e5..0000000 --- a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/qgraphicslinearlayout.qml +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** 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 Nokia Corporation 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 1.0 -import LinearLayouts 4.7 - -Item { - width: 400 - height: 400 - - QGraphicsWidget { - size.width: parent.width - size.height: parent.height - - /* - Below we create a linear layout using the GraphicsLinearLayout item - (defined by the GraphicsLinearLayoutObject class in linearlayout.h). - - The first LayoutItem uses 'GraphicsLinearLayout.spacing' to set the - item's spacing: this is an attached property, set using the - properties defined in the LinearLayoutAttached class (also defined - in linearlayout.h). - */ - - layout: GraphicsLinearLayout { - LayoutItem { - GraphicsLinearLayout.spacing: 50 - minimumSize: "100x100" - maximumSize: "200x200" - preferredSize: "100x100" - Rectangle { color: "yellow"; anchors.fill: parent } - } - LayoutItem { - minimumSize: "100x100" - maximumSize: "400x400" - preferredSize: "300x300" - Rectangle { color: "green"; anchors.fill: parent } - } - } - } -} - diff --git a/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/qml/qgraphicslinearlayout/qgraphicslinearlayout.qml b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/qml/qgraphicslinearlayout/qgraphicslinearlayout.qml new file mode 100644 index 0000000..a7d79e5 --- /dev/null +++ b/examples/declarative/cppextensions/qgraphicslayouts/qgraphicslinearlayout/qml/qgraphicslinearlayout/qgraphicslinearlayout.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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 Nokia Corporation 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 1.0 +import LinearLayouts 4.7 + +Item { + width: 400 + height: 400 + + QGraphicsWidget { + size.width: parent.width + size.height: parent.height + + /* + Below we create a linear layout using the GraphicsLinearLayout item + (defined by the GraphicsLinearLayoutObject class in linearlayout.h). + + The first LayoutItem uses 'GraphicsLinearLayout.spacing' to set the + item's spacing: this is an attached property, set using the + properties defined in the LinearLayoutAttached class (also defined + in linearlayout.h). + */ + + layout: GraphicsLinearLayout { + LayoutItem { + GraphicsLinearLayout.spacing: 50 + minimumSize: "100x100" + maximumSize: "200x200" + preferredSize: "100x100" + Rectangle { color: "yellow"; anchors.fill: parent } + } + LayoutItem { + minimumSize: "100x100" + maximumSize: "400x400" + preferredSize: "300x300" + Rectangle { color: "green"; anchors.fill: parent } + } + } + } +} + -- cgit v0.12