summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2010-08-11 11:50:37 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2010-08-11 11:50:37 (GMT)
commitc6ed32dc7e9c8a566f376d1baa7e616a1019f9af (patch)
tree95ce43172963aa266630d8836ccb6b23dde78991 /examples
parent9986c3f0c0681c7ea8bc8e5cfea5662880db6654 (diff)
parent5fa15620d09df1164cc28aa9b1e646a61f87e909 (diff)
downloadQt-c6ed32dc7e9c8a566f376d1baa7e616a1019f9af.zip
Qt-c6ed32dc7e9c8a566f376d1baa7e616a1019f9af.tar.gz
Qt-c6ed32dc7e9c8a566f376d1baa7e616a1019f9af.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Diffstat (limited to 'examples')
-rw-r--r--examples/declarative/cppextensions/referenceexamples/adding/main.cpp4
-rw-r--r--examples/declarative/cppextensions/referenceexamples/attached/main.cpp4
-rw-r--r--examples/declarative/cppextensions/referenceexamples/binding/main.cpp4
-rw-r--r--examples/declarative/cppextensions/referenceexamples/coercion/main.cpp4
-rw-r--r--examples/declarative/cppextensions/referenceexamples/default/main.cpp4
-rw-r--r--examples/declarative/cppextensions/referenceexamples/extended/main.cpp4
-rw-r--r--examples/declarative/cppextensions/referenceexamples/grouped/main.cpp4
-rw-r--r--examples/declarative/cppextensions/referenceexamples/properties/main.cpp4
-rw-r--r--examples/declarative/cppextensions/referenceexamples/signal/main.cpp4
-rw-r--r--examples/declarative/cppextensions/referenceexamples/valuesource/main.cpp4
-rw-r--r--examples/declarative/keyinteraction/focus/Core/ContextMenu.qml7
-rw-r--r--examples/declarative/keyinteraction/focus/Core/GridMenu.qml7
-rw-r--r--examples/declarative/keyinteraction/focus/Core/ListMenu.qml (renamed from examples/declarative/keyinteraction/focus/Core/ListViews.qml)5
-rw-r--r--examples/declarative/keyinteraction/focus/focus.qml11
-rw-r--r--examples/network/network.pro5
-rw-r--r--examples/tutorials/gettingStarted/gsQml/TextEditor.qml129
-rw-r--r--examples/tutorials/gettingStarted/gsQml/core/Button.qml110
-rw-r--r--examples/tutorials/gettingStarted/gsQml/core/EditMenu.qml111
-rw-r--r--examples/tutorials/gettingStarted/gsQml/core/FileDialog.qml170
-rw-r--r--examples/tutorials/gettingStarted/gsQml/core/FileMenu.qml232
-rw-r--r--examples/tutorials/gettingStarted/gsQml/core/MenuBar.qml148
-rw-r--r--examples/tutorials/gettingStarted/gsQml/core/button.qml108
-rw-r--r--examples/tutorials/gettingStarted/gsQml/core/editMenu.qml105
-rw-r--r--examples/tutorials/gettingStarted/gsQml/core/fileDialog.qml163
-rw-r--r--examples/tutorials/gettingStarted/gsQml/core/fileMenu.qml232
-rw-r--r--examples/tutorials/gettingStarted/gsQml/core/menuBar.qml147
-rw-r--r--examples/tutorials/gettingStarted/gsQml/core/qmldir13
-rw-r--r--examples/tutorials/gettingStarted/gsQml/core/textArea.qml (renamed from examples/tutorials/gettingStarted/gsQml/core/TextArea.qml)77
-rw-r--r--examples/tutorials/gettingStarted/gsQml/filedialog/cppPlugins.pro12
-rw-r--r--examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.cpp13
-rw-r--r--examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.h12
-rw-r--r--examples/tutorials/gettingStarted/gsQml/filedialog/directory.cpp205
-rw-r--r--examples/tutorials/gettingStarted/gsQml/filedialog/directory.h107
-rw-r--r--examples/tutorials/gettingStarted/gsQml/filedialog/file.cpp12
-rw-r--r--examples/tutorials/gettingStarted/gsQml/filedialog/file.h32
-rw-r--r--examples/tutorials/gettingStarted/gsQml/images/qt-logo.pngbin5149 -> 0 bytes
-rw-r--r--examples/tutorials/gettingStarted/gsQml/texteditor.qml128
37 files changed, 1172 insertions, 1169 deletions
diff --git a/examples/declarative/cppextensions/referenceexamples/adding/main.cpp b/examples/declarative/cppextensions/referenceexamples/adding/main.cpp
index 391113c..19cf034 100644
--- a/examples/declarative/cppextensions/referenceexamples/adding/main.cpp
+++ b/examples/declarative/cppextensions/referenceexamples/adding/main.cpp
@@ -51,13 +51,13 @@ int main(int argc, char ** argv)
//![0]
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, ":example.qml");
+ QDeclarativeComponent component(&engine, QUrl("qrc:example.qml"));
Person *person = qobject_cast<Person *>(component.create());
if (person) {
qWarning() << "The person's name is" << person->name();
qWarning() << "They wear a" << person->shoeSize() << "sized shoe";
} else {
- qWarning() << "An error occurred";
+ qWarning() << component.errors();
}
return 0;
diff --git a/examples/declarative/cppextensions/referenceexamples/attached/main.cpp b/examples/declarative/cppextensions/referenceexamples/attached/main.cpp
index 5a39a98..65cbc93 100644
--- a/examples/declarative/cppextensions/referenceexamples/attached/main.cpp
+++ b/examples/declarative/cppextensions/referenceexamples/attached/main.cpp
@@ -56,7 +56,7 @@ int main(int argc, char ** argv)
qmlRegisterType<Girl>("People", 1,0, "Girl");
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, ":example.qml");
+ QDeclarativeComponent component(&engine, QUrl("qrc:example.qml"));
BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create());
if (party && party->host()) {
@@ -83,7 +83,7 @@ int main(int argc, char ** argv)
}
} else {
- qWarning() << "An error occurred";
+ qWarning() << component.errors();
}
return 0;
diff --git a/examples/declarative/cppextensions/referenceexamples/binding/main.cpp b/examples/declarative/cppextensions/referenceexamples/binding/main.cpp
index fe1bbc8..150f961 100644
--- a/examples/declarative/cppextensions/referenceexamples/binding/main.cpp
+++ b/examples/declarative/cppextensions/referenceexamples/binding/main.cpp
@@ -57,7 +57,7 @@ int main(int argc, char ** argv)
qmlRegisterType<Girl>("People", 1,0, "Girl");
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, ":example.qml");
+ QDeclarativeComponent component(&engine, QUrl("qrc:example.qml"));
BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create());
if (party && party->host()) {
@@ -85,7 +85,7 @@ int main(int argc, char ** argv)
party->startParty();
} else {
- qWarning() << "An error occurred";
+ qWarning() << component.errors();
}
return app.exec();
diff --git a/examples/declarative/cppextensions/referenceexamples/coercion/main.cpp b/examples/declarative/cppextensions/referenceexamples/coercion/main.cpp
index 5c53368..5b16f99 100644
--- a/examples/declarative/cppextensions/referenceexamples/coercion/main.cpp
+++ b/examples/declarative/cppextensions/referenceexamples/coercion/main.cpp
@@ -56,7 +56,7 @@ int main(int argc, char ** argv)
qmlRegisterType<Girl>("People", 1,0, "Girl");
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, ":example.qml");
+ QDeclarativeComponent component(&engine, QUrl("qrc:example.qml"));
BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create());
if (party && party->host()) {
@@ -70,7 +70,7 @@ int main(int argc, char ** argv)
for (int ii = 0; ii < party->guestCount(); ++ii)
qWarning() << " " << party->guest(ii)->name();
} else {
- qWarning() << "An error occurred";
+ qWarning() << component.errors();
}
return 0;
diff --git a/examples/declarative/cppextensions/referenceexamples/default/main.cpp b/examples/declarative/cppextensions/referenceexamples/default/main.cpp
index f611bc4..bfba642 100644
--- a/examples/declarative/cppextensions/referenceexamples/default/main.cpp
+++ b/examples/declarative/cppextensions/referenceexamples/default/main.cpp
@@ -54,7 +54,7 @@ int main(int argc, char ** argv)
qmlRegisterType<Girl>("People", 1,0, "Girl");
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, ":example.qml");
+ QDeclarativeComponent component(&engine, QUrl("qrc:example.qml"));
BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create());
if (party && party->host()) {
@@ -68,7 +68,7 @@ int main(int argc, char ** argv)
for (int ii = 0; ii < party->guestCount(); ++ii)
qWarning() << " " << party->guest(ii)->name();
} else {
- qWarning() << "An error occurred";
+ qWarning() << component.errors();
}
return 0;
diff --git a/examples/declarative/cppextensions/referenceexamples/extended/main.cpp b/examples/declarative/cppextensions/referenceexamples/extended/main.cpp
index 65527c3..08c8440 100644
--- a/examples/declarative/cppextensions/referenceexamples/extended/main.cpp
+++ b/examples/declarative/cppextensions/referenceexamples/extended/main.cpp
@@ -51,14 +51,14 @@ int main(int argc, char ** argv)
qmlRegisterExtendedType<QLineEdit, LineEditExtension>("People", 1,0, "QLineEdit");
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, ":example.qml");
+ QDeclarativeComponent component(&engine, QUrl("qrc:example.qml"));
QLineEdit *edit = qobject_cast<QLineEdit *>(component.create());
if (edit) {
edit->show();
return app.exec();
} else {
- qWarning() << "An error occurred";
+ qWarning() << component.errors();
return 0;
}
}
diff --git a/examples/declarative/cppextensions/referenceexamples/grouped/main.cpp b/examples/declarative/cppextensions/referenceexamples/grouped/main.cpp
index e56a14d..6f7f13f 100644
--- a/examples/declarative/cppextensions/referenceexamples/grouped/main.cpp
+++ b/examples/declarative/cppextensions/referenceexamples/grouped/main.cpp
@@ -55,7 +55,7 @@ int main(int argc, char ** argv)
qmlRegisterType<Girl>("People", 1,0, "Girl");
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, ":example.qml");
+ QDeclarativeComponent component(&engine, QUrl("qrc:example.qml"));
BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create());
if (party && party->host()) {
@@ -78,7 +78,7 @@ int main(int argc, char ** argv)
qWarning() << bestShoe->name() << "is wearing the best shoes!";
} else {
- qWarning() << "An error occurred";
+ qWarning() << component.errors();
}
return 0;
diff --git a/examples/declarative/cppextensions/referenceexamples/properties/main.cpp b/examples/declarative/cppextensions/referenceexamples/properties/main.cpp
index 80237ef..d974647 100644
--- a/examples/declarative/cppextensions/referenceexamples/properties/main.cpp
+++ b/examples/declarative/cppextensions/referenceexamples/properties/main.cpp
@@ -52,7 +52,7 @@ int main(int argc, char ** argv)
qmlRegisterType<Person>("People", 1,0, "Person");
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, ":example.qml");
+ QDeclarativeComponent component(&engine, QUrl("qrc:example.qml"));
BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create());
if (party && party->host()) {
@@ -61,7 +61,7 @@ int main(int argc, char ** argv)
for (int ii = 0; ii < party->guestCount(); ++ii)
qWarning() << " " << party->guest(ii)->name();
} else {
- qWarning() << "An error occurred";
+ qWarning() << component.errors();
}
return 0;
diff --git a/examples/declarative/cppextensions/referenceexamples/signal/main.cpp b/examples/declarative/cppextensions/referenceexamples/signal/main.cpp
index 56c0809..ad87bee 100644
--- a/examples/declarative/cppextensions/referenceexamples/signal/main.cpp
+++ b/examples/declarative/cppextensions/referenceexamples/signal/main.cpp
@@ -56,7 +56,7 @@ int main(int argc, char ** argv)
qmlRegisterType<Girl>("People", 1,0, "Girl");
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, ":example.qml");
+ QDeclarativeComponent component(&engine, QUrl("qrc:example.qml"));
BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create());
if (party && party->host()) {
@@ -84,7 +84,7 @@ int main(int argc, char ** argv)
party->startParty();
} else {
- qWarning() << "An error occurred";
+ qWarning() << component.errors();
}
return 0;
diff --git a/examples/declarative/cppextensions/referenceexamples/valuesource/main.cpp b/examples/declarative/cppextensions/referenceexamples/valuesource/main.cpp
index 40dc3cb..aa77665 100644
--- a/examples/declarative/cppextensions/referenceexamples/valuesource/main.cpp
+++ b/examples/declarative/cppextensions/referenceexamples/valuesource/main.cpp
@@ -58,7 +58,7 @@ int main(int argc, char ** argv)
qmlRegisterType<Girl>("People", 1,0, "Girl");
QDeclarativeEngine engine;
- QDeclarativeComponent component(&engine, ":example.qml");
+ QDeclarativeComponent component(&engine, QUrl("qrc:example.qml"));
BirthdayParty *party = qobject_cast<BirthdayParty *>(component.create());
if (party && party->host()) {
@@ -86,7 +86,7 @@ int main(int argc, char ** argv)
party->startParty();
} else {
- qWarning() << "An error occurred";
+ qWarning() << component.errors();
}
return app.exec();
diff --git a/examples/declarative/keyinteraction/focus/Core/ContextMenu.qml b/examples/declarative/keyinteraction/focus/Core/ContextMenu.qml
index 15e77de..ba49d14 100644
--- a/examples/declarative/keyinteraction/focus/Core/ContextMenu.qml
+++ b/examples/declarative/keyinteraction/focus/Core/ContextMenu.qml
@@ -53,6 +53,13 @@ FocusScope {
color: "#D1DBBD"
focus: true
Keys.onRightPressed: mainView.focus = true
+
+ Text {
+ anchors { top: parent.top; horizontalCenter: parent.horizontalCenter; margins: 30 }
+ color: "black"
+ font.pixelSize: 14
+ text: "Context Menu"
+ }
}
}
}
diff --git a/examples/declarative/keyinteraction/focus/Core/GridMenu.qml b/examples/declarative/keyinteraction/focus/Core/GridMenu.qml
index 19f7235..88840cb 100644
--- a/examples/declarative/keyinteraction/focus/Core/GridMenu.qml
+++ b/examples/declarative/keyinteraction/focus/Core/GridMenu.qml
@@ -43,7 +43,10 @@ import Qt 4.7
FocusScope {
property alias interactive: gridView.interactive
- onActiveFocusChanged: if (activeFocus) mainView.state = ""
+ onActiveFocusChanged: {
+ if (activeFocus)
+ mainView.state = ""
+ }
Rectangle {
anchors.fill: parent
@@ -60,7 +63,7 @@ FocusScope {
focus: true
model: 12
- KeyNavigation.down: listViews
+ KeyNavigation.down: listMenu
KeyNavigation.left: contextMenu
delegate: Item {
diff --git a/examples/declarative/keyinteraction/focus/Core/ListViews.qml b/examples/declarative/keyinteraction/focus/Core/ListMenu.qml
index 3d6ceab..6100b32 100644
--- a/examples/declarative/keyinteraction/focus/Core/ListViews.qml
+++ b/examples/declarative/keyinteraction/focus/Core/ListMenu.qml
@@ -43,7 +43,10 @@ import Qt 4.7
FocusScope {
clip: true
- onActiveFocusChanged: if (activeFocus) mainView.state = "showListViews"
+ onActiveFocusChanged: {
+ if (activeFocus)
+ mainView.state = "showListViews"
+ }
ListView {
id: list1
diff --git a/examples/declarative/keyinteraction/focus/focus.qml b/examples/declarative/keyinteraction/focus/focus.qml
index 56fdffc..9463192 100644
--- a/examples/declarative/keyinteraction/focus/focus.qml
+++ b/examples/declarative/keyinteraction/focus/focus.qml
@@ -55,27 +55,28 @@ Rectangle {
GridMenu {
id: gridMenu
-
width: parent.width; height: 320
+
focus: true
interactive: parent.activeFocus
}
- ListViews {
- id: listViews
+ ListMenu {
+ id: listMenu
y: 320; width: parent.width; height: 320
}
Rectangle {
id: shade
anchors.fill: parent
- color: "black"; opacity: 0
+ color: "black"
+ opacity: 0
}
states: State {
name: "showListViews"
PropertyChanges { target: gridMenu; y: -160 }
- PropertyChanges { target: listViews; y: 160 }
+ PropertyChanges { target: listMenu; y: 160 }
}
transitions: Transition {
diff --git a/examples/network/network.pro b/examples/network/network.pro
index 16c4087..458561a 100644
--- a/examples/network/network.pro
+++ b/examples/network/network.pro
@@ -16,9 +16,12 @@ SUBDIRS = \
threadedfortuneserver \
googlesuggest \
torrent \
- bearercloud \
bearermonitor
+ contains(QT_CONFIG, svg) {
+ SUBDIRS += bearercloud
+ }
+
# no QProcess
!vxworks:!qnx:SUBDIRS += network-chat
diff --git a/examples/tutorials/gettingStarted/gsQml/TextEditor.qml b/examples/tutorials/gettingStarted/gsQml/TextEditor.qml
deleted file mode 100644
index 6ffdd6d..0000000
--- a/examples/tutorials/gettingStarted/gsQml/TextEditor.qml
+++ /dev/null
@@ -1,129 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt 4.7
-import "core"
-
-Rectangle{
- id: screen
- width: 1000; height: 1000
- property int partition: height/3
- border.width: 1
- border.color: "#DCDCCC"
- 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:[
- 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}
- }
- ]
-
- 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 }
- }
- ]
-}
diff --git a/examples/tutorials/gettingStarted/gsQml/core/Button.qml b/examples/tutorials/gettingStarted/gsQml/core/Button.qml
deleted file mode 100644
index 28ae4ec..0000000
--- a/examples/tutorials/gettingStarted/gsQml/core/Button.qml
+++ /dev/null
@@ -1,110 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-import Qt 4.7
-
-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
- smooth: 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.00
- //Animate the scale property change
- Behavior on scale { NumberAnimation{ duration: 55} }
-
-} \ No newline at end of file
diff --git a/examples/tutorials/gettingStarted/gsQml/core/EditMenu.qml b/examples/tutorials/gettingStarted/gsQml/core/EditMenu.qml
deleted file mode 100644
index be9f6a1..0000000
--- a/examples/tutorials/gettingStarted/gsQml/core/EditMenu.qml
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-import Qt 4.7
-
-Rectangle{
- id: editMenu
- height: 480; width:1000
- 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) }
- }
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/examples/tutorials/gettingStarted/gsQml/core/FileDialog.qml b/examples/tutorials/gettingStarted/gsQml/core/FileDialog.qml
deleted file mode 100644
index 9948a27..0000000
--- a/examples/tutorials/gettingStarted/gsQml/core/FileDialog.qml
+++ /dev/null
@@ -1,170 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt 4.7
-
-Rectangle{
- id:dialog
- height: 200 * partition; width: 200
- color: "transparent"
-
- signal selectChanged()
- signal notifyRefresh()
- onNotifyRefresh:dirView.model = directory.files
-
- property string selectedFile
- property int selectedIndex: 0
-
- Rectangle{
- id: dirBox
- radius: 10
- anchors.centerIn:parent
- height: parent.height -15; width: parent.width -30
-
- Rectangle{
- id:header
- height:parent.height*0.1
- width: parent.width
- radius:3
- 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*.9
- anchors.top: header.bottom
- cellWidth: 100
- cellHeight: 75
-// highlight: Rectangle { width:cellWidth; height: cellHeight; color: "lightsteelblue" ;radius: 13}
- model: directory.files
- delegate: dirDelegate
- clip: true
- highlightMoveDuration:40
- }
-
- Component{
- id:dirDelegate
-
- Rectangle{
- id:file
- color: "transparent"
- width: GridView.view.cellWidth; height: GridView.view.cellHeight
-
- Text{
- id:fileName
- width: parent.width
- anchors.centerIn:parent
- text: name
- color: "#BDCACD"
- font.weight: GridView.view.currentIndex == index ? Font.DemiBold : Font.Normal
- font.pointSize: GridView.view.currentIndex == index ? 12 : 10
- elide: Text.ElideMiddle
- horizontalAlignment: Text.AlignHCenter
- }
- Rectangle{
- id:selection
- width:parent.width; height:parent.height
- anchors.centerIn: parent
- radius: 10
- smooth: true
- scale: GridView.view.currentIndex == index ? 1 : 0.5
- opacity: GridView.view.currentIndex == index ? 1 : 0
- Text{
- id:overlay
- width: parent.width
- anchors.centerIn:parent
- text: name
- color: "#696167"
- font.weight: Font.DemiBold
- font.pointSize: 12
- smooth:true
- 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.3) }
- }
- border.color:"lightsteelblue"
- border.width:1
- }
- MouseArea{
- id:fileMouseArea
- anchors.fill:parent
- hoverEnabled: true
-
- onClicked:{
- GridView.view.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" }
- }
- }
-} \ No newline at end of file
diff --git a/examples/tutorials/gettingStarted/gsQml/core/FileMenu.qml b/examples/tutorials/gettingStarted/gsQml/core/FileMenu.qml
deleted file mode 100644
index 20d8fd6..0000000
--- a/examples/tutorials/gettingStarted/gsQml/core/FileMenu.qml
+++ /dev/null
@@ -1,232 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt 4.7
-
-Rectangle{
- id: fileMenu
- height: 480; width:1000
- property color buttonBorderColor: "#7F8487"
- property color buttonFillColor: "#8FBDCACD"
- property string fileContent:directory.fileContent
-
- //the 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/tutorials/gettingStarted/gsQml/core/MenuBar.qml b/examples/tutorials/gettingStarted/gsQml/core/MenuBar.qml
deleted file mode 100644
index c387f5f..0000000
--- a/examples/tutorials/gettingStarted/gsQml/core/MenuBar.qml
+++ /dev/null
@@ -1,148 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import Qt 4.7
-
-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
- //container for the header and the buttons
- z: 1
- 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}
- smooth: true
- }
-
- //row displays its children in a vertical row
- Row{
- id: labelRow
- anchors.centerIn: parent
- spacing:40
- Button{
- id: fileButton
- height: 20; width: 50
- 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
- smooth:true
- //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
- 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
- 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
- gradient: Gradient{
- GradientStop { position: 0.0; color: editColor }
- GradientStop { position: 1.0; color: "#136F6F6F" }
- }
- }
- }
- }
-
- //list view 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 already have delegates handling their display
- VisualItemModel{
- id: menuListModel
-
- FileMenu{
- id:fileMenu
- width: menuListView.width; height: menuListView.height
- color: fileColor
- }
- EditMenu{
- color: editColor
- width: menuListView.width; height: menuListView.height
- }
- }
-} \ No newline at end of file
diff --git a/examples/tutorials/gettingStarted/gsQml/core/button.qml b/examples/tutorials/gettingStarted/gsQml/core/button.qml
new file mode 100644
index 0000000..dd5dcad
--- /dev/null
+++ b/examples/tutorials/gettingStarted/gsQml/core/button.qml
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+import Qt 4.7
+
+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
+ smooth: true
+ border { width: 2; 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.00
+ //Animate the scale property change
+ Behavior on scale { NumberAnimation{ duration: 55 } }
+
+} \ No newline at end of file
diff --git a/examples/tutorials/gettingStarted/gsQml/core/editMenu.qml b/examples/tutorials/gettingStarted/gsQml/core/editMenu.qml
new file mode 100644
index 0000000..7f47d9f
--- /dev/null
+++ b/examples/tutorials/gettingStarted/gsQml/core/editMenu.qml
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+import Qt 4.7
+
+Rectangle {
+ id: editMenu
+ height: 480; width:1000
+ 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) }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/examples/tutorials/gettingStarted/gsQml/core/fileDialog.qml b/examples/tutorials/gettingStarted/gsQml/core/fileDialog.qml
new file mode 100644
index 0000000..425f717
--- /dev/null
+++ b/examples/tutorials/gettingStarted/gsQml/core/fileDialog.qml
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt 4.7
+
+Rectangle {
+ id:dialog
+ height: 200 * partition; width: 200
+ color: "transparent"
+
+ signal selectChanged()
+ signal notifyRefresh()
+ onNotifyRefresh:dirView.model = directory.files
+
+ property string selectedFile
+ property int selectedIndex: 0
+
+ Rectangle {
+ id: dirBox
+ radius: 10
+ anchors.centerIn:parent
+ height: parent.height -15; width: parent.width -30
+
+ Rectangle {
+ id:header
+ height: parent.height*0.1; width: parent.width
+ radius:3
+ 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*.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: GridView.view.cellWidth; height: GridView.view.cellHeight
+
+ Text {
+ id:fileName
+ width: parent.width
+ anchors.centerIn: parent
+ text: name
+ color: "#BDCACD"
+ font.weight: GridView.view.currentIndex == index ? Font.DemiBold : Font.Normal
+ font.pointSize: GridView.view.currentIndex == index ? 12 : 10
+ elide: Text.ElideMiddle
+ horizontalAlignment: Text.AlignHCenter
+ }
+ Rectangle {
+ id: selection
+ width: parent.width; height: parent.height
+ anchors.centerIn: parent
+ radius: 10
+ smooth: true
+ scale: GridView.view.currentIndex == index ? 1 : 0.5
+ opacity: GridView.view.currentIndex == index ? 1 : 0
+ Text {
+ id: overlay
+ width: parent.width
+ anchors.centerIn: parent
+ text: name
+ color: "#696167"
+ font.weight: Font.DemiBold
+ font.pointSize: 12
+ smooth: true
+ 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.3) }
+ }
+ border.color: "lightsteelblue"
+ border.width: 1
+ }
+ MouseArea {
+ id:fileMouseArea
+ anchors.fill:parent
+ hoverEnabled: true
+
+ onClicked: {
+ GridView.view.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" }
+ }
+ }
+} \ No newline at end of file
diff --git a/examples/tutorials/gettingStarted/gsQml/core/fileMenu.qml b/examples/tutorials/gettingStarted/gsQml/core/fileMenu.qml
new file mode 100644
index 0000000..afe48c7
--- /dev/null
+++ b/examples/tutorials/gettingStarted/gsQml/core/fileMenu.qml
@@ -0,0 +1,232 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt 4.7
+
+Rectangle {
+ id: fileMenu
+ height: 480; width:1000
+ property color buttonBorderColor: "#7F8487"
+ property color buttonFillColor: "#8FBDCACD"
+ property string fileContent:directory.fileContent
+
+ //the 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/tutorials/gettingStarted/gsQml/core/menuBar.qml b/examples/tutorials/gettingStarted/gsQml/core/menuBar.qml
new file mode 100644
index 0000000..0695772
--- /dev/null
+++ b/examples/tutorials/gettingStarted/gsQml/core/menuBar.qml
@@ -0,0 +1,147 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt 4.7
+
+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
+ //container for the header and the buttons
+ z: 1
+ 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 }
+ smooth: true
+ }
+ //row displays its children in a vertical row
+ Row {
+ id: labelRow
+ anchors.centerIn: parent
+ spacing:40
+ Button {
+ id: fileButton
+ height: 20; width: 50
+ 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
+ smooth:true
+ //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
+ 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
+ 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
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: editColor }
+ GradientStop { position: 1.0; color: "#136F6F6F" }
+ }
+ }
+ }
+ }
+
+ //list view 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 already have delegates handling their display
+ VisualItemModel {
+ 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/tutorials/gettingStarted/gsQml/core/qmldir b/examples/tutorials/gettingStarted/gsQml/core/qmldir
index 1beb5ed..08575cc 100644
--- a/examples/tutorials/gettingStarted/gsQml/core/qmldir
+++ b/examples/tutorials/gettingStarted/gsQml/core/qmldir
@@ -38,11 +38,12 @@
**
****************************************************************************/
-Button ./Button.qml
-FileDialog ./FileDialog.qml
-TextArea ./TextArea.qml
-TextEditor ./TextEditor.qml
-EditMenu ./EditMenu.qml
-MenuBar ./MenuBar.qml
+Button ./button.qml
+FileDialog ./fileDialog.qml
+TextArea ./textArea.qml
+TextEditor ./textEditor.qml
+EditMenu ./editMenu.qml
+MenuBar ./menuBar.qml
+FileMenu ./fileMenu.qml
plugin FileDialog ../plugins
diff --git a/examples/tutorials/gettingStarted/gsQml/core/TextArea.qml b/examples/tutorials/gettingStarted/gsQml/core/textArea.qml
index 3953d9f..6d3d214 100644
--- a/examples/tutorials/gettingStarted/gsQml/core/TextArea.qml
+++ b/examples/tutorials/gettingStarted/gsQml/core/textArea.qml
@@ -40,47 +40,48 @@
import Qt 4.7
-Rectangle{
- id:textArea
+Rectangle {
+ id:textArea
- function paste(){ textEdit.paste()}
- function copy() { textEdit.copy() }
- function selectAll() { textEdit.selectAll() }
+ function paste() { textEdit.paste() }
+ function copy() { textEdit.copy() }
+ function selectAll() { textEdit.selectAll() }
- width :400; height:400
+ 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
+ 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
- //Will move the text Edit area to make the 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;
- }
+ boundsBehavior: Flickable.StopAtBounds
+ flickableDirection: Flickable.HorizontalFlick
+ interactive: true
+ //Will move the text Edit area to make the 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
- }
- }
+ 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
+ }
+ }
} \ No newline at end of file
diff --git a/examples/tutorials/gettingStarted/gsQml/filedialog/cppPlugins.pro b/examples/tutorials/gettingStarted/gsQml/filedialog/cppPlugins.pro
index 6247747..d85787d 100644
--- a/examples/tutorials/gettingStarted/gsQml/filedialog/cppPlugins.pro
+++ b/examples/tutorials/gettingStarted/gsQml/filedialog/cppPlugins.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/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.cpp b/examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.cpp
index c0132c0..e3a82dc 100644
--- a/examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.cpp
+++ b/examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.cpp
@@ -43,14 +43,11 @@
#include "file.h"
#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>");
-
+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");
}
//FileDialog is the plugin name (same as the TARGET in the project file) and DialogPlugin is the plugin classs
diff --git a/examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.h b/examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.h
index 7f8d3ff..c345641 100644
--- a/examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.h
+++ b/examples/tutorials/gettingStarted/gsQml/filedialog/dialogPlugin.h
@@ -45,12 +45,12 @@
class DialogPlugin : public QDeclarativeExtensionPlugin
{
- Q_OBJECT
-
- public:
- //registerTypes is inherited from QDeclarativeExtensionPlugin
- void registerTypes(const char *uri);
-
+ Q_OBJECT
+
+ public:
+ //registerTypes is inherited from QDeclarativeExtensionPlugin
+ void registerTypes(const char *uri);
+
};
#endif
diff --git a/examples/tutorials/gettingStarted/gsQml/filedialog/directory.cpp b/examples/tutorials/gettingStarted/gsQml/filedialog/directory.cpp
index b3e0256..c46a65b 100644
--- a/examples/tutorials/gettingStarted/gsQml/filedialog/directory.cpp
+++ b/examples/tutorials/gettingStarted/gsQml/filedialog/directory.cpp
@@ -48,172 +48,177 @@ 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){
- m_dir.mkdir(m_saveDir);
- m_dir.cd(m_saveDir);
- }
- m_filterList << "*.txt";
-
- refresh();
+ 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 ) {
+ m_dir.mkdir(m_saveDir);
+ m_dir.cd(m_saveDir);
+ }
+ m_filterList << "*.txt";
+ refresh();
}
/*
Directory::filesNumber
Return the number of Files
*/
-int Directory:: filesCount() const{
- return m_fileList.size();
+int Directory::filesCount() const
+{
+ return m_fileList.size();
}
/*
Function called to append data onto list property
*/
-void appendFiles(QDeclarativeListProperty<File> * property, File * file){
- //Do nothing. can't add to a directory using this method
+void appendFiles(QDeclarativeListProperty<File> * 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(QDeclarativeListProperty<File> * property, int index){
- return static_cast< QList<File *> *>(property->data)->at(index);
+File* fileAt(QDeclarativeListProperty<File> * property, int index)
+{
+ return static_cast< QList<File *> *>(property->data)->at(index);
}
/*
Returns the number of files in the list
*/
-int filesSize(QDeclarativeListProperty<File> * property){
- return static_cast< QList<File *> *>(property->data)->size();
+int filesSize(QDeclarativeListProperty<File> * property)
+{
+ return static_cast< QList<File *> *>(property->data)->size();
}
/*
Function called to empty the list property contents
*/
-void clearFilesPtr(QDeclarativeListProperty<File> *property){
- return static_cast< QList<File *> *>(property->data)->clear();
+void clearFilesPtr(QDeclarativeListProperty<File> *property)
+{
+ return static_cast< QList<File *> *>(property->data)->clear();
}
/*
Returns the list of files as a QDeclarativeListProperty.
*/
-QDeclarativeListProperty<File> Directory::files(){
-
- refresh();
-// return QDeclarativeListProperty<QString>(this,m_filePtrList); //not recommended in the docs
- return QDeclarativeListProperty<File>( this, &m_fileList, &appendFiles, &filesSize, &fileAt, &clearFilesPtr );
+QDeclarativeListProperty<File> Directory::files()
+{
+ refresh();
+ return QDeclarativeListProperty<File>( this, &m_fileList, &appendFiles, &filesSize, &fileAt, &clearFilesPtr );
}
/*
-Return te name of the currently selected file
+Return the name of the currently selected file
*/
-QString Directory::filename() const{
- return currentFile.name();
+QString Directory::filename() const
+{
+ return currentFile.name();
}
/*
Return the file's content as a string.
*/
-QString Directory::fileContent() const{
- return m_fileContent;
+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();
- }
+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();
- }
+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 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);
- outStream << m_fileContent;
- }
- file.close();
- refresh();
- emit directoryChanged();
+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);
+ 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();
+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);
- }
+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);
+ }
} \ No newline at end of file
diff --git a/examples/tutorials/gettingStarted/gsQml/filedialog/directory.h b/examples/tutorials/gettingStarted/gsQml/filedialog/directory.h
index bef1a93..0dc388a 100644
--- a/examples/tutorials/gettingStarted/gsQml/filedialog/directory.h
+++ b/examples/tutorials/gettingStarted/gsQml/filedialog/directory.h
@@ -49,60 +49,59 @@
#include <QDeclarativeListProperty>
#include <QObject>
-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;
- QString fileContent() const;
- QDeclarativeListProperty<File> 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<File *> m_fileList;
-
- //refresh content of the directory
- void refresh();
-};
+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;
+ QString fileContent() const;
+ QDeclarativeListProperty<File> 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<File *> m_fileList;
+
+ //refresh content of the directory
+ void refresh();
+};
#endif
diff --git a/examples/tutorials/gettingStarted/gsQml/filedialog/file.cpp b/examples/tutorials/gettingStarted/gsQml/filedialog/file.cpp
index 39a7469..ccf762c 100644
--- a/examples/tutorials/gettingStarted/gsQml/filedialog/file.cpp
+++ b/examples/tutorials/gettingStarted/gsQml/filedialog/file.cpp
@@ -43,15 +43,15 @@
File::File(QObject *parent) : QObject(parent)
{
- m_name = "";
+ m_name = "";
}
QString File::name() const{
- return m_name;
+ return m_name;
}
void File::setName(const QString &str){
- if(str != m_name){
- m_name = str;
- emit nameChanged();
- }
+ if(str != m_name){
+ m_name = str;
+ emit nameChanged();
+ }
} \ No newline at end of file
diff --git a/examples/tutorials/gettingStarted/gsQml/filedialog/file.h b/examples/tutorials/gettingStarted/gsQml/filedialog/file.h
index e4ba429..606f374 100644
--- a/examples/tutorials/gettingStarted/gsQml/filedialog/file.h
+++ b/examples/tutorials/gettingStarted/gsQml/filedialog/file.h
@@ -46,22 +46,22 @@
#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;
+
+ 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 \ No newline at end of file
diff --git a/examples/tutorials/gettingStarted/gsQml/images/qt-logo.png b/examples/tutorials/gettingStarted/gsQml/images/qt-logo.png
deleted file mode 100644
index 14ddf2a..0000000
--- a/examples/tutorials/gettingStarted/gsQml/images/qt-logo.png
+++ /dev/null
Binary files differ
diff --git a/examples/tutorials/gettingStarted/gsQml/texteditor.qml b/examples/tutorials/gettingStarted/gsQml/texteditor.qml
new file mode 100644
index 0000000..3bd9d55
--- /dev/null
+++ b/examples/tutorials/gettingStarted/gsQml/texteditor.qml
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import Qt 4.7
+import "core"
+
+Rectangle {
+ id: screen
+ width: 1000; height: 1000
+ property int partition: height/3
+ border { width: 1; color: "#DCDCCC"}
+ 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"; 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:[
+ 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 }
+ }
+ ]
+
+ 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 }
+ }
+ ]
+}