diff options
Diffstat (limited to 'examples/quick')
-rw-r--r-- | examples/quick/dialogs/FileDialogs.qml | 36 | ||||
-rw-r--r-- | examples/quick/shared/Button.qml | 60 | ||||
-rw-r--r-- | examples/quick/shared/CheckBox.qml | 92 | ||||
-rw-r--r-- | examples/quick/shared/SimpleLauncherDelegate.qml | 45 | ||||
-rw-r--r-- | examples/quick/shared/ToolButton.qml | 93 | ||||
-rw-r--r-- | examples/quick/shared/images/checkmark.png | bin | 0 -> 809 bytes | |||
-rw-r--r-- | examples/quick/shared/qmldir | 1 | ||||
-rw-r--r-- | examples/quick/shared/quick_shared.qrc | 1 | ||||
-rw-r--r-- | examples/quick/shared/shared.qrc | 1 |
9 files changed, 131 insertions, 198 deletions
diff --git a/examples/quick/dialogs/FileDialogs.qml b/examples/quick/dialogs/FileDialogs.qml index 3a987ff86f..a6df29bb37 100644 --- a/examples/quick/dialogs/FileDialogs.qml +++ b/examples/quick/dialogs/FileDialogs.qml @@ -46,19 +46,15 @@ Rectangle { width: 580 height: 360 - color: "#444444" + color: palette.window + SystemPalette { id: palette } Rectangle { id: toolbar width: parent.width height: 40 - border.color: "black" - gradient: Gradient { - GradientStop { position: 0.0; color: "#444444" } - GradientStop { position: 0.3; color: "grey" } - GradientStop { position: 0.85; color: "grey" } - GradientStop { position: 1.0; color: "white" } - } + color: Qt.darker(palette.window, 1.1) + border.color: Qt.darker(palette.window, 1.3) Row { spacing: 6 anchors.verticalCenter: parent.verticalCenter @@ -66,17 +62,17 @@ Rectangle { anchors.leftMargin: 8 height: parent.height - 6 width: parent.width - ToolButton { + Button { text: "Open" anchors.verticalCenter: parent.verticalCenter onClicked: fileDialog.open() } - ToolButton { + Button { text: "Close" anchors.verticalCenter: parent.verticalCenter onClicked: fileDialog.close() } - ToolButton { + Button { text: "/tmp" anchors.verticalCenter: parent.verticalCenter // TODO: QTBUG-29814 This isn't portable, but we don't expose QDir::tempPath to QML yet. @@ -107,7 +103,7 @@ Rectangle { anchors.margins: 8 spacing: 8 Text { - color: "white" + color: palette.windowText font.bold: true text: "File dialog properties:" } @@ -139,23 +135,29 @@ Rectangle { Binding on checked { value: fileDialog.visible } } Text { - color: "#EEEEDD" + color: palette.windowText text: "<b>current view folder:</b> " + fileDialog.folder } Text { - color: "#EEEEDD" - text: "<b>name filters:</b> {" + fileDialog.nameFilters + "}; current filter: " + fileDialog.selectedNameFilter + color: palette.windowText + text: "<b>name filters:</b> {" + fileDialog.nameFilters + "}" + width: parent.width + wrapMode: Text.Wrap + } + Text { + color: palette.windowText + text: "<b>current filter:</b>" + fileDialog.selectedNameFilter width: parent.width wrapMode: Text.Wrap } Text { - color: "#EEEEDD" + color: palette.windowText text: "<b>chosen files:</b> " + fileDialog.fileUrls width: parent.width wrapMode: Text.Wrap } Text { - color: "#EEEEDD" + color: palette.windowText text: "<b>chosen single path:</b> " + fileDialog.fileUrl width: parent.width wrapMode: Text.Wrap diff --git a/examples/quick/shared/Button.qml b/examples/quick/shared/Button.qml index 9bbc01ac01..9942a17b5c 100644 --- a/examples/quick/shared/Button.qml +++ b/examples/quick/shared/Button.qml @@ -43,14 +43,31 @@ import QtQuick 2.0 Item { id: container - property string text: "Button" - property string subText: "" + property alias text: buttonLabel.text + property alias label: buttonLabel signal clicked property alias containsMouse: mouseArea.containsMouse property alias pressed: mouseArea.pressed - implicitHeight: col.height - height: implicitHeight - width: buttonLabel.width + 20 + implicitHeight: buttonLabel.implicitHeight + implicitWidth: buttonLabel.implicitWidth + height: buttonLabel.implicitHeight + 12 + width: Math.max(80, implicitWidth + 8) + + SystemPalette { id: palette } + + Rectangle { + id: frame + anchors.fill: parent + color: palette.button + gradient: Gradient { + GradientStop { position: 0.0; color: mouseArea.pressed ? Qt.darker(palette.button, 1.3) : palette.button } + GradientStop { position: 1.0; color: Qt.darker(palette.button, 1.3) } + } + antialiasing: true + radius: 5 + border.color: Qt.darker(palette.button, 1.5) + border.width: 1 + } MouseArea { id: mouseArea @@ -59,33 +76,12 @@ Item { hoverEnabled: true } - Column { - spacing: 2 - id: col - anchors.verticalCenter: parent.verticalCenter + Text { + id: buttonLabel width: parent.width - Text { - id: buttonLabel - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.right: parent.right - anchors.rightMargin: 10 - text: container.text - color: "black" - font.pixelSize: 22 - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - styleColor: "white" - style: Text.Raised - - } - Text { - id: buttonLabel2 - anchors.left: parent.left - anchors.leftMargin: 10 - text: container.subText - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - color: "#666" - font.pixelSize: 12 - } + horizontalAlignment: Text.Center + text: container.text + color: palette.buttonText + anchors.verticalCenter: parent.verticalCenter } } diff --git a/examples/quick/shared/CheckBox.qml b/examples/quick/shared/CheckBox.qml index 1d29430934..a3a22b7723 100644 --- a/examples/quick/shared/CheckBox.qml +++ b/examples/quick/shared/CheckBox.qml @@ -41,62 +41,56 @@ import QtQuick 2.0 Item { - height: label.height + 4 - width: label.width + height + 4 + id: root + implicitHeight: frame.height + implicitWidth: row.implicitWidth + width: implicitWidth + height: implicitHeight property alias text: label.text property bool checked property alias pressed: mouseArea.pressed - Rectangle { - antialiasing: true - border.color: "white" - color: "transparent" - anchors.fill: gradientRect - anchors.rightMargin: 1 - anchors.bottomMargin: 1 - radius: 3 - } - Rectangle { - border.color: "black" - anchors.fill: gradientRect - anchors.leftMargin: 1 - anchors.topMargin: 1 - radius: 3 - } - Rectangle { - id: gradientRect - gradient: Gradient { - GradientStop { position: 0.0; color: mouseArea.pressed ? "darkgrey" : "#CCCCCC" } - GradientStop { position: 0.6; color: "#887766" } - GradientStop { position: 1.0; color: mouseArea.pressed ? "white" : "#333333" } - } - anchors.verticalCenter: parent.verticalCenter - height: parent.height - width: height - anchors.margins: 1 - radius: 3 - } - Text { - id: theX - anchors.centerIn: gradientRect - text: checked ? "✓" : "" - } - Text { - anchors.centerIn: gradientRect - anchors.horizontalCenterOffset: 0.5 - anchors.verticalCenterOffset: 0.5 - color: "white" - text: theX.text - } - Text { - id: label - color: "#EEEEDD" - anchors.left: gradientRect.right - anchors.leftMargin: 6 + signal clicked + + SystemPalette { id: palette } + + Row { + id: row anchors.verticalCenter: parent.verticalCenter + spacing: 6 + Rectangle { + id: frame + gradient: Gradient { + GradientStop { position: 0.0; color: mouseArea.pressed ? Qt.darker(palette.button, 1.3) : palette.button } + GradientStop { position: 1.0; color: Qt.darker(palette.button, 1.3) } + } + height: label.implicitHeight * 1.5 + width: height + anchors.margins: 1 + radius: 3 + antialiasing: true + border.color: Qt.darker(palette.button, 1.5) + Image { + id: theX + source: "images/checkmark.png" + anchors.fill: frame + anchors.margins: frame.width / 5 + fillMode: Image.PreserveAspectFit + smooth: true + visible: checked + } + } + Text { + id: label + color: palette.text + anchors.verticalCenter: frame.verticalCenter + } } MouseArea { id: mouseArea anchors.fill: parent - onClicked: parent.checked = !parent.checked + onClicked: { + parent.checked = !parent.checked + parent.clicked() + } } } diff --git a/examples/quick/shared/SimpleLauncherDelegate.qml b/examples/quick/shared/SimpleLauncherDelegate.qml index e89126690f..48dd34fd41 100644 --- a/examples/quick/shared/SimpleLauncherDelegate.qml +++ b/examples/quick/shared/SimpleLauncherDelegate.qml @@ -68,15 +68,52 @@ Rectangle { anchors.rightMargin: 16 } - Button { + Item { id: button anchors.top: parent.top anchors.left: parent.left anchors.bottom: parent.bottom anchors.right:image.left - text: name - subText: description - onClicked: exampleItem.exampleUrl = url; + implicitHeight: col.height + height: implicitHeight + width: buttonLabel.width + 20 + + MouseArea { + id: mouseArea + anchors.fill: parent + onClicked: exampleItem.exampleUrl = url + hoverEnabled: true + } + + Column { + spacing: 2 + id: col + anchors.verticalCenter: parent.verticalCenter + width: parent.width + Text { + id: buttonLabel + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.right: parent.right + anchors.rightMargin: 10 + text: name + color: "black" + font.pixelSize: 22 + wrapMode: Text.WrapAtWordBoundaryOrAnywhere + styleColor: "white" + style: Text.Raised + + } + Text { + id: buttonLabel2 + anchors.left: parent.left + anchors.leftMargin: 10 + text: description + wrapMode: Text.WrapAtWordBoundaryOrAnywhere + color: "#666" + font.pixelSize: 12 + } + } } Rectangle { diff --git a/examples/quick/shared/ToolButton.qml b/examples/quick/shared/ToolButton.qml deleted file mode 100644 index 1af0d13dcf..0000000000 --- a/examples/quick/shared/ToolButton.qml +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** 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 { - height: parent.height - 4 - width: height * 2 - anchors.verticalCenter: parent.verticalCenter - property alias text: label.text - property string tooltip - signal clicked - Rectangle { - antialiasing: true - border.color: "white" - color: "transparent" - anchors.fill: parent - anchors.rightMargin: 1 - anchors.bottomMargin: 1 - radius: 3 - } - Rectangle { - border.color: "black" - anchors.fill: parent - anchors.leftMargin: 1 - anchors.topMargin: 1 - radius: 3 - } - Rectangle { - gradient: Gradient { - GradientStop { position: 0.0; color: mouseArea.pressed ? "darkgrey" : "#CCCCCC" } - GradientStop { position: 0.6; color: "#887766" } - GradientStop { position: 1.0; color: mouseArea.pressed ? "white" : "#333333" } - } - anchors.fill: parent - anchors.margins: 1 - radius: 3 - } - Text { - id: label - anchors.centerIn: parent - } - Text { - anchors.centerIn: parent - anchors.horizontalCenterOffset: 0.5 - anchors.verticalCenterOffset: 0.5 - color: "white" - text: label.text - } - - MouseArea { - id: mouseArea - anchors.fill: parent - onClicked: parent.clicked() - } -} diff --git a/examples/quick/shared/images/checkmark.png b/examples/quick/shared/images/checkmark.png Binary files differnew file mode 100644 index 0000000000..821aafccdd --- /dev/null +++ b/examples/quick/shared/images/checkmark.png diff --git a/examples/quick/shared/qmldir b/examples/quick/shared/qmldir index 68bd573f85..cc4eb3c793 100644 --- a/examples/quick/shared/qmldir +++ b/examples/quick/shared/qmldir @@ -3,4 +3,3 @@ CheckBox 2.1 CheckBox.qml LauncherList 2.0 LauncherList.qml SimpleLauncherDelegate 2.0 SimpleLauncherDelegate.qml Slider 2.0 Slider.qml -ToolButton 2.1 ToolButton.qml diff --git a/examples/quick/shared/quick_shared.qrc b/examples/quick/shared/quick_shared.qrc index aa6a761e0d..ee706712dd 100644 --- a/examples/quick/shared/quick_shared.qrc +++ b/examples/quick/shared/quick_shared.qrc @@ -4,7 +4,6 @@ <file>SimpleLauncherDelegate.qml</file> <file>Button.qml</file> <file>CheckBox.qml</file> - <file>ToolButton.qml</file> <file>images/back.png</file> <file>images/next.png</file> </qresource> diff --git a/examples/quick/shared/shared.qrc b/examples/quick/shared/shared.qrc index cbc782f2c7..0b574ac879 100644 --- a/examples/quick/shared/shared.qrc +++ b/examples/quick/shared/shared.qrc @@ -6,7 +6,6 @@ <file>Slider.qml</file> <file>images/slider_handle.png</file> <file>CheckBox.qml</file> - <file>ToolButton.qml</file> <file>images/back.png</file> <file>images/next.png</file> </qresource> |