Hi all, I am new to QT and am having problems loading one qml through another qml. I basically created the qml MyTabView (MyTabView.qml)
import QtQuick 2.3 import QtQuick.Controls 1.2 TabView { width: 360 height: 360 Component.onCompleted: { addTab("Tab 1", tab1) addTab("Tab 2", tab2) } Component { id: tab1 Rectangle {color: "red"} } Component { id: tab2 Rectangle {color: "blue"} } }
and I try to show it through another qml (main.qml) which is in the same directory
import QtQuick 2.3 import QtQuick.Controls 1.2 import "." ApplicationWindow { visible: true width: 640 height: 480 title: qsTr("Main") MyTabView {} }
but when I try to start my project, I get this error
QQmlApplicationEngine failed to load qrc component: /qml/main.qml: 11 TabView is not a type
Note that I have M Caps in MyTabView.qml and that MyTabView.qml and main.qml are in the same directory.
Can someone please tell me what mistake I am making? One thing I want to point out is that when I replace all MyTabView.qml code instead of MyTabView {} inside main.qml , the program gives no errors and works correctly. thanks in advance
source share