In my Qt Quick(Qt v5.4 and QtQuick 2.4) project I have these five .qml
files:
- MainForm.ui.qml - Which contains the main window of the application
- main.qml - Contains all the functionality implementations of objects of mainForm.ui.qml, such as onClicked events, calling c++ functions getting value from textInputs etc.
Q: Is my current setup for implementing functionality correct? Or should I implement all these things in the same file??
- dialog1.qml - Contains some text inputs for some settings etc.
- dialog2.qml - For some lists and tables in my application.
- dialog3.qml - Also contains some objects for an c++ function.
All these qml files are created and destroyed at different times, on different button clicks. I'm using this method to open a dialog
`addMenuArea.onClicked: {
Qt.createComponent("addMenuAppDialog.qml").createObject(rootWindow, {});
}`
and for destroying the dialog:
MouseArea{
anchors.fill: parent
onClicked: {
dialogComponent.destroy()
}
}
Now currently these dialogs doesn't have any functionality, like the main window, I want to do implement it all in one file(main.qml) without any javascript if possible. I have no Idea on how to link all the dialogs and main.qml so I can add the functions in main.qml. Any help will be great!
Loader
and change out the source file name. This would handle the creation/destruction of the objects. The third way would be to instantiate all the dialog and hide all of them except for the one that should be visible, but this uses more memory than needed. – saiarcot895Loader
which will link the dialogs and main.qml?? – Amol BorkarLoader.item
contains a reference to the top-level object that gets loaded. You can use that in conjunction withLoader.source
. – saiarcot895