From 787c8f0a614696ef803aed88ddb9a56d5f66f191 Mon Sep 17 00:00:00 2001
From: Pierre Rossi <pierre.rossi@digia.com>
Date: Tue, 18 Jun 2013 11:21:35 +0200
Subject: [PATCH] Qt Quick example: use a qrc file

---
 examples/qtquick/qtquick.pro     |  1 +
 examples/qtquick/quickwindow.cpp |  2 +-
 examples/qtquick/quickwindow.qml |  6 +++---
 examples/qtquick/resources.qrc   | 11 +++++++++++
 4 files changed, 16 insertions(+), 4 deletions(-)
 create mode 100644 examples/qtquick/resources.qrc

diff --git a/examples/qtquick/qtquick.pro b/examples/qtquick/qtquick.pro
index 6d3e8a62e..88412e8bb 100644
--- a/examples/qtquick/qtquick.pro
+++ b/examples/qtquick/qtquick.pro
@@ -7,6 +7,7 @@ HEADERS = quickwindow.h
 SOURCES = quickwindow.cpp main.cpp
 
 OTHER_FILES += quickwindow.qml
+RESOURCES += resources.qrc
 
 QT += quick \
       widgets # QApplication is required to get native styling with QtQuickControls
diff --git a/examples/qtquick/quickwindow.cpp b/examples/qtquick/quickwindow.cpp
index fed881fc0..6dd11cc11 100644
--- a/examples/qtquick/quickwindow.cpp
+++ b/examples/qtquick/quickwindow.cpp
@@ -65,5 +65,5 @@ public:
 ApplicationEngine::ApplicationEngine()
 {
     rootContext()->setContextProperty("utils", new Utils(this));
-    load(QUrl("quickwindow.qml"));
+    load(QUrl("qrc:/quickwindow.qml"));
 }
diff --git a/examples/qtquick/quickwindow.qml b/examples/qtquick/quickwindow.qml
index 3fe0389bf..bd6504d6b 100644
--- a/examples/qtquick/quickwindow.qml
+++ b/examples/qtquick/quickwindow.qml
@@ -17,19 +17,19 @@ ApplicationWindow {
             ToolButton {
                 id: backButton
                 iconName: "go-previous"
-                iconSource: "icons/go-previous.png"
+                iconSource: ":/icons/go-previous.png"
                 onClicked: webContentsView.goBack()
             }
             ToolButton {
                 id: forwardButton
                 iconName: "go-next"
-                iconSource: "icons/go-next.png"
+                iconSource: ":/icons/go-next.png"
                 onClicked: webContentsView.goForward()
             }
             ToolButton {
                 id: reloadButton
                 iconName: "view-refresh"
-                iconSource: "icons/view-refresh.png"
+                iconSource: ":/icons/view-refresh.png"
                 onClicked: webContentsView.reload()
             }
             TextField {
diff --git a/examples/qtquick/resources.qrc b/examples/qtquick/resources.qrc
new file mode 100644
index 000000000..a91907a60
--- /dev/null
+++ b/examples/qtquick/resources.qrc
@@ -0,0 +1,11 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+    <file>quickwindow.qml</file>
+</qresource>
+<qresource prefix="/icons">
+    <file alias="go-next.png">icons/go-next.png</file>
+    <file alias="go-previous.png">icons/go-previous.png</file>
+    <file alias="process-stop.png">icons/process-stop.png</file>
+    <file alias="view-refresh.png">icons/view-refresh.png</file>
+</qresource>
+</RCC>
-- 
GitLab