mirror of https://github.com/status-im/nimqml.git
Added example for showing load of qmls from resources
This commit is contained in:
parent
4813b30f11
commit
efd1a29927
|
@ -0,0 +1,3 @@
|
|||
nimcache
|
||||
main
|
||||
*.rcc
|
|
@ -0,0 +1,16 @@
|
|||
import nimqml
|
||||
|
||||
proc mainProc() =
|
||||
let app = newQApplication()
|
||||
defer: app.delete
|
||||
let engine = newQQmlApplicationEngine()
|
||||
defer: engine.delete
|
||||
let appDirPath = app.applicationDirPath & "/" & "main.rcc"
|
||||
QResource.registerResource(appDirPath)
|
||||
engine.load(newQUrl("qrc:///main.qml"))
|
||||
|
||||
app.exec()
|
||||
|
||||
when isMainModule:
|
||||
mainProc()
|
||||
GC_fullcollect()
|
|
@ -0,0 +1,2 @@
|
|||
--passL:"-lDOtherSide"
|
||||
--path:"../../src"
|
|
@ -0,0 +1,11 @@
|
|||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.2
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Window 2.1
|
||||
|
||||
ApplicationWindow {
|
||||
width: 400
|
||||
height: 300
|
||||
title: "Hello World"
|
||||
Component.onCompleted: visible = true
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
# Package
|
||||
|
||||
version = "0.1.0"
|
||||
author = "Filippo Cucchetto"
|
||||
description = "resourcebundling"
|
||||
license = "MIT"
|
||||
|
||||
bin = @["resourcebundling"]
|
||||
|
||||
# Dependencies
|
||||
|
||||
requires "nimqml >= 0.5.0"
|
||||
|
||||
task compileresources, "Compile the qrc into rcc":
|
||||
exec ("rcc --binary resources.qrc -o main.rcc")
|
||||
setCommand("nop")
|
||||
|
||||
task compilebinary, "Compile the binary":
|
||||
setCommand "c"
|
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE RCC>
|
||||
<RCC version="1.0">
|
||||
<qresource>
|
||||
<file>main.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
Loading…
Reference in New Issue