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. Qt Creator only recognize type of my custom QML component but the property does not
Forum Update on Tuesday, May 27th 2025

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

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 554 Views 1 Watching
  • 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 Offline
    K Offline
    kangherr
    wrote on 27 Jul 2020, 23:23 last edited by
    #1

    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
    0
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 28 Jul 2020, 07:58 last edited by
      #2

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

      (Z(:^

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kangherr
        wrote on 28 Jul 2020, 23:36 last edited by kangherr
        #3

        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?

        S 1 Reply Last reply 29 Jul 2020, 05:27
        0
        • K kangherr
          28 Jul 2020, 23:36

          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?

          S Offline
          S Offline
          sierdzio
          Moderators
          wrote on 29 Jul 2020, 05:27 last edited by
          #4

          @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
          0

          1/4

          27 Jul 2020, 23:23

          • Login

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