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. How to find out the original Component name during runtime?
QtWS25 Last Chance

How to find out the original Component name during runtime?

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 2 Posters 2.9k 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.
  • B Offline
    B Offline
    b.roth
    wrote on last edited by
    #1

    Hello,

    I want to write some sort of editor that is able to create simple QML files. Is it somehow possible to retrieve the component's original name (as it was named in the original QML file) after it has been loaded? Through QMetaObject's className it is only possible to get internal names like
    @AVHGradient_QMLTYPE_36
    QDeclarativeRectangle_QML_35@
    Any ideas?

    By the way, what's the difference between the QMLTYPE and QML namings above?

    Greets,
    Bernhard

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mbrasser
      wrote on last edited by
      #2

      "qmlInfo()":http://doc.qt.nokia.com/4.7/qdeclarativeengine.html#qmlInfo is able to extract this information. It uses QDeclarativeMetaType, which unfortunately is private (implementation is "here":http://qt.gitorious.org/qt/qtdeclarative/blobs/master/src/declarative/qml/qdeclarativeinfo.cpp ).

      Regards,
      Michael

      1 Reply Last reply
      0
      • B Offline
        B Offline
        b.roth
        wrote on last edited by
        #3

        Thank you Michael,

        I already stumbled over this while searching for solutions. Is there any reason why this is not pulic API or rather, are there any plans to make this public API (since something like e.g. QDeclarativeProperty is also publicly available)? I think this would be quite beneficial to the use and management of Qt Quick Components on the C++ side.

        Regards,
        Bernhard

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mbrasser
          wrote on last edited by
          #4

          Hi,

          I don't know of any plans; I'd recommend adding a suggestion at http://bugreports.qt.nokia.com with the what APIs you'd like to see public as well as reasons why.

          Regards,
          Michael

          1 Reply Last reply
          0
          • B Offline
            B Offline
            b.roth
            wrote on last edited by
            #5

            Thanks for your reply. I followed your suggestion and opened a report "QTBUG-22029":https://bugreports.qt.nokia.com/browse/QTBUG-22029
            Maybe you can have a look at it and comment if I did this correctly, since it's my first feature request to the Trolls. :)

            Regards,
            Bernhard

            [EDIT: change link to bug id for better recognition, Volker]

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mbrasser
              wrote on last edited by
              #6

              Hi Bernhard,

              Looks fine :-) . It's always good to describe your use case (which you did), as that allows for the possibility of the team suggesting or implementing alternative solutions.

              Regards,
              Michael

              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