Looking at the question How can I create a new window from within QML? we see there that we can create a new window this way:
main.qml
import QtQuick 2.3
import QtQuick.Controls 1.2
ApplicationWindow {
id: root
width: 200; height: 200
Button {
anchors.centerIn: parent
text: qsTr("Click me")
onClicked: {
var component = Qt.createComponent("Child.qml")
var window = component.createObject(root)
window.show()
}
}
}
Child.qml
import QtQuick 2.3
import QtQuick.Controls 1.2
ApplicationWindow {
id: root
width: 100; height: 100
Text {
anchors.centerIn: parent
text: qsTr("Hello World.")
}
}
But this way doesn't seem possible to pass variables to the child.qml and then after we submit a form on this new Window get them on the main.qml, or is it possible? How can we do it?
About the variables being transfered to Child.qml i suppose something like this will do:
var b = tabButton.createObject(tabbar, {tabId: tabId, trCtx: tabs[t], tabTitle: c.title,
"font.pixelSize": 14, "font.bold": globals.menu.fontBold,
"font.family": robotoRegular.name})
If this is okey, then the only thing missing is getting values from Child.qml.