Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error - when adding the qml file to the project.
Forum Updated to NodeBB v4.3 + New Features

Error - when adding the qml file to the project.

Scheduled Pinned Locked Moved Solved General and Desktop
qmlerrorqt quick
5 Posts 2 Posters 2.0k 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.
  • M Offline
    M Offline
    Mathan M
    wrote on last edited by
    #1

    Hi,

    I just added an listportalitems.qml under the Resources/Qml.qrc/qml. When I try add in main.qml, The error was shown

    qrc:/qml/main.qml:48 Cannot assign to non-existent property "listportalitems"

    An Redline appears. I hover the redline the message shown as - "Invalid PropertyName listportalitems.qml" (M16)

    How to get rid of this error?

    Thanks in advance

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by p3c0
      #2

      @Mathan-M

      A QML type can be defined either by a document in a .qml file beginning with a capital letter, or by a QObject-based C++ class.

      Rename your file and make first letter capital. Then it will be identified as a QML component.
      More info here:
      http://doc.qt.io/qt-5/qtqml-documents-definetypes.html#defining-an-object-type-with-a-qml-file

      157

      1 Reply Last reply
      1
      • M Offline
        M Offline
        Mathan M
        wrote on last edited by p3c0
        #3

        Thanks a lot p3c0,

        It worked. I have an query.

        it will be identified as a QML component.

        Is any other way to call other.qml in main.qml. Ex: In my scenario, In my app, First I will be showing the Login page, once the user get authenticated, User can view the list of items available in the server.
        I followed the below strategy, I created an Login.qml with user authentication code and I created ListPortalitem.qml to list the Portal Items.

        In the main.qml I called the Login {} and ListPortalitem{}. Am I following the right approach?

        Code Snippet: main.qml

        import QtQuick 2.3
        import QtQuick.Controls 1.2
        
        ApplicationWindow {
            id: appWindow
            width: 800
            height: 600
            title: "MapsV1"
        
        Login   {}
            
        ListPortalitems {}
        
        }//ApplicationWindow
        

        Issue: How can I show the ListPortalitems.qml after the user is validated successfully, since validation part is taking part on the Login.QML.

        Thanks in advance

        1 Reply Last reply
        0
        • p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #4

          @Mathan-M Yes your approach is correct.

          Issue: How can I show the ListPortalitems.qml after the user is validated successfully, since validation part is taking part on the Login.QML.

          To delay the initialization you can use following 2 ways:

          • Loader
          • createComponent and createQmlObject

          Check out whichever is more suitable to your needs. I think Loader should suffice in your case.

          157

          M 1 Reply Last reply
          2
          • p3c0P p3c0

            @Mathan-M Yes your approach is correct.

            Issue: How can I show the ListPortalitems.qml after the user is validated successfully, since validation part is taking part on the Login.QML.

            To delay the initialization you can use following 2 ways:

            • Loader
            • createComponent and createQmlObject

            Check out whichever is more suitable to your needs. I think Loader should suffice in your case.

            M Offline
            M Offline
            Mathan M
            wrote on last edited by
            #5

            @p3c0

            Thanks a lot.

            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