c++ - QML Cannot assign to non-existent property -


i'm trying create custom qml object. started simple, making qml file called rect.qml:

import qtquick 2.2 rectangle  { } 

in same directory, wanted use rect object in seperate qml file, called window.qml:

import qtquick 2.2 item {   id: mainwindow   rect   { } } 

very high caliber stuff, know. anyway, when try run application, following error:

qrc:/qml/window.qml:3:13: cannot assign non-existent property "rect"

so checked qrc file, , goes such:

<rcc>     <qresource prefix="/qml">         <file>window.qml</file>         <file>rect.qml</file>     </qresource> </rcc> 

according documentation (http://doc.qt.io/qt-5/qtqml-documents-definetypes.html) application isn't useful it's bare bones, (simplified question,) there shouldn't error.

any appreciated!

you must rename file rect.qml , call rect{}


Comments