Hello! I develop a game and recently found QML very useful for logic, like QtScript is, but even further. So now I want to ask a few questions about things I couldn’t find in docs, but which are important.
1 In every example I see:
import QtQuick 2.0
Item { ...
also one can omit QtQuick usage, having own plugins, like this
import MyPlugin 1.0
MyType { ...
I want to know if it is possible to have .qml file without imports, with contents like this
// absolutely no imports here
Object { ...
2 What if I mess with working threads in my plugins the way I somehow MOVE my objects to another thread, for example in object constructor or something?
For some cases it looks fine, because Auto Connection should use Queued whenever caller and receiver are in different threads. But how does QML binding behave when objects are taken, and how to use Blocking Queued from JS (if possible)?
3 Why could anyone need .qml like this one?
import QtQuick 2.0
Item { ... }
Rectangle { ... }
Is it meaningless ill-syntax or it is possible to have such a code for some purpose? I could only find .qml’s with one object tree per file.
4 When does object construction take place? I assumed it is: construct – set each property – signal onCompleted, want to know if I’m right.
Also is that possible to pass any arguments to a constructor? What is the default object setup, who is parent in this case:
import QtQuick 2.0
Item { ... }
We actually spawn some QObject with some plugin, so does it have a parent? suppose it does, but who: plugin? QML engine?
Those are possibly very noob questions, but I feel like if I know the answers, I can do things :D
Thanks in advance!
↧