From 53240b099cf801ec51e5facdf159e35a3fef2cd9 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 15 Oct 2018 12:55:42 +0200 Subject: Remove old 'Getting started with Qt Quick' example The example is actually not very easy to build, and arguably too complex for a 'getting started' example. qtdoc commit 1df7011858 therefore replaced it by the alarms example in the documentation. Task-number: QTBUG-66064 Change-Id: I2f2776c649410575aef71948f64b358d60233022 Reviewed-by: Mitch Curtis Reviewed-by: Nico Vertriest --- .../tutorials/gettingStartedQml/core/Button.qml | 118 ---------- .../tutorials/gettingStartedQml/core/EditMenu.qml | 122 ---------- .../gettingStartedQml/core/FileDialog.qml | 189 --------------- .../tutorials/gettingStartedQml/core/FileMenu.qml | 255 --------------------- .../tutorials/gettingStartedQml/core/MenuBar.qml | 167 -------------- .../tutorials/gettingStartedQml/core/TextArea.qml | 101 -------- .../gettingStartedQml/filedialog/dialogPlugin.cpp | 62 ----- .../gettingStartedQml/filedialog/dialogPlugin.h | 67 ------ .../gettingStartedQml/filedialog/directory.cpp | 237 ------------------- .../gettingStartedQml/filedialog/directory.h | 116 ---------- .../gettingStartedQml/filedialog/file.cpp | 68 ------ .../tutorials/gettingStartedQml/filedialog/file.h | 76 ------ .../gettingStartedQml/filedialog/filedialog.pro | 28 --- .../tutorials/gettingStartedQml/filedialog/qmldir | 2 - .../gettingStartedQml/gettingStartedQml.pro | 11 - .../tutorials/gettingStartedQml/images/arrow.png | Bin 411 -> 0 bytes .../pics/qml-texteditor5_editmenu.png | Bin 65123 -> 0 bytes .../pics/qml-texteditor5_filemenu.png | Bin 21367 -> 0 bytes .../pics/qml-texteditor5_newfile.png | Bin 76693 -> 0 bytes .../tutorials/gettingStartedQml/texteditor.qml | 145 ------------ .../gettingStartedQml/texteditor.qmlproject | 20 -- examples/quick/tutorials/tutorials.pro | 1 - 22 files changed, 1785 deletions(-) delete mode 100644 examples/quick/tutorials/gettingStartedQml/core/Button.qml delete mode 100644 examples/quick/tutorials/gettingStartedQml/core/EditMenu.qml delete mode 100644 examples/quick/tutorials/gettingStartedQml/core/FileDialog.qml delete mode 100644 examples/quick/tutorials/gettingStartedQml/core/FileMenu.qml delete mode 100644 examples/quick/tutorials/gettingStartedQml/core/MenuBar.qml delete mode 100644 examples/quick/tutorials/gettingStartedQml/core/TextArea.qml delete mode 100644 examples/quick/tutorials/gettingStartedQml/filedialog/dialogPlugin.cpp delete mode 100644 examples/quick/tutorials/gettingStartedQml/filedialog/dialogPlugin.h delete mode 100644 examples/quick/tutorials/gettingStartedQml/filedialog/directory.cpp delete mode 100644 examples/quick/tutorials/gettingStartedQml/filedialog/directory.h delete mode 100644 examples/quick/tutorials/gettingStartedQml/filedialog/file.cpp delete mode 100644 examples/quick/tutorials/gettingStartedQml/filedialog/file.h delete mode 100644 examples/quick/tutorials/gettingStartedQml/filedialog/filedialog.pro delete mode 100644 examples/quick/tutorials/gettingStartedQml/filedialog/qmldir delete mode 100644 examples/quick/tutorials/gettingStartedQml/gettingStartedQml.pro delete mode 100644 examples/quick/tutorials/gettingStartedQml/images/arrow.png delete mode 100644 examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_editmenu.png delete mode 100644 examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_filemenu.png delete mode 100644 examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_newfile.png delete mode 100644 examples/quick/tutorials/gettingStartedQml/texteditor.qml delete mode 100644 examples/quick/tutorials/gettingStartedQml/texteditor.qmlproject (limited to 'examples') diff --git a/examples/quick/tutorials/gettingStartedQml/core/Button.qml b/examples/quick/tutorials/gettingStartedQml/core/Button.qml deleted file mode 100644 index d0c2b6406a..0000000000 --- a/examples/quick/tutorials/gettingStartedQml/core/Button.qml +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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.0 - -Rectangle { - // Identifier of the item - id: button - - // These properties act as constants, useable outside this QML file - property int buttonHeight: 75 - property int buttonWidth: 150 - - // Attaches to the Text element's text content - property string label - property color textColor: buttonLabel.color - - // The color highlight when the mouse hovers on the rectangle - property color onHoverColor: "lightsteelblue" - property color borderColor: "transparent" - - // buttonColor is set to the button's main color - property color buttonColor: "lightblue" - - property real labelSize: 14 - // Set appearance properties - radius: 6 - antialiasing: true - border.width: 2 - border.color: borderColor - width: buttonWidth - height: buttonHeight - - Text { - id: buttonLabel - anchors.centerIn: parent - text: label // Bind the text to the parent's text - color: "#DCDCCC" - font.pointSize: labelSize - } - - // buttonClick() is callable and a signal handler, - // onButtonClick is automatically created - signal buttonClick() - - // Define the clickable area to be the whole rectangle - MouseArea { - id: buttonMouseArea - anchors.fill: parent // Stretch the area to the parent's dimension - onClicked: buttonClick() - - // If true, then onEntered and onExited called if mouse hovers in the mouse area - // If false, a button must be clicked to detect the mouse hover - hoverEnabled: true - - // Display a border if the mouse hovers on the button mouse area - onEntered: parent.border.color = onHoverColor - //Remove the border if the mouse exits the button mouse area - onExited: parent.border.color = borderColor - } - - // Change the color of the button when pressed - color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor - // Animate the color whenever the color property changes - Behavior on color { ColorAnimation { duration: 55 } } - - // Scale the button when pressed - scale: buttonMouseArea.pressed ? 1.1 : 1.0 - // Animate the scale property change - Behavior on scale { NumberAnimation { duration: 55 } } -} diff --git a/examples/quick/tutorials/gettingStartedQml/core/EditMenu.qml b/examples/quick/tutorials/gettingStartedQml/core/EditMenu.qml deleted file mode 100644 index 46b935a98c..0000000000 --- a/examples/quick/tutorials/gettingStartedQml/core/EditMenu.qml +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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.0 - -Rectangle { - id: editMenu - width: 1000; height: 480 - color: "powderblue" - property color buttonBorderColor: "#7A8182" - property color buttonFillColor: "#61BDCACD" - property string menuName:"Edit" - - gradient: Gradient { - GradientStop { position: 0.0; color: "#6A7570" } - GradientStop { position: 1.0; color: Qt.darker("#6A7570") } - } - - Rectangle { - id: actionContainer - color: "transparent" - anchors.centerIn: parent - width: parent.width - height: parent.height / 5 - - Row { - anchors.centerIn: parent - spacing: parent.width / 9 - Button { - id: loadButton - buttonColor: buttonFillColor - label: "Copy" - labelSize: 16 - borderColor: buttonBorderColor - height: actionContainer.height - width: actionContainer.width / 6 - onButtonClick: textArea.copy() - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor, 1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor, 1.3) } - } - } - - Button { - id: saveButton - height: actionContainer.height - width: actionContainer.width / 6 - buttonColor: buttonFillColor - label: "Paste" - borderColor: buttonBorderColor - labelSize: 16 - onButtonClick: textArea.paste() - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor, 1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor, 1.3) } - } - } - - Button { - id: exitButton - label: "Select All" - height: actionContainer.height - width: actionContainer.width/6 - labelSize: 16 - buttonColor: buttonFillColor - borderColor: buttonBorderColor - onButtonClick: textArea.selectAll() - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor, 1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor, 1.3) } - } - } - } - } -} diff --git a/examples/quick/tutorials/gettingStartedQml/core/FileDialog.qml b/examples/quick/tutorials/gettingStartedQml/core/FileDialog.qml deleted file mode 100644 index 08728433e0..0000000000 --- a/examples/quick/tutorials/gettingStartedQml/core/FileDialog.qml +++ /dev/null @@ -1,189 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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.0 - -Rectangle { - id: dialog - width: 200 - height: 200 * partition - color: "transparent" - - signal selectChanged() - signal notifyRefresh() - onNotifyRefresh: dirView.model = directory.files - - property string selectedFile - property int selectedIndex: 0 - - Rectangle { - id: dirBox - radius: 10 - antialiasing: true - anchors.centerIn: parent - height: parent.height -15 - width: parent.width - 30 - - Rectangle { - id: header - height: parent.height * 0.1 - width: parent.width - radius: 3 - antialiasing: true - z: 1 - gradient: Gradient { - GradientStop { position: 0.0; color: "#8C8F8C" } - GradientStop { position: 0.17; color: "#6A6D6A" } - GradientStop { position: 0.98;color: "#3F3F3F" } - GradientStop { position: 1.0; color: "#0e1B20" } - } - Text { - height: header.height - anchors.centerIn: header - text: "files:" - color: "lightblue" - font.weight: Font.Light - font.italic: true - } - } - - GridView { - id: dirView - width: parent.width - height: parent.height * 0.9 - anchors.top: header.bottom - cellWidth: 100 - cellHeight: 75 - model: directory.files - delegate: dirDelegate - clip: true - highlightMoveDuration: 40 - } - - Component { - id: dirDelegate - - Rectangle { - id: file - color: "transparent" - width: dirView.cellWidth - height: dirView.cellHeight - - Text { - id: fileName - width: parent.width - anchors.centerIn: parent - text: name - color: "#BDCACD" - font.weight: dirView.currentIndex == index ? Font.DemiBold : Font.Normal - font.pointSize: dirView.currentIndex == index ? 12 : 10 - elide: Text.ElideMiddle - horizontalAlignment: Text.AlignHCenter - } - - Rectangle { - id: selection - width: parent.width - height: parent.height - anchors.centerIn: parent - radius: 10 - antialiasing: true - scale: dirView.currentIndex == index ? 1 : 0.5 - opacity: dirView.currentIndex == index ? 1 : 0 - - Text { - id: overlay - width: parent.width - anchors.centerIn: parent - text: name - color: "#696167" - font.weight: Font.DemiBold - font.pointSize: 12 - elide: Text.ElideMiddle - horizontalAlignment: Text.AlignHCenter - } - - Behavior on opacity { NumberAnimation{ duration: 45 } } - Behavior on scale { NumberAnimation{ duration: 45 } } - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter("lightsteelblue", 1.25) } - GradientStop { position: 0.67; color: Qt.darker("lightsteelblue", 1.30) } - } - border.color: "lightsteelblue" - border.width: 1 - } - - MouseArea { - id: fileMouseArea - anchors.fill: parent - hoverEnabled: true - - onClicked: { - dirView.currentIndex = index - selectedFile = directory.files[index].name - selectChanged() - } - onEntered: { - fileName.color = "lightsteelblue" - fileName.font.weight = Font.DemiBold - } - onExited: { - fileName.font.weight = Font.Normal - fileName.color = "#BDCACD" - } - } - } - } - - gradient: Gradient { - GradientStop { position: 0.0; color: "#A5333333" } - GradientStop { position: 1.0; color: "#03333333" } - } - } -} diff --git a/examples/quick/tutorials/gettingStartedQml/core/FileMenu.qml b/examples/quick/tutorials/gettingStartedQml/core/FileMenu.qml deleted file mode 100644 index c52dc2933f..0000000000 --- a/examples/quick/tutorials/gettingStartedQml/core/FileMenu.qml +++ /dev/null @@ -1,255 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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.0 -import FileDialog 1.0 - -Rectangle { - id: fileMenu - height: 480 - width: 1000 - property color buttonBorderColor: "#7F8487" - property color buttonFillColor: "#8FBDCACD" - property string fileContent: directory.fileContent - - // menuName is accessible from outside this QML file - property string menuName: "File" - - // Used to divide the screen into parts - property real partition: 1 / 3 - - color: "#6C646A" - gradient: Gradient { - GradientStop { position: 0.0; color: "#6C646A" } - GradientStop { position: 1.0; color: Qt.darker("#6A6D6A") } - } - - Directory { - id: directory - filename: textInput.text - onDirectoryChanged: fileDialog.notifyRefresh() - } - - Rectangle { - id: actionContainer - - // Make this rectangle invisible - color: "transparent" - anchors.left: parent.left - - // The height is a good proportion that creates more space at the - // top of the column of buttons - width: fileMenu.width * partition - height: fileMenu.height - - Column { - anchors.centerIn: parent - spacing: parent.height / 32 - - Button { - id: saveButton - label: "Save" - borderColor: buttonBorderColor - buttonColor: buttonFillColor - width: actionContainer.width / 1.3 - height: actionContainer.height / 8 - labelSize: 24 - onButtonClick: { - directory.fileContent = textArea.textContent - directory.filename = textInput.text - directory.saveFile() - } - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - - Button { - id: loadButton - width: actionContainer.width / 1.3 - height: actionContainer.height / 8 - buttonColor: buttonFillColor - borderColor: buttonBorderColor - label: "Load" - labelSize: 24 - onButtonClick: { - directory.filename = textInput.text - directory.loadFile() - textArea.textContent = directory.fileContent - } - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - Button { - id: newButton - width: actionContainer.width / 1.3 - height: actionContainer.height / 8 - buttonColor: buttonFillColor - borderColor: buttonBorderColor - label: "New" - labelSize: 24 - onButtonClick: { - textArea.textContent = "" - textInput.text = "" - } - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - Rectangle{ - id: space - width: actionContainer.width/ 1.3 - height: actionContainer.height / 16 - color: "transparent" - } - Button { - id: exitButton - width: actionContainer.width / 1.3 - height: actionContainer.height / 8 - label: "Exit" - labelSize: 24 - buttonColor: buttonFillColor - borderColor: buttonBorderColor - onButtonClick: Qt.quit() - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(buttonFillColor,1.25) } - GradientStop { position: 0.67; color: Qt.darker(buttonFillColor,1.3) } - } - } - } - } - - Rectangle { - id: dialogContainer - - width: 2 * fileMenu.width * partition - height: fileMenu.height - anchors.right: parent.right - color: "transparent" - - Column { - anchors.centerIn: parent - spacing: parent.height / 640 - FileDialog { - id: fileDialog - height: 2 * dialogContainer.height * partition - width: dialogContainer.width - onSelectChanged: textInput.text = selectedFile - } - - Rectangle { - id: lowerPartition - height: dialogContainer.height * partition - width: dialogContainer.width - color: "transparent" - - Rectangle { - id: nameField - - gradient: Gradient{ - GradientStop { position: 0.0; color: "#806F6F6F" } - GradientStop { position: 1.0; color: "#136F6F6F" } - } - - radius: 10 - anchors { centerIn: parent; leftMargin: 15; rightMargin: 15; topMargin: 15 } - height: parent.height - 15 - width: parent.width - 20 - border { color:"#4A4A4A"; width: 1 } - - TextInput { - id: textInput - z: 2 - anchors { bottom: parent.bottom; topMargin: 10; horizontalCenter: parent.horizontalCenter } - width: parent.width - 10 - height: parent.height - 10 - font.pointSize: 40 - color: "lightsteelblue" - focus: true - } - - Text { - id: textInstruction - anchors.centerIn: parent - text: "Select file name and press Save or Load" - font { pointSize: 11; weight: Font.Light; italic: true } - color: "lightblue" - z: 2 - opacity: (textInput.text == "") ? 1 : 0 - } - - Text { - id: fieldLabel - anchors { top: parent.top; left: parent.left } - text: " file name: " - font { pointSize: 11; weight: Font.Light; italic: true } - color: "lightblue" - z: 2 - } - - MouseArea { - anchors.centerIn: parent - width: nameField.width - height: nameField.height - onClicked: { - textInput.text = "" - textInput.focus = true - textInput.forceFocus() - } - } - } - } - } - } -} diff --git a/examples/quick/tutorials/gettingStartedQml/core/MenuBar.qml b/examples/quick/tutorials/gettingStartedQml/core/MenuBar.qml deleted file mode 100644 index 6cc10f3c92..0000000000 --- a/examples/quick/tutorials/gettingStartedQml/core/MenuBar.qml +++ /dev/null @@ -1,167 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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.0 -import QtQml.Models 2.1 - -Rectangle { - id: menuBar - width: 1000; height: 300 - color: "transparent" - property color fileColor: "plum" - property color editColor: "powderblue" - - property real partition: 1 / 10 - - Column { - anchors.fill: parent - z: 1 - - // Container for the header and the buttons - Rectangle { - id: labelList - height: menuBar.height * partition - width: menuBar.width - color: "beige" - gradient: Gradient { - GradientStop { position: 0.0; color: "#8C8F8C" } - GradientStop { position: 0.17; color: "#6A6D6A" } - GradientStop { position: 0.98;color: "#3F3F3F" } - GradientStop { position: 1.0; color: "#0e1B20" } - } - - Text { - height: parent.height - anchors { right: labelRow.left; verticalCenter: parent.bottom } - text: "menu: " - color: "lightblue" - font { weight: Font.Light; italic: true } - } - - // Row displays its children in a vertical row - Row { - id: labelRow - anchors.centerIn: parent - spacing: 40 - - Button { - id: fileButton - width: 50; height: 20 - label: "File" - buttonColor: menuListView.currentIndex == 0 ? fileColor : Qt.darker(fileColor, 1.5) - scale: menuListView.currentIndex == 0 ? 1.25 : 1 - labelSize: menuListView.currentIndex == 0 ? 16 : 12 - radius: 1 - - // On a button click, change the list's currently selected item to FileMenu - onButtonClick: menuListView.currentIndex = 0 - - gradient: Gradient { - GradientStop { position: 0.0; color: fileColor } - GradientStop { position: 1.0; color: "#136F6F6F" } - } - } - - Button { - id: editButton - width: 50; height: 20 - buttonColor : menuListView.currentIndex == 1 ? Qt.darker(editColor, 1.5) : Qt.darker(editColor, 1.9) - scale: menuListView.currentIndex == 1 ? 1.25 : 1 - label: "Edit" - radius: 1 - labelSize: menuListView.currentIndex == 1 ? 16 : 12 - - //on a button click, change the list's currently selected item to EditMenu - onButtonClick: menuListView.currentIndex = 1 - gradient: Gradient { - GradientStop { position: 0.0; color: editColor } - GradientStop { position: 1.0; color: "#136F6F6F" } - } - } - } - } - - // A ListView will display a model according to a delegate - ListView { - id: menuListView - width: menuBar.width - height: 9 * menuBar.height * partition - - // The model contains the data - model: menuListModel - - //control the movement of the menu switching - snapMode: ListView.SnapOneItem - orientation: ListView.Horizontal - boundsBehavior: Flickable.StopAtBounds - flickDeceleration: 5000 - highlightFollowsCurrentItem: true - highlightMoveDuration: 240 - highlightRangeMode: ListView.StrictlyEnforceRange - } - } - - // A list of visual items that already have delegates handling their display - ObjectModel { - id: menuListModel - - FileMenu { - id: fileMenu - width: menuListView.width - height: menuListView.height - color: fileColor - } - EditMenu { - color: editColor - width: menuListView.width - height: menuListView.height - } - } -} diff --git a/examples/quick/tutorials/gettingStartedQml/core/TextArea.qml b/examples/quick/tutorials/gettingStartedQml/core/TextArea.qml deleted file mode 100644 index 5a436f277b..0000000000 --- a/examples/quick/tutorials/gettingStartedQml/core/TextArea.qml +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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.0 - -Rectangle { - id: textArea - - function paste() { textEdit.paste() } - function copy() { textEdit.copy() } - function selectAll() { textEdit.selectAll() } - - width: 400; height: 400 - - property color fontColor: "white" - property alias textContent: textEdit.text - - Flickable { - id: flickArea - width: parent.width - height: parent.height - anchors.fill: parent - - boundsBehavior: Flickable.StopAtBounds - flickableDirection: Flickable.HorizontalFlick - interactive: true - - // Move the content coordinates to make the text area - // visible when scrolled with keyboard strokes - function ensureVisible(r) { - if (contentX >= r.x) - contentX = r.x; - else if (contentX + width <= r.x + r.width) - contentX = r.x + r.width - width; - if (contentY >= r.y) - contentY = r.y; - else if (contentY + height <= r.y + r.height) - contentY = r.y + r.height - height; - } - - TextEdit { - id: textEdit - anchors.fill: parent - width: parent.width - height: parent.height - color: fontColor - focus: true - wrapMode: TextEdit.Wrap - font.pointSize: 10 - onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) - selectByMouse: true - } - } -} diff --git a/examples/quick/tutorials/gettingStartedQml/filedialog/dialogPlugin.cpp b/examples/quick/tutorials/gettingStartedQml/filedialog/dialogPlugin.cpp deleted file mode 100644 index e14605cee1..0000000000 --- a/examples/quick/tutorials/gettingStartedQml/filedialog/dialogPlugin.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 "dialogPlugin.h" -#include "directory.h" -#include "file.h" -#include - -void DialogPlugin::registerTypes(const char *uri) -{ - // Register the class Directory into QML as a "Directory" type version 1.0 - // @uri FileDialog - qmlRegisterType(uri, 1, 0, "Directory"); - qmlRegisterType(uri, 1, 0, "File"); -} diff --git a/examples/quick/tutorials/gettingStartedQml/filedialog/dialogPlugin.h b/examples/quick/tutorials/gettingStartedQml/filedialog/dialogPlugin.h deleted file mode 100644 index 2035f514b1..0000000000 --- a/examples/quick/tutorials/gettingStartedQml/filedialog/dialogPlugin.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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$ -** -****************************************************************************/ - -#ifndef DIALOGPLUGIN_H -#define DIALOGPLUGIN_H - -#include - -class DialogPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.QmlExtensionPlugin.FileDialog") - public: - //registerTypes is inherited from QQmlExtensionPlugin - void registerTypes(const char *uri); - -}; - -#endif - diff --git a/examples/quick/tutorials/gettingStartedQml/filedialog/directory.cpp b/examples/quick/tutorials/gettingStartedQml/filedialog/directory.cpp deleted file mode 100644 index 1ffa7a9afd..0000000000 --- a/examples/quick/tutorials/gettingStartedQml/filedialog/directory.cpp +++ /dev/null @@ -1,237 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 "directory.h" -#include - -/* - Directory constructor - - Initialize the saves directory and creates the file list -*/ -Directory::Directory(QObject *parent) : QObject(parent) -{ - m_dir.cd(QDir::currentPath()); - - // Go to the saved directory. if not found, create it - m_saveDir = "saves"; - if (m_dir.cd(m_saveDir) == 0) { - m_dir.mkdir(m_saveDir); - m_dir.cd(m_saveDir); - } - m_filterList << "*.txt"; - - refresh(); -} - -/* - Directory::filesCount - Returns the number of files -*/ -int Directory::filesCount() const -{ - return m_fileList.size(); -} - -/* - Function to append data into list property -*/ -void appendFiles(QQmlListProperty *property, File *file) -{ - Q_UNUSED(property) - Q_UNUSED(file) - // Do nothing. can't add to a directory using this method -} - -/* - Function called to retrieve file in the list using an index -*/ -File* fileAt(QQmlListProperty *property, int index) -{ - return static_cast< QList *>(property->data)->at(index); -} - -/* - Returns the number of files in the list -*/ -int filesSize(QQmlListProperty *property) -{ - return static_cast< QList *>(property->data)->size(); -} - -/* - Function called to empty the list property contents -*/ -void clearFilesPtr(QQmlListProperty *property) -{ - return static_cast< QList *>(property->data)->clear(); -} - -/* - Returns the list of files as a QQmlListProperty. -*/ -QQmlListProperty Directory::files() -{ - refresh(); - return QQmlListProperty(this, &m_fileList, &appendFiles, &filesSize, &fileAt, &clearFilesPtr); -} - -/* - Return the name of the currently selected file. -*/ -QString Directory::filename() const -{ - return currentFile.name(); -} - -/* - Return the file's content as a string. -*/ -QString Directory::fileContent() const -{ - return m_fileContent; -} - -/* - Set the file name of the current file. -*/ -void Directory::setFilename(const QString &str) -{ - if (str != currentFile.name()) { - currentFile.setName(str); - emit filenameChanged(); - } -} - -/* - Set the content of the file as a string. -*/ -void Directory::setFileContent(const QString &str) -{ - if (str != m_fileContent) { - m_fileContent = str; - emit fileContentChanged(); - } -} - -/* - Called from QML to save the file using the filename and content. - Makes sure that the file has a .txt extension. -*/ -void Directory::saveFile() -{ - if (currentFile.name().size() == 0) { - qWarning() << "Cannot save file, empty filename."; - return; - } - - QString extendedName = currentFile.name(); - if (!currentFile.name().endsWith(".txt")) { - extendedName.append(".txt"); - } - - QFile file(m_dir.filePath(extendedName)); - if (file.open(QFile::WriteOnly | QFile::Truncate)) { - QTextStream outStream(&file); - outStream << m_fileContent; - } - - file.close(); - refresh(); - emit directoryChanged(); -} - -/* - Load the contents of a file. - Only loads files with a .txt extension -*/ -void Directory::loadFile() -{ - m_fileContent.clear(); - QString extendedName = currentFile.name(); - if (!currentFile.name().endsWith(".txt")) { - extendedName.append(".txt"); - } - - QFile file( m_dir.filePath(extendedName)); - if (file.open(QFile::ReadOnly )) { - QTextStream inStream(&file); - QString line; - - do { - line = inStream.read(75); - m_fileContent.append(line); - } while (!line .isNull()); - } - file.close(); -} - -/* - Reloads the content of the files list. This is to ensure - that the newly created files are added onto the list. -*/ -void Directory::refresh() -{ - m_dirFiles = m_dir.entryList(m_filterList, QDir::Files, QDir::Name); - m_fileList.clear(); - - File * file; - for (int i = 0; i < m_dirFiles.size(); i ++) { - file = new File(); - - if (m_dirFiles.at(i).endsWith(".txt")) { - QString name = m_dirFiles.at(i); - file->setName(name.remove(".txt", Qt::CaseSensitive)); - } else { - file->setName(m_dirFiles.at(i)); - } - m_fileList.append(file); - } -} diff --git a/examples/quick/tutorials/gettingStartedQml/filedialog/directory.h b/examples/quick/tutorials/gettingStartedQml/filedialog/directory.h deleted file mode 100644 index f08ef70f9c..0000000000 --- a/examples/quick/tutorials/gettingStartedQml/filedialog/directory.h +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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$ -** -****************************************************************************/ - -#ifndef DIRECTORY_H -#define DIRECTORY_H - -#include "file.h" - -#include -#include -#include -#include -#include - -class Directory : public QObject { - Q_OBJECT - - // Number of files in the directory - Q_PROPERTY(int filesCount READ filesCount) - - // List property containing file names as QString - Q_PROPERTY(QQmlListProperty files READ files CONSTANT) - - // File name of the text file to read/write - Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged) - - // Text content of the file - Q_PROPERTY(QString fileContent READ fileContent WRITE setFileContent NOTIFY fileContentChanged) - -public: - Directory(QObject *parent = 0); - - // Properties' read functions - int filesCount() const; - QString filename() const; - QString fileContent() const; - QQmlListProperty files(); - - // Properties' write functions - void setFilename(const QString &str); - void setFileContent(const QString &str); - - // Accessible from QML - Q_INVOKABLE void saveFile(); - Q_INVOKABLE void loadFile(); - -signals: - void directoryChanged(); - void filenameChanged(); - void fileContentChanged(); - -private: - QDir m_dir; - QStringList m_dirFiles; - File currentFile; - QString m_saveDir; - QStringList m_filterList; - - // Contains the file data in QString format - QString m_fileContent; - - // Registered to QML in a plugin. Accessible from QML as a property of Directory - QList m_fileList; - - // Refresh content of the directory - void refresh(); -}; - -#endif diff --git a/examples/quick/tutorials/gettingStartedQml/filedialog/file.cpp b/examples/quick/tutorials/gettingStartedQml/filedialog/file.cpp deleted file mode 100644 index 9a009d932d..0000000000 --- a/examples/quick/tutorials/gettingStartedQml/filedialog/file.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 "file.h" - -File::File(QObject *parent) : QObject(parent) -{ -} - -QString File::name() const -{ - return m_name; -} - -void File::setName(const QString &str) -{ - if (str != m_name) { - m_name = str; - emit nameChanged(); - } -} diff --git a/examples/quick/tutorials/gettingStartedQml/filedialog/file.h b/examples/quick/tutorials/gettingStartedQml/filedialog/file.h deleted file mode 100644 index 06c4b2ded8..0000000000 --- a/examples/quick/tutorials/gettingStartedQml/filedialog/file.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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$ -** -****************************************************************************/ - -#ifndef FILE_H -#define FILE_H - -#include -#include - -class File : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - -public: - File(QObject *parent = 0); - - QString name() const; - void setName(const QString &str); - -signals: - void nameChanged(); - -private: - QString m_name; -}; - -#endif diff --git a/examples/quick/tutorials/gettingStartedQml/filedialog/filedialog.pro b/examples/quick/tutorials/gettingStartedQml/filedialog/filedialog.pro deleted file mode 100644 index 8f8f4549aa..0000000000 --- a/examples/quick/tutorials/gettingStartedQml/filedialog/filedialog.pro +++ /dev/null @@ -1,28 +0,0 @@ -TEMPLATE = lib -CONFIG += plugin -QT += qml - -DESTDIR += ../imports/FileDialog -OBJECTS_DIR = tmp -MOC_DIR = tmp - -TARGET = filedialogplugin - -HEADERS += \ - directory.h \ - file.h \ - dialogPlugin.h - -SOURCES += \ - directory.cpp \ - file.cpp \ - dialogPlugin.cpp - -EXAMPLE_FILES += qmldir - -# Copy the qmldir file to the same folder as the plugin binary -cpqmldir.files = $$PWD/qmldir -cpqmldir.path = $$DESTDIR -COPIES += cpqmldir - -CONFIG += install_ok # Do not cargo-cult this! diff --git a/examples/quick/tutorials/gettingStartedQml/filedialog/qmldir b/examples/quick/tutorials/gettingStartedQml/filedialog/qmldir deleted file mode 100644 index fbcd5f7fd3..0000000000 --- a/examples/quick/tutorials/gettingStartedQml/filedialog/qmldir +++ /dev/null @@ -1,2 +0,0 @@ -module FileDialog -plugin filedialogplugin diff --git a/examples/quick/tutorials/gettingStartedQml/gettingStartedQml.pro b/examples/quick/tutorials/gettingStartedQml/gettingStartedQml.pro deleted file mode 100644 index 725ff3bbac..0000000000 --- a/examples/quick/tutorials/gettingStartedQml/gettingStartedQml.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = \ - filedialog\ - -EXAMPLE_FILES = \ - core \ - images \ - parts \ - pics \ - texteditor.qmlproject \ - texteditor.qml diff --git a/examples/quick/tutorials/gettingStartedQml/images/arrow.png b/examples/quick/tutorials/gettingStartedQml/images/arrow.png deleted file mode 100644 index 20ee200f5f..0000000000 Binary files a/examples/quick/tutorials/gettingStartedQml/images/arrow.png and /dev/null differ diff --git a/examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_editmenu.png b/examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_editmenu.png deleted file mode 100644 index 27feed5e82..0000000000 Binary files a/examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_editmenu.png and /dev/null differ diff --git a/examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_filemenu.png b/examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_filemenu.png deleted file mode 100644 index 4d8f9f22b2..0000000000 Binary files a/examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_filemenu.png and /dev/null differ diff --git a/examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_newfile.png b/examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_newfile.png deleted file mode 100644 index 680acfe839..0000000000 Binary files a/examples/quick/tutorials/gettingStartedQml/pics/qml-texteditor5_newfile.png and /dev/null differ diff --git a/examples/quick/tutorials/gettingStartedQml/texteditor.qml b/examples/quick/tutorials/gettingStartedQml/texteditor.qml deleted file mode 100644 index 251dd6851c..0000000000 --- a/examples/quick/tutorials/gettingStartedQml/texteditor.qml +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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.0 -import "core" - -Rectangle { - id: screen - width: 1000; height: 1000 - property int partition: height / 3 - state: "DRAWER_CLOSED" - - // Item 1: MenuBar on the top portion of the screen - MenuBar { - id: menuBar - height: screen.partition - width: screen.width - z: 1 - } - - //Item 2: The editable text area - TextArea { - id: textArea - y: drawer.height - color: "#3F3F3F" - fontColor: "#DCDCCC" - height: partition * 2 - width: parent.width - } - - // Item 3: The drawer handle - Rectangle { - id: drawer - height:15; width: parent.width - border.color : "#6A6D6A" - border.width: 1 - z: 1 - - gradient: Gradient { - GradientStop { position: 0.0; color: "#8C8F8C" } - GradientStop { position: 0.17; color: "#6A6D6A" } - GradientStop { position: 0.77; color: "#3F3F3F" } - GradientStop { position: 1.0; color: "#6A6D6A" } - } - - Image { - id: arrowIcon - source: "images/arrow.png" - anchors.horizontalCenter: parent.horizontalCenter - - Behavior { NumberAnimation { property: "rotation"; easing.type: Easing.OutExpo } } - } - - MouseArea { - id: drawerMouseArea - anchors.fill: parent - hoverEnabled: true - onEntered: parent.border.color = Qt.lighter("#6A6D6A") - onExited: parent.border.color = "#6A6D6A" - onClicked: { - if (screen.state == "DRAWER_CLOSED") - screen.state = "DRAWER_OPEN" - else if (screen.state == "DRAWER_OPEN") - screen.state = "DRAWER_CLOSED" - } - } - } - -//! [states] - states: [ - State { - name: "DRAWER_OPEN" - PropertyChanges { target: menuBar; y: 0 } - PropertyChanges { target: textArea; y: partition + drawer.height } - PropertyChanges { target: drawer; y: partition } - PropertyChanges { target: arrowIcon; rotation: 180 } - }, - State { - name: "DRAWER_CLOSED" - PropertyChanges { target: menuBar; y: -height; } - PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height } - PropertyChanges { target: drawer; y: 0 } - PropertyChanges { target: arrowIcon; rotation: 0 } - } - ] -//! [states] - -//! [transitions] - transitions: [ - Transition { - to: "*" - NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type: Easing.OutExpo } - NumberAnimation { target: menuBar; properties: "y"; duration: 100; easing.type: Easing.OutExpo } - NumberAnimation { target: drawer; properties: "y"; duration: 100; easing.type: Easing.OutExpo } - } - ] -//! [transitions] -} diff --git a/examples/quick/tutorials/gettingStartedQml/texteditor.qmlproject b/examples/quick/tutorials/gettingStartedQml/texteditor.qmlproject deleted file mode 100644 index 72bdcdea73..0000000000 --- a/examples/quick/tutorials/gettingStartedQml/texteditor.qmlproject +++ /dev/null @@ -1,20 +0,0 @@ -import QmlProject 1.0 - -Project { - mainFile: "texteditor.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - - JavaScriptFiles { - directory: "." - } - - ImageFiles { - directory: "." - } - - importPaths: ["./imports"] -} diff --git a/examples/quick/tutorials/tutorials.pro b/examples/quick/tutorials/tutorials.pro index fd6117b2d0..429e77ace2 100644 --- a/examples/quick/tutorials/tutorials.pro +++ b/examples/quick/tutorials/tutorials.pro @@ -1,5 +1,4 @@ TEMPLATE = subdirs -SUBDIRS += gettingStartedQml EXAMPLE_FILES = \ dynamicview \ -- cgit v1.2.3