summaryrefslogtreecommitdiffstats
path: root/examples/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative')
-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
14 files changed, 42 insertions, 28 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 {