Solved How to load any Qml file into a rectangle in main.qml?
-
Hi
i have two qml files, main.qml and gui1.qml.
gui1.qml is a Gui for emulating a hardware device and it works lonely.
i need to show that Gui in my main window. (inside a rectangle or in layout).
i wrote these codes below but the gui1.qml appears in a new window. i need it appear ** inside of main window**.
pls help me.// This is main.qml file import QtQuick 2.3 import QtQuick.Window 2.2 import QtQuick.Controls 1.4 Window { width: 800 height: 500 visible: true id:mainWin Rectangle { x: 10 y: 10 width: 100 height: 100 id: contRect } Item { id: container width: 500; height: 100 x:100 y:100 function createRadioWindow(){ var component = Qt.createComponent("file:gui1.qml"); var object = component.createObject(container, {"x": 0, "y": 0}); } } }
and
//This is gui1.qml file import QtQuick 2.3 import QtQuick.Window 2.2 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.2 import QtQuick.Extras 1.4 window { /* Some images,controls,rectangles,events ... */ }
-
Hi, just change gui1.qml to something like:
Item { // ... }
-
@Wieland
it works!
Thank you