Importing QML Component from sub directory

836 views
Skip to first unread message

Marcel Hauf

unread,
Apr 15, 2014, 11:56:15 AM4/15/14
to go-...@googlegroups.com
Hello,

how do I import a QML Component from a file located in a sub directory into a StackView.initialItem?
I uploaded an example of what am I trying to do here: https://github.com/Agon/qml-examples/blob/master/stackview/stackview.qml

It starts up fine but prints out these messages:
~/src/github.com/Agon/qml-examples/stackview$ go run main.go
2014/04/15 17:52:16 qtablegenerator.cpp:300: "Qt Warning - invalid keysym: dead_actute"
2014/04/15 17:52:16 stackview.qml:12: file:////home/marcel/src/github.com/Agon/qml-examples/stackview/stackview.qml:12: ReferenceError: WelcomePage is not defined

Thanks in advance.

Marcel Hauf

unread,
Apr 15, 2014, 12:54:03 PM4/15/14
to go-...@googlegroups.com
I found out how to do it.

I need to "create" the Component in the ApplicationWindow and then use it as an item.
I pushed a fix to the repo.

Gustavo Niemeyer

unread,
Apr 15, 2014, 1:01:09 PM4/15/14
to Marcel Hauf, Go QML
I'm not sure I understand the scenario.. if you want to import a qml file into another, you can import the directory the to be imported file is under, and then just use the item by its name in the main qml file.

For example, if you edit /examples/qmlscene/tutorial3.qml and add that line at the top:

    import "subdir/"

and then move Cell.qml file in there, the example should still work fine.



--
You received this message because you are subscribed to the Google Groups "go-qml" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go-qml+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

gustavo @ http://niemeyer.net
Reply all
Reply to author
Forward
0 new messages