diff options
Diffstat (limited to 'examples/declarative/tutorials/gettingStarted/parts')
30 files changed, 129 insertions, 129 deletions
diff --git a/examples/declarative/tutorials/gettingStarted/parts/part0/Button.qml b/examples/declarative/tutorials/gettingStarted/parts/part0/Button.qml index b7eed442..8ab8598a 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part0/Button.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part0/Button.qml @@ -43,13 +43,13 @@ import QtQuick 1.0 Rectangle { id: simplebutton - color: "grey" + color: "grey" width: 150; height: 75 - + Text{ id: buttonLabel anchors.centerIn: parent - text: "button label" + text: "button label" } } //! [document] diff --git a/examples/declarative/tutorials/gettingStarted/parts/part2/Button.qml b/examples/declarative/tutorials/gettingStarted/parts/part2/Button.qml index 78b38aee..e39814ed 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part2/Button.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part2/Button.qml @@ -50,20 +50,20 @@ Rectangle { //these properties act as constants, useable outside this QML file property int buttonHeight: 75 property int buttonWidth: 150 - + //the color highlight when the mouse hovers on the rectangle property color onHoverColor: "gold" property color borderColor: "white" //buttonColor is set to the button's main color - property color buttonColor: "lightblue" + property color buttonColor: "lightblue" //set appearance properties radius:10 smooth: true border{color: "white"; width: 3} width: buttonWidth; height: buttonHeight - + Text{ id: buttonLabel anchors.centerIn: parent @@ -77,11 +77,11 @@ Rectangle { } //define the clickable area to be the whole rectangle - MouseArea{ + 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 @@ -90,7 +90,7 @@ Rectangle { 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 diff --git a/examples/declarative/tutorials/gettingStarted/parts/part2/EditMenu.qml b/examples/declarative/tutorials/gettingStarted/parts/part2/EditMenu.qml index 5e825755..a753edd3 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part2/EditMenu.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part2/EditMenu.qml @@ -60,7 +60,7 @@ Rectangle { buttonColor: "lightgrey" label: "Cut" } - + Button{ buttonColor: "grey" id: saveButton diff --git a/examples/declarative/tutorials/gettingStarted/parts/part2/FileMenu.qml b/examples/declarative/tutorials/gettingStarted/parts/part2/FileMenu.qml index d53e1f3d..46537a1e 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part2/FileMenu.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part2/FileMenu.qml @@ -49,9 +49,9 @@ Rectangle { //generous amount of screen space that will allow the buttons to fit height: 480; width:1000 - color: "#6C646A" + color: "#6C646A" - //a sub-rectangle allows the flexibility of setting the row area + //a sub-rectangle allows the flexibility of setting the row area Rectangle{ id:actionContainer @@ -70,7 +70,7 @@ Rectangle { buttonColor: "lightgrey" label: "Load" } - + Button{ buttonColor: "grey" id: saveButton diff --git a/examples/declarative/tutorials/gettingStarted/parts/part2/MenuBar.qml b/examples/declarative/tutorials/gettingStarted/parts/part2/MenuBar.qml index d2131eeb..e2617651 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part2/MenuBar.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part2/MenuBar.qml @@ -50,12 +50,12 @@ Rectangle { //container for the header and the buttons Rectangle{ - + id: labelList height:parent.height/10 width: parent.width color: "steelblue" - + //default z is 0, items with higher z values are shown on top of items with lower z values z: 1 @@ -82,16 +82,16 @@ Rectangle { width: 50 id: editButton buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) - scale: menuListView.currentIndex == 1? 1.25: 1 + scale: menuListView.currentIndex == 1? 1.25: 1 label: "Edit" radius: 1 //on a button click, change the list's currently selected item to EditMenu onButtonClick: { - menuListView.currentIndex = 1 + menuListView.currentIndex = 1 } - + } @@ -111,7 +111,7 @@ Rectangle { color: editColor width: menuListView.width height: menuBar.height - + } } @@ -129,7 +129,7 @@ Rectangle { //control the movement of the menu switching snapMode: ListView.SnapOneItem orientation: ListView.Horizontal - boundsBehavior: Flickable.StopAtBounds + boundsBehavior: Flickable.StopAtBounds flickDeceleration: 5000 highlightFollowsCurrentItem: true highlightMoveDuration:240 diff --git a/examples/declarative/tutorials/gettingStarted/parts/part3/Button.qml b/examples/declarative/tutorials/gettingStarted/parts/part3/Button.qml index 78b38aee..e39814ed 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part3/Button.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part3/Button.qml @@ -50,20 +50,20 @@ Rectangle { //these properties act as constants, useable outside this QML file property int buttonHeight: 75 property int buttonWidth: 150 - + //the color highlight when the mouse hovers on the rectangle property color onHoverColor: "gold" property color borderColor: "white" //buttonColor is set to the button's main color - property color buttonColor: "lightblue" + property color buttonColor: "lightblue" //set appearance properties radius:10 smooth: true border{color: "white"; width: 3} width: buttonWidth; height: buttonHeight - + Text{ id: buttonLabel anchors.centerIn: parent @@ -77,11 +77,11 @@ Rectangle { } //define the clickable area to be the whole rectangle - MouseArea{ + 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 @@ -90,7 +90,7 @@ Rectangle { 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 diff --git a/examples/declarative/tutorials/gettingStarted/parts/part3/EditMenu.qml b/examples/declarative/tutorials/gettingStarted/parts/part3/EditMenu.qml index 5e825755..a753edd3 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part3/EditMenu.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part3/EditMenu.qml @@ -60,7 +60,7 @@ Rectangle { buttonColor: "lightgrey" label: "Cut" } - + Button{ buttonColor: "grey" id: saveButton diff --git a/examples/declarative/tutorials/gettingStarted/parts/part3/FileMenu.qml b/examples/declarative/tutorials/gettingStarted/parts/part3/FileMenu.qml index d53e1f3d..46537a1e 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part3/FileMenu.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part3/FileMenu.qml @@ -49,9 +49,9 @@ Rectangle { //generous amount of screen space that will allow the buttons to fit height: 480; width:1000 - color: "#6C646A" + color: "#6C646A" - //a sub-rectangle allows the flexibility of setting the row area + //a sub-rectangle allows the flexibility of setting the row area Rectangle{ id:actionContainer @@ -70,7 +70,7 @@ Rectangle { buttonColor: "lightgrey" label: "Load" } - + Button{ buttonColor: "grey" id: saveButton diff --git a/examples/declarative/tutorials/gettingStarted/parts/part3/MenuBar.qml b/examples/declarative/tutorials/gettingStarted/parts/part3/MenuBar.qml index d2131eeb..e2617651 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part3/MenuBar.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part3/MenuBar.qml @@ -50,12 +50,12 @@ Rectangle { //container for the header and the buttons Rectangle{ - + id: labelList height:parent.height/10 width: parent.width color: "steelblue" - + //default z is 0, items with higher z values are shown on top of items with lower z values z: 1 @@ -82,16 +82,16 @@ Rectangle { width: 50 id: editButton buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) - scale: menuListView.currentIndex == 1? 1.25: 1 + scale: menuListView.currentIndex == 1? 1.25: 1 label: "Edit" radius: 1 //on a button click, change the list's currently selected item to EditMenu onButtonClick: { - menuListView.currentIndex = 1 + menuListView.currentIndex = 1 } - + } @@ -111,7 +111,7 @@ Rectangle { color: editColor width: menuListView.width height: menuBar.height - + } } @@ -129,7 +129,7 @@ Rectangle { //control the movement of the menu switching snapMode: ListView.SnapOneItem orientation: ListView.Horizontal - boundsBehavior: Flickable.StopAtBounds + boundsBehavior: Flickable.StopAtBounds flickDeceleration: 5000 highlightFollowsCurrentItem: true highlightMoveDuration:240 diff --git a/examples/declarative/tutorials/gettingStarted/parts/part3/TextArea.qml b/examples/declarative/tutorials/gettingStarted/parts/part3/TextArea.qml index ece97fec..4d3ddb33 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part3/TextArea.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part3/TextArea.qml @@ -71,7 +71,7 @@ Rectangle { width:parent.width; height:parent.height color:"midnightblue" focus: true - + wrapMode: TextEdit.Wrap onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) diff --git a/examples/declarative/tutorials/gettingStarted/parts/part3/TextEditor.qml b/examples/declarative/tutorials/gettingStarted/parts/part3/TextEditor.qml index a535c0fc..679e4f4f 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part3/TextEditor.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part3/TextEditor.qml @@ -47,7 +47,7 @@ Rectangle { border.color:"black" //the screen is partitioned into the MenuBar and TextArea. 1/3 of the screen is assigned to the MenuBar property int partition: height/3 - + MenuBar{ id:menuBar height: partition diff --git a/examples/declarative/tutorials/gettingStarted/parts/part4/Button.qml b/examples/declarative/tutorials/gettingStarted/parts/part4/Button.qml index 2ca436ba..1a8b7acb 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part4/Button.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part4/Button.qml @@ -48,7 +48,7 @@ Rectangle { //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 @@ -58,7 +58,7 @@ Rectangle { property color borderColor: "white" //buttonColor is set to the button's main color - property color buttonColor: "lightblue" + property color buttonColor: "lightblue" //set appearance properties radius:10 @@ -66,7 +66,7 @@ Rectangle { border.color: "white" border.width: 3 width: buttonWidth; height: buttonHeight - + Text{ id: buttonLabel anchors.centerIn: parent @@ -80,11 +80,11 @@ Rectangle { } //define the clickable area to be the whole rectangle - MouseArea{ + 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 @@ -93,7 +93,7 @@ Rectangle { 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 diff --git a/examples/declarative/tutorials/gettingStarted/parts/part4/EditMenu.qml b/examples/declarative/tutorials/gettingStarted/parts/part4/EditMenu.qml index 64345ebd..b7e1b7c0 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part4/EditMenu.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part4/EditMenu.qml @@ -64,7 +64,7 @@ Rectangle { buttonColor: "lightgrey" label: "Cut" } - + Button{ buttonColor: "grey" id: saveButton diff --git a/examples/declarative/tutorials/gettingStarted/parts/part4/FileMenu.qml b/examples/declarative/tutorials/gettingStarted/parts/part4/FileMenu.qml index 20acaa8a..df23a14b 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part4/FileMenu.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part4/FileMenu.qml @@ -49,13 +49,13 @@ Rectangle { //generous amount of screen space that will allow the buttons to fit height: 480; width:1000 - color: "#6C646A" + color: "#6C646A" gradient: Gradient{ GradientStop { position: 0.0; color: "#6C646A" } GradientStop { position: 1.0; color: Qt.darker("#6A6D6A") } } - //a sub-rectangle allows the flexibility of setting the row area + //a sub-rectangle allows the flexibility of setting the row area Rectangle{ id:actionContainer @@ -74,7 +74,7 @@ Rectangle { buttonColor: "lightgrey" label: "Load" } - + Button{ buttonColor: "grey" id: saveButton diff --git a/examples/declarative/tutorials/gettingStarted/parts/part4/MenuBar.qml b/examples/declarative/tutorials/gettingStarted/parts/part4/MenuBar.qml index 9c027fc9..8a674ca2 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part4/MenuBar.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part4/MenuBar.qml @@ -50,7 +50,7 @@ Rectangle { //container for the header and the buttons Rectangle{ - + id: labelList height:parent.height/10 width: parent.width @@ -88,16 +88,16 @@ Rectangle { width: 50 id: editButton buttonColor : menuListView.currentIndex == 1? editColor : Qt.darker(editColor, 1.5) - scale: menuListView.currentIndex == 1? 1.25: 1 + scale: menuListView.currentIndex == 1? 1.25: 1 label: "Edit" radius: 1 //on a button click, change the list's currently selected item to EditMenu onButtonClick: { - menuListView.currentIndex = 1 + menuListView.currentIndex = 1 } - + } @@ -117,7 +117,7 @@ Rectangle { color: editColor width: menuListView.width height: menuBar.height - + } } @@ -135,7 +135,7 @@ Rectangle { //control the movement of the menu switching snapMode: ListView.SnapOneItem orientation: ListView.Horizontal - boundsBehavior: Flickable.StopAtBounds + boundsBehavior: Flickable.StopAtBounds flickDeceleration: 5000 highlightFollowsCurrentItem: true highlightMoveDuration:240 diff --git a/examples/declarative/tutorials/gettingStarted/parts/part4/SimpleButton.qml b/examples/declarative/tutorials/gettingStarted/parts/part4/SimpleButton.qml index 384a6c52..7978ed42 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part4/SimpleButton.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part4/SimpleButton.qml @@ -42,16 +42,16 @@ import QtQuick 1.0 Rectangle { id: simplebutton - color: "grey" + color: "grey" width: 150; height: 75 - + Text{ id: buttonLabel anchors.centerIn: parent - text: "button label" + text: "button label" } - MouseArea{ + MouseArea{ id: buttonMouseArea anchors.fill: parent onClicked: console.log(buttonLabel.text + " clicked" ) diff --git a/examples/declarative/tutorials/gettingStarted/parts/part4/TextArea.qml b/examples/declarative/tutorials/gettingStarted/parts/part4/TextArea.qml index 1e33bec9..0c2277e9 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part4/TextArea.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part4/TextArea.qml @@ -46,7 +46,7 @@ Rectangle { width :400 height:400 property color fontColor: "white" - + Flickable{ id: flickArea @@ -71,7 +71,7 @@ Rectangle { width:parent.width; height:parent.height color:fontColor focus: true - + wrapMode: TextEdit.Wrap onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) diff --git a/examples/declarative/tutorials/gettingStarted/parts/part4/TextEditor.qml b/examples/declarative/tutorials/gettingStarted/parts/part4/TextEditor.qml index 0fdce356..a5b6e618 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part4/TextEditor.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part4/TextEditor.qml @@ -45,8 +45,8 @@ Rectangle { 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 @@ -66,7 +66,7 @@ Rectangle { color: "#3F3F3F" fontColor: "#DCDCCC" height: partition*2 - width:parent.width + width:parent.width } //Item 3: The drawer handle @@ -88,17 +88,17 @@ Rectangle { id: arrowIcon source: "images/arrow.png" anchors.horizontalCenter: parent.horizontalCenter - + Behavior{NumberAnimation{property: "rotation";easing.type: Easing.OutExpo }} } - + MouseArea{ id: drawerMouseArea anchors.fill:parent onClicked:{ if (screen.state == "DRAWER_CLOSED"){ screen.state = "DRAWER_OPEN" - console.log("drawer OPEN") + console.log("drawer OPEN") } else if (screen.state == "DRAWER_OPEN"){ screen.state = "DRAWER_CLOSED" @@ -109,13 +109,13 @@ Rectangle { //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 = Qt.lighter("#6A6D6A") //remove the border if the mouse exits the button mouse area onExited: parent.border.color = "#6A6D6A" } - + } states:[ State{ @@ -123,14 +123,14 @@ Rectangle { PropertyChanges { target: menuBar; y:0} PropertyChanges { target: textArea; y: partition + drawer.height} PropertyChanges { target: drawer; y: partition} - PropertyChanges { target: arrowIcon; rotation: 180} + PropertyChanges { target: arrowIcon; rotation: 180} }, State{ name: "DRAWER_CLOSED" PropertyChanges { target: menuBar; y:-partition} PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height} PropertyChanges { target: drawer; y: 0} - PropertyChanges { target: arrowIcon; rotation: 0} + PropertyChanges { target: arrowIcon; rotation: 0} } ] @@ -141,6 +141,6 @@ Rectangle { NumberAnimation { target: menuBar; properties: "y"; duration: 100;easing.type: Easing.OutExpo } NumberAnimation { target: drawer; properties: "y"; duration: 100;easing.type: Easing.OutExpo } } - + ] } diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/TextEditor.qml b/examples/declarative/tutorials/gettingStarted/parts/part5/TextEditor.qml index 7c63d752..da54a552 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part5/TextEditor.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/TextEditor.qml @@ -46,7 +46,7 @@ Rectangle { 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 @@ -59,7 +59,7 @@ Rectangle { y:drawer.height color: "#3F3F3F" fontColor: "#DCDCCC" - height: partition*2; width:parent.width + height: partition*2; width:parent.width } //Item 3: The drawer handle Rectangle{ @@ -78,10 +78,10 @@ Rectangle { id: arrowIcon source: "images/arrow.png" anchors.horizontalCenter: parent.horizontalCenter - + Behavior{NumberAnimation{property: "rotation";easing.type: Easing.OutExpo }} } - + MouseArea{ id: drawerMouseArea anchors.fill:parent @@ -105,14 +105,14 @@ Rectangle { PropertyChanges { target: menuBar; y: 0} PropertyChanges { target: textArea; y: partition + drawer.height} PropertyChanges { target: drawer; y: partition} - PropertyChanges { target: arrowIcon; rotation: 180} + 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} + PropertyChanges { target: arrowIcon; rotation: 0} } ] diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/core/button.qml b/examples/declarative/tutorials/gettingStarted/parts/part5/core/button.qml index aaf619b5..8f1488d1 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part5/core/button.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/core/button.qml @@ -80,7 +80,7 @@ Rectangle { signal buttonClick() //define the clickable area to be the whole rectangle - MouseArea { + MouseArea { id: buttonMouseArea anchors.fill: parent //stretch the area to the parent's dimension onClicked: buttonClick() diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/core/fileDialog.qml b/examples/declarative/tutorials/gettingStarted/parts/part5/core/fileDialog.qml index 9f50c73f..b4bf3e24 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part5/core/fileDialog.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/core/fileDialog.qml @@ -71,7 +71,7 @@ Rectangle { } Text { height: header.height; anchors.centerIn: header - text: "files:" + text: "files:" color: "lightblue" font.weight: Font.Light font.italic: true diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/core/fileMenu.qml b/examples/declarative/tutorials/gettingStarted/parts/part5/core/fileMenu.qml index b2a34b9b..494f8acb 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part5/core/fileMenu.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/core/fileMenu.qml @@ -53,7 +53,7 @@ Rectangle { //used to divide the screen into parts. property real partition: 1/3 - color: "#6C646A" + color: "#6C646A" gradient: Gradient { GradientStop { position: 0.0; color: "#6C646A" } GradientStop { position: 1.0; color: Qt.darker("#6A6D6A") } diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/core/menuBar.qml b/examples/declarative/tutorials/gettingStarted/parts/part5/core/menuBar.qml index 49dc0e0d..78e85080 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part5/core/menuBar.qml +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/core/menuBar.qml @@ -67,7 +67,7 @@ Rectangle { Text { height: parent.height anchors { right: labelRow.left ; verticalCenter: parent.bottom } - text: "menu: " + text: "menu: " color: "lightblue" font { weight: Font.Light; italic: true } smooth: true @@ -97,13 +97,13 @@ Rectangle { id: editButton height: 20; width: 50 buttonColor : menuListView.currentIndex == 1? Qt.darker(editColor, 1.5) : Qt.darker(editColor, 1.9) - scale: menuListView.currentIndex == 1? 1.25: 1 + scale: menuListView.currentIndex == 1? 1.25: 1 label: "Edit" radius: 1 labelSize: menuListView.currentIndex == 1? 16:12 smooth:true //on a button click, change the list's currently selected item to EditMenu - onButtonClick: menuListView.currentIndex = 1 + onButtonClick: menuListView.currentIndex = 1 gradient: Gradient { GradientStop { position: 0.0; color: editColor } GradientStop { position: 1.0; color: "#136F6F6F" } @@ -123,7 +123,7 @@ Rectangle { //control the movement of the menu switching snapMode: ListView.SnapOneItem orientation: ListView.Horizontal - boundsBehavior: Flickable.StopAtBounds + boundsBehavior: Flickable.StopAtBounds flickDeceleration: 5000 highlightFollowsCurrentItem: true highlightMoveDuration:240 diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.cpp b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.cpp index 452124f5..84ebdced 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.cpp +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.cpp @@ -44,11 +44,11 @@ #include <QtDeclarative/qdeclarative.h> void DialogPlugin::registerTypes(const char *uri){ - + //register the class Directory into QML as a "Directory" element version 1.0 qmlRegisterType<Directory>(uri, 1, 0, "Directory"); qmlRegisterType<File>(uri,1,0,"File"); - + //qRegisterMetaType<QDeclarativeListProperty<QString> > ("QDeclarativeListProperty<QString>"); - + } diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.h b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.h index 68c6076e..0a5bc9ef 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.h +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/dialogPlugin.h @@ -51,7 +51,7 @@ class DialogPlugin : public QDeclarativeExtensionPlugin public: //registerTypes is inherited from QDeclarativeExtensionPlugin void registerTypes(const char *uri); - + }; #endif diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.cpp b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.cpp index bdf450eb..dd4a5546 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.cpp +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.cpp @@ -48,10 +48,10 @@ 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 save directory m_saveDir = "saves"; if (m_dir.cd(m_saveDir) == 0){ @@ -144,7 +144,7 @@ void Directory::setFileContent(const QString &str){ if(str != m_fileContent){ m_fileContent = str; emit fileContentChanged(); - } + } } /* @@ -152,17 +152,17 @@ Called from QML to save the file using the filename and file content. Saving makes sure that the file has a .txt extension. */ void Directory::saveFile(){ - + if(currentFile.name().size() == 0){ qWarning()<< "Empty filename. no save"; 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); @@ -184,11 +184,11 @@ void Directory::loadFile(){ 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); @@ -205,12 +205,12 @@ 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)); diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.h b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.h index b5a7bbe1..a8997ee2 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.h +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/directory.h @@ -52,22 +52,22 @@ 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(QDeclarativeListProperty<File> 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; @@ -77,30 +77,30 @@ class Directory : public QObject{ //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; + QStringList m_dirFiles; + File currentFile; QString m_saveDir; - QStringList m_filterList; - + 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<File *> m_fileList; - //refresh content of the directory + //refresh content of the directory void refresh(); }; diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/file.h b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/file.h index ef1551a3..f3afb6ff 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/file.h +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/file.h @@ -46,20 +46,20 @@ #include <QObject> 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; }; diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/filedialog.pro b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/filedialog.pro index f9229a3b..856221bc 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/filedialog.pro +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/filedialog/filedialog.pro @@ -8,10 +8,10 @@ MOC_DIR = tmp TARGET = FileDialog -HEADERS += directory.h \ - file.h \ - dialogPlugin.h +HEADERS += directory.h \ + file.h \ + dialogPlugin.h -SOURCES += directory.cpp \ - file.cpp \ - dialogPlugin.cpp +SOURCES += directory.cpp \ + file.cpp \ + dialogPlugin.cpp diff --git a/examples/declarative/tutorials/gettingStarted/parts/part5/qml-texteditor5.qmlproject b/examples/declarative/tutorials/gettingStarted/parts/part5/qml-texteditor5.qmlproject index ed034dff..30e9e1fe 100644 --- a/examples/declarative/tutorials/gettingStarted/parts/part5/qml-texteditor5.qmlproject +++ b/examples/declarative/tutorials/gettingStarted/parts/part5/qml-texteditor5.qmlproject @@ -4,8 +4,8 @@ Project { /* Include .qml, .js, and image files from current directory and subdirectories */ QmlFiles { directory: "." - directory: "core" - directory: "filedialog" + directory: "core" + directory: "filedialog" } JavaScriptFiles { directory: "." |