|
| 1 | +/**************************************************************************** |
| 2 | +** |
| 3 | +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). |
| 4 | +** Contact: http://www.qt-project.org/legal |
| 5 | +** |
| 6 | +** This file is part of the Qt Quick Controls module of the Qt Toolkit. |
| 7 | +** |
| 8 | +** $QT_BEGIN_LICENSE:BSD$ |
| 9 | +** You may use this file under the terms of the BSD license as follows: |
| 10 | +** |
| 11 | +** "Redistribution and use in source and binary forms, with or without |
| 12 | +** modification, are permitted provided that the following conditions are |
| 13 | +** met: |
| 14 | +** * Redistributions of source code must retain the above copyright |
| 15 | +** notice, this list of conditions and the following disclaimer. |
| 16 | +** * Redistributions in binary form must reproduce the above copyright |
| 17 | +** notice, this list of conditions and the following disclaimer in |
| 18 | +** the documentation and/or other materials provided with the |
| 19 | +** distribution. |
| 20 | +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names |
| 21 | +** of its contributors may be used to endorse or promote products derived |
| 22 | +** from this software without specific prior written permission. |
| 23 | +** |
| 24 | +** |
| 25 | +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 26 | +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 27 | +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 28 | +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 29 | +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 30 | +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 31 | +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 32 | +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 33 | +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 34 | +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 35 | +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." |
| 36 | +** |
| 37 | +** $QT_END_LICENSE$ |
| 38 | +** |
| 39 | +****************************************************************************/ |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | +import QtQuick 2.2 |
| 46 | +import QtQuick.Window 2.1 |
| 47 | +import QtQuick.Controls 1.1 |
| 48 | + |
| 49 | +Window { |
| 50 | + id: window1 |
| 51 | + |
| 52 | + width: 400 |
| 53 | + height: 400 |
| 54 | + |
| 55 | + title: "child window" |
| 56 | + flags: Qt.Dialog |
| 57 | + |
| 58 | + Rectangle { |
| 59 | + color: syspal.window |
| 60 | + anchors.fill: parent |
| 61 | + |
| 62 | + Label { |
| 63 | + id: dimensionsText |
| 64 | + anchors.horizontalCenter: parent.horizontalCenter |
| 65 | + anchors.top: parent.top |
| 66 | + width: parent.width |
| 67 | + horizontalAlignment: Text.AlignHCenter |
| 68 | + } |
| 69 | + |
| 70 | + Label { |
| 71 | + id: availableDimensionsText |
| 72 | + anchors.horizontalCenter: parent.horizontalCenter |
| 73 | + anchors.top: dimensionsText.bottom |
| 74 | + width: parent.width |
| 75 | + horizontalAlignment: Text.AlignHCenter |
| 76 | + } |
| 77 | + |
| 78 | + Label { |
| 79 | + id: closeText |
| 80 | + anchors.horizontalCenter: parent.horizontalCenter |
| 81 | + anchors.top: availableDimensionsText.bottom |
| 82 | + text: "This is a new Window, press the\nbutton below to close it again." |
| 83 | + } |
| 84 | + Button { |
| 85 | + anchors.horizontalCenter: closeText.horizontalCenter |
| 86 | + anchors.top: closeText.bottom |
| 87 | + id: closeWindowButton |
| 88 | + text:"Close" |
| 89 | + width: 98 |
| 90 | + tooltip:"Press me, to close this window again" |
| 91 | + onClicked: window1.visible = false |
| 92 | + } |
| 93 | + Button { |
| 94 | + anchors.horizontalCenter: closeText.horizontalCenter |
| 95 | + anchors.top: closeWindowButton.bottom |
| 96 | + id: maximizeWindowButton |
| 97 | + text:"Maximize" |
| 98 | + width: 98 |
| 99 | + tooltip:"Press me, to maximize this window again" |
| 100 | + onClicked: window1.visibility = Window.Maximized; |
| 101 | + } |
| 102 | + Button { |
| 103 | + anchors.horizontalCenter: closeText.horizontalCenter |
| 104 | + anchors.top: maximizeWindowButton.bottom |
| 105 | + id: normalizeWindowButton |
| 106 | + text:"Normalize" |
| 107 | + width: 98 |
| 108 | + tooltip:"Press me, to normalize this window again" |
| 109 | + onClicked: window1.visibility = Window.Windowed; |
| 110 | + } |
| 111 | + Button { |
| 112 | + anchors.horizontalCenter: closeText.horizontalCenter |
| 113 | + anchors.top: normalizeWindowButton.bottom |
| 114 | + id: minimizeWindowButton |
| 115 | + text:"Minimize" |
| 116 | + width: 98 |
| 117 | + tooltip:"Press me, to minimize this window again" |
| 118 | + onClicked: window1.visibility = Window.Minimized; |
| 119 | + } |
| 120 | + } |
| 121 | +} |
| 122 | + |
0 commit comments