Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Qt Creator only recognize type of my custom QML component but the property does not

    QML and Qt Quick
    2
    4
    218
    Loading More Posts
    • 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.
    • K
      kangherr last edited by

      Qt Creator only recognizing the type of my custom qml component but the property inside the component does not.

      I registering the component with that option:

      qmlRegisterType(QUrl("qrc:/customcom/ViewApp.qml"), "com.mycompany.ui" , 1, 0, "ViewApp")
      

      then on main.qml

      import QtQuick 2.0
      
      import com.mycompany.ui 1.0 <-- I expect with this import option, make the code flexible and refactoring friendly
      
      ViewApp{
          id: viewApp
          anchors.fill: parent <-- Not Recognized by Qt Creator but can compile/run
      }
      

      Any advice?

      1 Reply Last reply Reply Quote 0
      • sierdzio
        sierdzio Moderators last edited by

        So what does it not recognize? The parent (is there any)? Or anchors?

        (Z(:^

        1 Reply Last reply Reply Quote 0
        • K
          kangherr last edited by kangherr

          Qt Creator only can show auto-completion for Component Name (ViewApp) but cannot show completion for property inside the component (inside ViewApp.qml).

          How to make Qt Creator also can show completion of the property inside the component?

          sierdzio 1 Reply Last reply Reply Quote 0
          • sierdzio
            sierdzio Moderators @kangherr last edited by

            @kangherr said in Qt Creator only recognize type of my custom QML component but the property does not:

            Qt Creator only can show auto-completion for Component Name (ViewApp) but cannot show completion for property inside the component (inside ViewApp.qml).

            I see.

            How to make Qt Creator also can show completion of the property inside the component?

            Use qmldir (make a QML module) instead of qmlRegisterType. When using qmlRegisterType, place it in main.cpp, if it is in another class, Qt Creator gets lost easily.

            (Z(:^

            1 Reply Last reply Reply Quote 0
            • First post
              Last post