diff options
Diffstat (limited to 'examples/quick/extras/flat')
15 files changed, 0 insertions, 1397 deletions
diff --git a/examples/quick/extras/flat/Content.qml b/examples/quick/extras/flat/Content.qml deleted file mode 100644 index 2969f7305..000000000 --- a/examples/quick/extras/flat/Content.qml +++ /dev/null @@ -1,706 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd 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.4 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -import QtQuick.Extras 1.4 -import QtQuick.XmlListModel 2.0 - -Item { - anchors.fill: parent - - Text { - id: text - visible: false - } - - FontMetrics { - id: fontMetrics - font.family: Flat.FlatStyle.fontFamily - } - - readonly property int layoutSpacing: Math.round(5 * Flat.FlatStyle.scaleFactor) - - property var componentModel: [ - { name: "Buttons", component: buttonsComponent }, - { name: "Calendar", component: calendarComponent }, - { name: "DelayButton", component: delayButtonComponent }, - { name: "Dial", component: dialComponent }, - { name: "Input", component: inputComponent }, - { name: "PieMenu", component: pieMenuComponent }, - { name: "Progress", component: progressComponent }, - { name: "TableView", component: tableViewComponent }, - { name: "TextArea", component: textAreaComponent }, - { name: "Tumbler", component: tumblerComponent } - ] - - Loader { - id: componentLoader - anchors.fill: parent - sourceComponent: componentModel[controlData.componentIndex].component - } - - property Component buttonsComponent: ScrollView { - id: scrollView - horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff - - Flickable { - anchors.fill: parent - contentWidth: viewport.width - contentHeight: buttoncolumn.implicitHeight + textMargins * 1.5 - ColumnLayout { - id: buttoncolumn - anchors.fill: parent - anchors.margins: textMargins - anchors.topMargin: textMargins / 2 - spacing: textMargins / 2 - enabled: !settingsData.allDisabled - - GroupBox { - title: "Button" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - GridLayout { - columns: Math.max(1, Math.floor(scrollView.width / button.implicitWidth - 0.5)) - Button { - id: button - text: "Normal" - } - Button { - text: "Default" - isDefault: true - } - Button { - text: "Checkable" - checkable: true - } - Button { - text: "Menu" - menu: Menu { - MenuItem { text: "Normal"; shortcut: "Ctrl+N" } - MenuSeparator { } - MenuItem { text: "Checkable 1"; checkable: true; checked: true } - MenuItem { text: "Checkable 2"; checkable: true; checked: true } - MenuSeparator { } - } - visible: Qt.application.supportsMultipleWindows - } - } - } - - GroupBox { - title: "RadioButton" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - ExclusiveGroup { id: radiobuttongroup } - ColumnLayout { - anchors.fill: parent - Repeater { - model: ["First", "Second", "Third"] - RadioButton { - text: modelData - checked: index === 0 - exclusiveGroup: radiobuttongroup - Layout.fillWidth: true - } - } - } - } - - GroupBox { - title: "CheckBox" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - ColumnLayout { - anchors.fill: parent - Repeater { - model: ["First", "Second", "Third"] - CheckBox { - text: modelData - checked: index === 0 - Layout.fillWidth: true - } - } - } - } - - GroupBox { - title: "Switch" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - ColumnLayout { - anchors.fill: parent - Repeater { - model: ["First", "Second", "Third"] - RowLayout { - spacing: layoutSpacing * 2 - Label { - text: modelData - font.family: Flat.FlatStyle.fontFamily - renderType: Text.QtRendering - Layout.preferredWidth: fontMetrics.advanceWidth("Second") - } - Switch { checked: index == 0 } - } - } - } - } - - GroupBox { - title: "ToggleButton" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - GridLayout { - columns: Math.max(1, !!children[0] ? Math.floor(scrollView.width / children[0].implicitWidth - 0.5) : children.length) - ToggleButton { - text: "Pump 1" - checked: true - } - ToggleButton { - text: "Pump 2" - checked: false - } - } - } - - GroupBox { - title: "StatusIndicator" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - GridLayout { - columns: Math.max(1, Math.floor(scrollView.width / recordButton.implicitWidth - 0.5)) - columnSpacing: layoutSpacing * 4 - - Button { - id: recordButton - text: "Record" - Layout.alignment: Qt.AlignTop - onClicked: recordStatusIndicator.active = !recordStatusIndicator.active - - StatusIndicator { - id: recordStatusIndicator - active: false - anchors.left: parent.left - anchors.leftMargin: Math.max(6, Math.round(text.implicitHeight * 0.4)) - anchors.verticalCenter: parent.verticalCenter - rotation: 90 - } - } - ColumnLayout { - Repeater { - model: 3 - delegate: RowLayout { - Layout.alignment: Qt.AlignCenter - StatusIndicator { - active: true - color: "#f09116" - } - Label { - text: "Camera " + (index + 1) - font.family: Flat.FlatStyle.fontFamily - renderType: Text.QtRendering - } - } - } - } - } - } - } - } - } - - property Component progressComponent: ScrollView { - id: scrollView - horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff - Flickable { - anchors.fill: parent - contentWidth: viewport.width - contentHeight: progresscolumn.implicitHeight + textMargins * 1.5 - ColumnLayout { - id: progresscolumn - anchors.fill: parent - anchors.leftMargin: textMargins - anchors.rightMargin: textMargins - anchors.bottomMargin: textMargins - anchors.topMargin: textMargins / 2 - spacing: textMargins / 2 - enabled: !settingsData.allDisabled - - GroupBox { - title: "BusyIndicator" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - BusyIndicator { - id: busyindicator - anchors.centerIn: parent - running: scrollView.visible - } - } - - GroupBox { - title: "ProgressBar" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - ColumnLayout { - anchors.fill: parent - ProgressBar { - value: slider.value - maximumValue: slider.maximumValue - Layout.fillWidth: true - } - ProgressBar { - indeterminate: true - value: slider.value - maximumValue: slider.maximumValue - Layout.fillWidth: true - } - } - } - - GroupBox { - title: "Slider" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - ColumnLayout { - anchors.fill: parent - Slider { - id: slider - // TODO: can't use maximumValue / 2 here, otherwise the gauges - // initially show up as empty; find out why. - value: 50 - // If we use the default value of 1 here, we run into QTBUG-42358, - // even though that report specifically uses 100 as an example... - maximumValue: 100 - Layout.fillWidth: true - } - } - } - - GroupBox { - title: "Gauge" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - Gauge { - id: gauge - value: slider.value * 1.4 - orientation: window.width < window.height ? Qt.Vertical : Qt.Horizontal - minimumValue: slider.minimumValue * 1.4 - maximumValue: slider.maximumValue * 1.4 - tickmarkStepSize: 20 - - anchors.centerIn: parent - } - } - - GroupBox { - title: "CircularGauge" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - Layout.minimumWidth: 0 - CircularGauge { - id: circularGauge - value: slider.value * 3.2 - minimumValue: slider.minimumValue * 3.2 - maximumValue: slider.maximumValue * 3.2 - - anchors.centerIn: parent - width: Math.min(implicitWidth, parent.width) - height: Math.min(implicitHeight, parent.height) - - style: Flat.CircularGaugeStyle { - tickmarkStepSize: 20 - labelStepSize: 40 - minorTickmarkCount: 2 - } - - Column { - anchors.centerIn: parent - - Label { - text: Math.floor(circularGauge.value) - anchors.horizontalCenter: parent.horizontalCenter - renderType: Text.QtRendering - font.pixelSize: unitLabel.font.pixelSize * 2 - font.family: Flat.FlatStyle.fontFamily - font.weight: Font.Light - } - Label { - id: unitLabel - text: "km/h" - renderType: Text.QtRendering - font.family: Flat.FlatStyle.fontFamily - anchors.horizontalCenter: parent.horizontalCenter - } - } - } - } - } - } - } - - property Component inputComponent: ScrollView { - id: scrollView - horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff - Flickable { - anchors.fill: parent - contentWidth: viewport.width - contentHeight: inputcolumn.implicitHeight + textMargins * 1.5 - ColumnLayout { - id: inputcolumn - anchors.fill: parent - anchors.margins: textMargins - spacing: textMargins / 2 - enabled: !settingsData.allDisabled - - GroupBox { - title: "TextField" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - ColumnLayout { - anchors.fill: parent - TextField { - z: 1 - placeholderText: "TextField" - Layout.fillWidth: true - } - TextField { - placeholderText: "Password" - echoMode: TextInput.Password // TODO: PasswordEchoOnEdit - Layout.fillWidth: true - } - } - } - - GroupBox { - title: "ComboBox" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - visible: Qt.application.supportsMultipleWindows - ColumnLayout { - anchors.fill: parent - ComboBox { - model: ["Option 1", "Option 2", "Option 3"] - Layout.fillWidth: true - } - ComboBox { - editable: true - model: ListModel { - id: combomodel - ListElement { text: "Option 1" } - ListElement { text: "Option 2" } - ListElement { text: "Option 3" } - } - onAccepted: { - if (find(currentText) === -1) { - combomodel.append({text: editText}) - currentIndex = find(editText) - } - } - Layout.fillWidth: true - } - } - } - - GroupBox { - title: "SpinBox" - checkable: settingsData.checks - flat: !settingsData.frames - Layout.fillWidth: true - GridLayout { - anchors.fill: parent - columns: Math.max(1, Math.floor(scrollView.width / spinbox.implicitWidth - 0.5)) - SpinBox { - id: spinbox - Layout.fillWidth: true - } - SpinBox { - decimals: 1 - Layout.fillWidth: true - } - } - } - } - } - } - - Component { - id: tableViewComponent - TableView { - id: view - enabled: !settingsData.allDisabled - TableViewColumn { - role: "title" - title: "Title" - width: view.width / 2 - resizable: false - movable: false - } - TableViewColumn { - role: "author" - title: "Author" - width: view.width / 2 - resizable: false - movable: false - } - - frameVisible: false - backgroundVisible: true - alternatingRowColors: false - model: ListModel { - ListElement { - title: "Moby-Dick" - author: "Herman Melville" - } - ListElement { - title: "The Adventures of Tom Sawyer" - author: "Mark Twain" - } - ListElement { - title: "Cat’s Cradle" - author: "Kurt Vonnegut" - } - ListElement { - title: "Farenheit 451" - author: "Ray Bradbury" - } - ListElement { - title: "It" - author: "Stephen King" - } - ListElement { - title: "On the Road" - author: "Jack Kerouac" - } - ListElement { - title: "Of Mice and Men" - author: "John Steinbeck" - } - ListElement { - title: "Do Androids Dream of Electric Sheep?" - author: "Philip K. Dick" - } - ListElement { - title: "Uncle Tom’s Cabin" - author: "Harriet Beecher Stowe" - } - ListElement { - title: "The Call of the Wild" - author: "Jack London" - } - ListElement { - title: "The Old Man and the Sea" - author: "Ernest Hemingway" - } - ListElement { - title: "A Streetcar Named Desire" - author: "Tennessee Williams" - } - ListElement { - title: "Catch-22" - author: "Joseph Heller" - } - ListElement { - title: "One Flew Over the Cuckoo’s Nest" - author: "Ken Kesey" - } - ListElement { - title: "The Murders in the Rue Morgue" - author: "Edgar Allan Poe" - } - ListElement { - title: "Breakfast at Tiffany’s" - author: "Truman Capote" - } - ListElement { - title: "Death of a Salesman" - author: "Arthur Miller" - } - ListElement { - title: "Post Office" - author: "Charles Bukowski" - } - ListElement { - title: "Herbert West—Reanimator" - author: "H. P. Lovecraft" - } - } - } - } - Component { - id: calendarComponent - Item { - enabled: !settingsData.allDisabled - Calendar { - anchors.centerIn: parent - weekNumbersVisible: true - frameVisible: settingsData.frames - } - } - } - Component { - id: textAreaComponent - TextArea { - enabled: !settingsData.allDisabled - frameVisible: false - flickableItem.flickableDirection: Flickable.VerticalFlick - text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum quis justo a sem faucibus mattis nec vitae nisi. Fusce fringilla nulla a tellus vehicula sodales. Etiam volutpat suscipit erat vitae adipiscing. Sed vestibulum massa nisl, eget posuere urna porta ac. Morbi at nunc ligula. Cras et mauris aliquet ligula sodales suscipit eget imperdiet augue. Ut eget dui eu magna malesuada imperdiet. Donec imperdiet urna eu consequat ornare. Cras at metus tristique, ullamcorper nisl ut, faucibus mauris. Fusce in euismod arcu. Donec tristique rutrum porta. Praesent mattis ac tortor quis scelerisque. Integer luctus nulla ut lacinia tempus." - } - } - Component { - id: pieMenuComponent - Item { - enabled: !settingsData.allDisabled - - Column { - anchors.fill: parent - anchors.bottom: parent.bottom - anchors.bottomMargin: controlData.textMargins - spacing: Math.round(controlData.textMargins * 0.5) - - Image { - id: pieMenuImage - source: "qrc:/images/piemenu-image-rgb.jpg" - fillMode: Image.PreserveAspectFit - width: parent.width - height: Math.min((width / sourceSize.width) * sourceSize.height, (parent.height - parent.spacing) * 0.88) - } - Item { - width: parent.width - height: parent.height - pieMenuImage.height - parent.spacing - - Text { - id: instructionText - anchors.fill: parent - anchors.leftMargin: controlData.textMargins - anchors.rightMargin: controlData.textMargins - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - text: "Tap and hold to open menu" - font.family: Flat.FlatStyle.fontFamily - font.pixelSize: Math.round(20 * Flat.FlatStyle.scaleFactor) - fontSizeMode: Text.Fit - color: Flat.FlatStyle.lightFrameColor - } - } - } - MouseArea { - id: mouseArea - anchors.fill: parent - onPressAndHold: pieMenu.popup(mouse.x, mouse.y) - } - PieMenu { - id: pieMenu - triggerMode: TriggerMode.TriggerOnClick - - MenuItem { - iconSource: "qrc:/images/piemenu-rgb-" + (pieMenu.currentIndex === 0 ? "pressed" : "normal") + ".png" - onTriggered: pieMenuImage.source = "qrc:/images/piemenu-image-rgb.jpg" - } - MenuItem { - iconSource: "qrc:/images/piemenu-bw-" + (pieMenu.currentIndex === 1 ? "pressed" : "normal") + ".png" - onTriggered: pieMenuImage.source = "qrc:/images/piemenu-image-bw.jpg" - } - MenuItem { - iconSource: "qrc:/images/piemenu-sepia-" + (pieMenu.currentIndex === 2 ? "pressed" : "normal") + ".png" - onTriggered: pieMenuImage.source = "qrc:/images/piemenu-image-sepia.jpg" - } - } - } - } - Component { - id: delayButtonComponent - Item { - enabled: !settingsData.allDisabled - DelayButton { - text: progress < 1 ? "START" : "STOP" - anchors.centerIn: parent - } - } - } - Component { - id: dialComponent - Item { - enabled: !settingsData.allDisabled - Dial { - anchors.centerIn: parent - } - } - } - Component { - id: tumblerComponent - Item { - enabled: !settingsData.allDisabled - Tumbler { - anchors.centerIn: parent - TumblerColumn { - model: { - var hours = []; - for (var i = 1; i <= 24; ++i) - hours.push(i < 10 ? "0" + i : i); - hours; - } - } - TumblerColumn { - model: { - var minutes = []; - for (var i = 0; i < 60; ++i) - minutes.push(i < 10 ? "0" + i : i); - minutes; - } - } - } - } - } -} diff --git a/examples/quick/extras/flat/SettingsIcon.qml b/examples/quick/extras/flat/SettingsIcon.qml deleted file mode 100644 index e494e5370..000000000 --- a/examples/quick/extras/flat/SettingsIcon.qml +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd 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.4 - -Canvas { - onPaint: { - var ctx = getContext("2d"); - ctx.reset(); - - ctx.scale(width, height); - - ctx.beginPath(); - ctx.moveTo(0.706,0.542); - ctx.bezierCurveTo(0.709,0.527,0.711,0.512,0.711,0.49700000000000005); - ctx.bezierCurveTo(0.711,0.4820000000000001,0.709,0.465,0.706,0.451); - ctx.lineTo(0.752,0.41600000000000004); - ctx.lineTo(0.759,0.41); - ctx.lineTo(0.756,0.4); - ctx.bezierCurveTo(0.756,0.399,0.749,0.382,0.737,0.36200000000000004); - ctx.bezierCurveTo(0.725,0.3420000000000001,0.714,0.328,0.714,0.327); - ctx.lineTo(0.708,0.319); - ctx.lineTo(0.698,0.324); - ctx.lineTo(0.645,0.346); - ctx.bezierCurveTo(0.623,0.32499999999999996,0.595,0.309,0.5650000000000001,0.3); - ctx.lineTo(0.558,0.243); - ctx.lineTo(0.557,0.23299999999999998); - ctx.lineTo(0.547,0.23099999999999998); - ctx.bezierCurveTo(0.546,0.23099999999999998,0.528,0.22799999999999998,0.505,0.22799999999999998); - ctx.bezierCurveTo(0.481,0.22799999999999998,0.463,0.23099999999999998,0.463,0.23099999999999998); - ctx.lineTo(0.453,0.23299999999999998); - ctx.lineTo(0.452,0.243); - ctx.lineTo(0.444,0.299); - ctx.bezierCurveTo(0.41400000000000003,0.308,0.387,0.324,0.364,0.345); - ctx.lineTo(0.312,0.323); - ctx.lineTo(0.302,0.319); - ctx.lineTo(0.296,0.327); - ctx.bezierCurveTo(0.296,0.327,0.284,0.342,0.27299999999999996,0.362); - ctx.bezierCurveTo(0.26,0.383,0.254,0.399,0.254,0.4); - ctx.lineTo(0.25,0.41); - ctx.lineTo(0.258,0.416); - ctx.lineTo(0.303,0.45099999999999996); - ctx.bezierCurveTo(0.3,0.465,0.299,0.48,0.299,0.497); - ctx.bezierCurveTo(0.299,0.513,0.3,0.528,0.304,0.543); - ctx.lineTo(0.259,0.577); - ctx.lineTo(0.25,0.584); - ctx.lineTo(0.254,0.593); - ctx.bezierCurveTo(0.254,0.594,0.261,0.61,0.273,0.63); - ctx.bezierCurveTo(0.28500000000000003,0.65,0.29500000000000004,0.664,0.29600000000000004,0.665); - ctx.lineTo(0.30200000000000005,0.673); - ctx.lineTo(0.31200000000000006,0.669); - ctx.lineTo(0.36500000000000005,0.647); - ctx.bezierCurveTo(0.38700000000000007,0.668,0.41400000000000003,0.684,0.44400000000000006,0.6930000000000001); - ctx.lineTo(0.45200000000000007,0.7510000000000001); - ctx.lineTo(0.45300000000000007,0.7620000000000001); - ctx.lineTo(0.4640000000000001,0.7630000000000001); - ctx.bezierCurveTo(0.4640000000000001,0.7630000000000001,0.4820000000000001,0.7640000000000001,0.5060000000000001,0.7640000000000001); - ctx.bezierCurveTo(0.5300000000000001,0.7640000000000001,0.5470000000000002,0.7620000000000001,0.5480000000000002,0.7620000000000001); - ctx.lineTo(0.5580000000000002,0.7610000000000001); - ctx.lineTo(0.5590000000000002,0.7510000000000001); - ctx.lineTo(0.5660000000000002,0.6940000000000001); - ctx.bezierCurveTo(0.5960000000000002,0.685,0.6230000000000002,0.669,0.6460000000000001,0.648); - ctx.lineTo(0.6990000000000002,0.67); - ctx.lineTo(0.7090000000000002,0.674); - ctx.lineTo(0.7150000000000002,0.665); - ctx.bezierCurveTo(0.7150000000000002,0.665,0.7260000000000002,0.65,0.7370000000000002,0.63); - ctx.bezierCurveTo(0.7490000000000002,0.61,0.7560000000000002,0.594,0.7560000000000002,0.593); - ctx.lineTo(0.7600000000000002,0.584); - ctx.lineTo(0.751,0.577); - ctx.lineTo(0.706,0.542); - ctx.closePath(); - ctx.moveTo(0.505,0.622); - ctx.bezierCurveTo(0.436,0.622,0.38,0.566,0.38,0.497); - ctx.bezierCurveTo(0.38,0.428,0.436,0.372,0.505,0.372); - ctx.bezierCurveTo(0.5740000000000001,0.372,0.63,0.428,0.63,0.497); - ctx.bezierCurveTo(0.63,0.565,0.574,0.622,0.505,0.622); - ctx.closePath(); - ctx.fillStyle = "#333333"; - ctx.fill(); - } -} diff --git a/examples/quick/extras/flat/flat.pro b/examples/quick/extras/flat/flat.pro deleted file mode 100644 index 387e7ca09..000000000 --- a/examples/quick/extras/flat/flat.pro +++ /dev/null @@ -1,16 +0,0 @@ -TEMPLATE = app -TARGET = flat -QT += quick - -SOURCES += \ - main.cpp - -RESOURCES += \ - flat.qrc - -OTHER_FILES += \ - main.qml - -DISTFILES += \ - Content.qml \ - SettingsIcon.qml diff --git a/examples/quick/extras/flat/flat.qrc b/examples/quick/extras/flat/flat.qrc deleted file mode 100644 index 5b06a55ce..000000000 --- a/examples/quick/extras/flat/flat.qrc +++ /dev/null @@ -1,16 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>main.qml</file> - <file>images/piemenu-bw-normal.png</file> - <file>images/piemenu-bw-pressed.png</file> - <file>images/piemenu-rgb-normal.png</file> - <file>images/piemenu-rgb-pressed.png</file> - <file>images/piemenu-sepia-normal.png</file> - <file>images/piemenu-sepia-pressed.png</file> - <file>images/piemenu-image-bw.jpg</file> - <file>images/piemenu-image-rgb.jpg</file> - <file>images/piemenu-image-sepia.jpg</file> - <file>Content.qml</file> - <file>SettingsIcon.qml</file> - </qresource> -</RCC> diff --git a/examples/quick/extras/flat/images/piemenu-bw-normal.png b/examples/quick/extras/flat/images/piemenu-bw-normal.png Binary files differdeleted file mode 100644 index ef57111fb..000000000 --- a/examples/quick/extras/flat/images/piemenu-bw-normal.png +++ /dev/null diff --git a/examples/quick/extras/flat/images/piemenu-bw-pressed.png b/examples/quick/extras/flat/images/piemenu-bw-pressed.png Binary files differdeleted file mode 100644 index b6bd1d20d..000000000 --- a/examples/quick/extras/flat/images/piemenu-bw-pressed.png +++ /dev/null diff --git a/examples/quick/extras/flat/images/piemenu-image-bw.jpg b/examples/quick/extras/flat/images/piemenu-image-bw.jpg Binary files differdeleted file mode 100644 index ce4d8ffda..000000000 --- a/examples/quick/extras/flat/images/piemenu-image-bw.jpg +++ /dev/null diff --git a/examples/quick/extras/flat/images/piemenu-image-rgb.jpg b/examples/quick/extras/flat/images/piemenu-image-rgb.jpg Binary files differdeleted file mode 100644 index 2d7d22056..000000000 --- a/examples/quick/extras/flat/images/piemenu-image-rgb.jpg +++ /dev/null diff --git a/examples/quick/extras/flat/images/piemenu-image-sepia.jpg b/examples/quick/extras/flat/images/piemenu-image-sepia.jpg Binary files differdeleted file mode 100644 index 3ef7b1f0f..000000000 --- a/examples/quick/extras/flat/images/piemenu-image-sepia.jpg +++ /dev/null diff --git a/examples/quick/extras/flat/images/piemenu-rgb-normal.png b/examples/quick/extras/flat/images/piemenu-rgb-normal.png Binary files differdeleted file mode 100644 index 2278f4a9e..000000000 --- a/examples/quick/extras/flat/images/piemenu-rgb-normal.png +++ /dev/null diff --git a/examples/quick/extras/flat/images/piemenu-rgb-pressed.png b/examples/quick/extras/flat/images/piemenu-rgb-pressed.png Binary files differdeleted file mode 100644 index f45846b17..000000000 --- a/examples/quick/extras/flat/images/piemenu-rgb-pressed.png +++ /dev/null diff --git a/examples/quick/extras/flat/images/piemenu-sepia-normal.png b/examples/quick/extras/flat/images/piemenu-sepia-normal.png Binary files differdeleted file mode 100644 index f1e9ffd26..000000000 --- a/examples/quick/extras/flat/images/piemenu-sepia-normal.png +++ /dev/null diff --git a/examples/quick/extras/flat/images/piemenu-sepia-pressed.png b/examples/quick/extras/flat/images/piemenu-sepia-pressed.png Binary files differdeleted file mode 100644 index 0f2b35171..000000000 --- a/examples/quick/extras/flat/images/piemenu-sepia-pressed.png +++ /dev/null diff --git a/examples/quick/extras/flat/main.cpp b/examples/quick/extras/flat/main.cpp deleted file mode 100644 index 57f48cda2..000000000 --- a/examples/quick/extras/flat/main.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd 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 <QtGui/QGuiApplication> -#include <QtQml/QQmlApplicationEngine> -#include <QtGui/QFontDatabase> -#include <QtCore/QDir> - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - if (qgetenv("QT_QUICK_CONTROLS_STYLE").isEmpty()) { -#ifdef QT_STATIC - // Need a full path to find the style when built statically - qputenv("QT_QUICK_CONTROLS_STYLE", ":/ExtrasImports/QtQuick/Controls/Styles/Flat"); -#else - qputenv("QT_QUICK_CONTROLS_STYLE", "Flat"); -#endif - } - QQmlApplicationEngine engine; - engine.load(QUrl("qrc:/main.qml")); - if (engine.rootObjects().isEmpty()) - return -1; - return app.exec(); -} diff --git a/examples/quick/extras/flat/main.qml b/examples/quick/extras/flat/main.qml deleted file mode 100644 index aec94c368..000000000 --- a/examples/quick/extras/flat/main.qml +++ /dev/null @@ -1,479 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company Ltd 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.4 -import QtQuick.Layouts 1.0 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -import QtQuick.Extras 1.4 -import QtQuick.Extras.Private 1.0 - -ApplicationWindow { - id: window - width: 480 - height: 860 - title: "Flat Example" - visible: true - - readonly property bool contentLoaded: contentLoader.item - readonly property alias anchorItem: controlsMenu - property int currentMenu: -1 - readonly property int textMargins: Math.round(32 * Flat.FlatStyle.scaleFactor) - readonly property int menuMargins: Math.round(13 * Flat.FlatStyle.scaleFactor) - readonly property int menuWidth: Math.min(window.width, window.height) * 0.75 - - onCurrentMenuChanged: { - xBehavior.enabled = true; - anchorCurrentMenu(); - } - - onMenuWidthChanged: anchorCurrentMenu() - - function anchorCurrentMenu() { - switch (currentMenu) { - case -1: - anchorItem.x = -menuWidth; - break; - case 0: - anchorItem.x = 0; - break; - case 1: - anchorItem.x = -menuWidth * 2; - break; - } - } - - Item { - id: container - anchors.fill: parent - - Item { - id: loadingScreen - anchors.fill: parent - visible: !contentLoaded - - Timer { - running: true - interval: 100 - // TODO: Find a way to know when the loading screen has been rendered instead - // of using an abritrary amount of time. - onTriggered: contentLoader.sourceComponent = Qt.createComponent("Content.qml") - } - - Column { - anchors.centerIn: parent - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - - BusyIndicator { - anchors.horizontalCenter: parent.horizontalCenter - } - - Label { - text: "Loading Light Flat UI..." - width: Math.min(loadingScreen.width, loadingScreen.height) * 0.8 - height: font.pixelSize - anchors.horizontalCenter: parent.horizontalCenter - renderType: Text.QtRendering - font.pixelSize: Math.round(26 * Flat.FlatStyle.scaleFactor) - horizontalAlignment: Text.AlignHCenter - fontSizeMode: Text.Fit - font.family: Flat.FlatStyle.fontFamily - font.weight: Font.Light - } - } - } - - Rectangle { - id: controlsMenu - x: container.x - width - z: contentContainer.z + 1 - width: menuWidth - height: parent.height - - // Don't let the menus become visible when resizing the window - Binding { - target: controlsMenu - property: "x" - value: container.x - controlsMenu.width - when: !xBehavior.enabled && !xNumberAnimation.running && currentMenu == -1 - } - - Behavior on x { - id: xBehavior - enabled: false - NumberAnimation { - id: xNumberAnimation - easing.type: Easing.OutExpo - duration: 500 - onRunningChanged: xBehavior.enabled = false - } - } - - Rectangle { - id: controlsTitleBar - width: parent.width - height: toolBar.height - color: Flat.FlatStyle.defaultTextColor - - Label { - text: "Controls" - font.family: Flat.FlatStyle.fontFamily - font.pixelSize: Math.round(16 * Flat.FlatStyle.scaleFactor) - renderType: Text.QtRendering - color: "white" - anchors.left: parent.left - anchors.leftMargin: menuMargins - anchors.verticalCenter: parent.verticalCenter - } - } - - ListView { - id: controlView - width: parent.width - anchors.top: controlsTitleBar.bottom - anchors.bottom: parent.bottom - clip: true - currentIndex: 0 - model: contentLoaded ? contentLoader.item.componentModel : null - delegate: MouseArea { - id: delegateItem - width: parent.width - height: 64 * Flat.FlatStyle.scaleFactor - onClicked: { - if (controlView.currentIndex != index) - controlView.currentIndex = index; - - currentMenu = -1; - } - - Rectangle { - width: parent.width - height: Flat.FlatStyle.onePixel - anchors.bottom: parent.bottom - color: Flat.FlatStyle.lightFrameColor - } - - Label { - text: delegateItem.ListView.view.model[index].name - font.pixelSize: Math.round(15 * Flat.FlatStyle.scaleFactor) - font.family: Flat.FlatStyle.fontFamily - renderType: Text.QtRendering - color: delegateItem.ListView.isCurrentItem ? Flat.FlatStyle.styleColor : Flat.FlatStyle.defaultTextColor - anchors.left: parent.left - anchors.leftMargin: menuMargins - anchors.verticalCenter: parent.verticalCenter - } - } - - Rectangle { - width: parent.height - height: 8 * Flat.FlatStyle.scaleFactor - rotation: 90 - anchors.left: parent.right - transformOrigin: Item.TopLeft - - gradient: Gradient { - GradientStop { - color: Qt.rgba(0, 0, 0, 0.15) - position: 0 - } - GradientStop { - color: Qt.rgba(0, 0, 0, 0.05) - position: 0.5 - } - GradientStop { - color: Qt.rgba(0, 0, 0, 0) - position: 1 - } - } - } - } - } - - Item { - id: contentContainer - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.left: controlsMenu.right - width: parent.width - - ToolBar { - id: toolBar - visible: !loadingScreen.visible - width: parent.width - height: 54 * Flat.FlatStyle.scaleFactor - z: contentLoader.z + 1 - style: Flat.ToolBarStyle { - padding.left: 0 - padding.right: 0 - } - - RowLayout { - anchors.fill: parent - - MouseArea { - id: controlsButton - Layout.preferredWidth: toolBar.height + textMargins - Layout.preferredHeight: toolBar.height - onClicked: currentMenu = currentMenu == 0 ? -1 : 0 - - Column { - id: controlsIcon - anchors.left: parent.left - anchors.leftMargin: textMargins - anchors.verticalCenter: parent.verticalCenter - spacing: Math.round(2 * Flat.FlatStyle.scaleFactor) - - Repeater { - model: 3 - - Rectangle { - width: Math.round(4 * Flat.FlatStyle.scaleFactor) - height: width - radius: width / 2 - color: Flat.FlatStyle.defaultTextColor - } - } - } - } - - Text { - text: "Light Flat UI Demo" - font.family: Flat.FlatStyle.fontFamily - font.pixelSize: Math.round(16 * Flat.FlatStyle.scaleFactor) - horizontalAlignment: Text.AlignHCenter - color: "#666666" - Layout.fillWidth: true - } - - MouseArea { - id: settingsButton - Layout.preferredWidth: controlsButton.Layout.preferredWidth - Layout.preferredHeight: controlsButton.Layout.preferredHeight - onClicked: currentMenu = currentMenu == 1 ? -1 : 1 - - SettingsIcon { - width: Math.round(32 * Flat.FlatStyle.scaleFactor) - height: Math.round(32 * Flat.FlatStyle.scaleFactor) - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: textMargins - Math.round(8 * Flat.FlatStyle.scaleFactor) - } - } - } - } - - Loader { - id: contentLoader - anchors.left: parent.left - anchors.right: parent.right - anchors.top: toolBar.bottom - anchors.bottom: parent.bottom - - property QtObject settingsData: QtObject { - readonly property bool checks: disableSingleItemsAction.checked - readonly property bool frames: !greyBackgroundAction.checked - readonly property bool allDisabled: disableAllAction.checked - } - property QtObject controlData: QtObject { - readonly property int componentIndex: controlView.currentIndex - readonly property int textMargins: window.textMargins - } - - MouseArea { - enabled: currentMenu != -1 - // We would be able to just set this to true here, if it weren't for QTBUG-43083. - hoverEnabled: enabled - anchors.fill: parent - preventStealing: true - onClicked: currentMenu = -1 - focus: enabled - z: 1000 - } - } - } - - Rectangle { - id: settingsMenu - z: contentContainer.z + 1 - width: menuWidth - height: parent.height - anchors.left: contentContainer.right - - Rectangle { - id: optionsTitleBar - width: parent.width - height: toolBar.height - color: Flat.FlatStyle.defaultTextColor - - Label { - text: "Options" - font.family: Flat.FlatStyle.fontFamily - font.pixelSize: Math.round(16 * Flat.FlatStyle.scaleFactor) - renderType: Text.QtRendering - color: "white" - anchors.left: parent.left - anchors.leftMargin: menuMargins - anchors.verticalCenter: parent.verticalCenter - } - } - - Action { - id: disableAllAction - checkable: true - checked: false - } - - Action { - id: disableSingleItemsAction - checkable: true - checked: false - } - - Action { - id: greyBackgroundAction - checkable: true - checked: false - } - - ListView { - id: optionsListView - width: parent.width - anchors.top: optionsTitleBar.bottom - anchors.bottom: parent.bottom - clip: true - interactive: delegateHeight * count > height - - readonly property int delegateHeight: 64 * Flat.FlatStyle.scaleFactor - - model: [ - { name: "Disable all", action: disableAllAction }, - { name: "Disable single items", action: disableSingleItemsAction }, - { name: "Grey background", action: greyBackgroundAction }, - { name: "Exit", action: null } - ] - delegate: Rectangle { - id: optionDelegateItem - width: parent.width - height: optionsListView.delegateHeight - - Rectangle { - width: parent.width - height: Flat.FlatStyle.onePixel - anchors.bottom: parent.bottom - color: Flat.FlatStyle.lightFrameColor - } - - Loader { - sourceComponent: optionText !== "Exit" - ? optionsListView.checkBoxComponent : optionsListView.exitComponent - anchors.fill: parent - anchors.leftMargin: menuMargins - - property string optionText: optionsListView.model[index].name - property int optionIndex: index - } - } - - property Component checkBoxComponent: Item { - Label { - text: optionText - font.family: Flat.FlatStyle.fontFamily - font.pixelSize: Math.round(15 * Flat.FlatStyle.scaleFactor) - fontSizeMode: Text.Fit - renderType: Text.QtRendering - verticalAlignment: Text.AlignVCenter - color: Flat.FlatStyle.defaultTextColor - height: parent.height - anchors.left: parent.left - anchors.right: checkBox.left - anchors.rightMargin: Flat.FlatStyle.twoPixels - } - - CheckBox { - id: checkBox - checked: optionsListView.model[optionIndex].action.checked - anchors.right: parent.right - anchors.rightMargin: menuMargins - anchors.verticalCenter: parent.verticalCenter - onCheckedChanged: optionsListView.model[optionIndex].action.checked = checkBox.checked - } - } - - property Component exitComponent: MouseArea { - anchors.fill: parent - onClicked: Qt.quit() - - Label { - text: optionText - font.family: Flat.FlatStyle.fontFamily - font.pixelSize: Math.round(15 * Flat.FlatStyle.scaleFactor) - renderType: Text.QtRendering - color: Flat.FlatStyle.defaultTextColor - anchors.verticalCenter: parent.verticalCenter - } - } - - Rectangle { - width: parent.height - height: 8 * Flat.FlatStyle.scaleFactor - rotation: -90 - anchors.right: parent.left - transformOrigin: Item.TopRight - - gradient: Gradient { - GradientStop { - color: Qt.rgba(0, 0, 0, 0.15) - position: 0 - } - GradientStop { - color: Qt.rgba(0, 0, 0, 0.05) - position: 0.5 - } - GradientStop { - color: Qt.rgba(0, 0, 0, 0) - position: 1 - } - } - } - } - } - } -} |
