qmltypes file and dynamically defined properties



  • Hi,

    I have created a QML module and provide a qmltypes file for auto completion in QtCreator. Some of the types use a QQmlCustomParser for some special properties. Those are not predefined and thus, I cannot explicitly specify them in a qmltypes file.

        // snippet from qmltypes file
        Component {
            name: "Dimension"
            exports: [ "qst/Dimension 1.0" ]
            exportMetaObjectRevisions: [0]
        }
    

    QtCreator shows me a warning for every property that is not defined in the qmltypes file. Is there a possibility in the qmltypes file to say that the component may contain properties with arbitrary names?

    0_1530864442533_Screenshot_2018-07-06_10-06-53.png

    I would like to make an exception for certain components such as Dimension. The fact that it can contain a tag property depends on something else, defined at run-time.

    Thanks
    Richard



  • There is nothing special in the plugins.qnltypes for PropertyChanges, Connections or ListElement.

    I haven't read all the code nor understood it, but at first glance it seems that it is hardcoded in Qt Creator https://code.woboq.org/qt5/qt-creator/src/libs/qmljs/qmljsscopebuilder.cpp.html#172

    QQmlCustomParser is a private class so I guess you are out of luck and will need to deal with Qt Creator warnings.



  • Thank you for trying to help. Good idea to fake a Connections or ListElement type, but how can I set it as a prototype for my custom type? The following doesn't work:

        Component {
            name: "Dimension"
            prototype: "QtQuick/Connections 2.0"
            exports: [ "qst/Dimension 1.0" ]
            exportMetaObjectRevisions: [0]
        }
    

    I don't fully understand the linked code block, but it looks like QtCreator is not able to recognize a custom type derived from ListElement. I reported QTCREATORBUG-20734


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.