Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. qmltypes file and dynamically defined properties
QtWS25 Last Chance

qmltypes file and dynamically defined properties

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 470 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rweickelt
    wrote on last edited by rweickelt
    #1

    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

    1 Reply Last reply
    0
    • GrecKoG Offline
      GrecKoG Offline
      GrecKo
      Qt Champions 2018
      wrote on last edited by GrecKo
      #2

      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.

      1 Reply Last reply
      0
      • R Offline
        R Offline
        rweickelt
        wrote on last edited by rweickelt
        #3

        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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved