Reputation: 89
I have a few application with the same structure: same topBar, same bottomBar same size of window, and other. How can I create some template or something else to exclude a lot of copy-paste?
Upvotes: 1
Views: 185
Reputation: 4858
You can do something like this :
TopBar.qml
Item
{
// Something Something
}
BottomBar.qml
Item
{
// Something Something
}
AppWindow.qml
Item
{
// Something Something
}
Then, whenever you have to use these :
File1.qml
Item
{
// Something Something
Bottombar
{}
}
File2.qml
Item
{
// Something Something
Bottombar
{ x: 0, y: 600}
Topbar
{ x: 0, y: 0}
AppWindow
{ x: 10 ; y : 50 }
}
If you see the analogy, it is something like you created a class and then making objects of this class.
Upvotes: 0
Reputation: 34
The easiest way in my opinion will be creating a module with your common qml files
check: http://qt-project.org/doc/qt-5.0/qtqml/qtqml-modules-identifiedmodules.html
Upvotes: 1