c++ - Problems defining and using types through QML files with QRC -


i'm having quite bit of trouble defining new object types through qml documents , trying use types. context, have main.qml uses mymenu add mymenu list of menu's. part working fine.

from there, create mywindow component mymenu.qml, , in mywindow.qml try use autotab.qml type can break apart tabs individual files.

the problems running seem related use of qrc file. if don't give mywindow alias, error file not found. if give mywindow alias, error autotab not type.

mymenu.qml

import qtquick 2.4 import qtquick.controls 1.3  menu {     id: m_mymenu     title: qstr("mine")     menuitem {         text: qstr("mywindow")         ontriggered: {             var component = qt.createcomponent("qrc:/mywindow");             if (component.status == component.ready) {                 var obj = component.createobject(null)                 obj.visible = true             }             else {                 console.log(component.errorstring())             }         }     } } 

mywindow.qml

import qtquick 2.4 import qtquick.controls 1.3 import qtquick.window 2.2 import qtquick.dialogs 1.2 import qtquick.layouts 1.1 import myqml.controls 1.0  window {     width: 640     height: 1024      tekhorizontaltabview     {         id: m_horizontaltabview         width: 1000         height: 400          autotab {}          tab {             title: "manualtab"         }     } } 

autotab.qml

import qtquick 2.4 import qtquick.controls 1.3 import qtquick.window 2.2 import qtquick.dialogs 1.2 import qtquick.layouts 1.1 import myqml.controls 1.0  tab {     title: "autotab" } 

qmlmain.qrc

<rcc>     <qresource prefix="/">         <file>qml/main.qml</file>         <file>qml/mymenu.qml</file>         <file alias="mywindow">qml/mywindow.qml</file>         <file>qml/autotab.qml</file>     </qresource> </rcc> 


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -