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. QML Extension Objects: Registering extended type for default QML Items through qmlRegisterExtendedType
QtWS25 Last Chance

QML Extension Objects: Registering extended type for default QML Items through qmlRegisterExtendedType

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 3 Posters 2.7k 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 would like to extend all default elements available in QML with a new property. How to do this for custom types is explained in "QML Extension Objects":http://doc.qt.nokia.com/4.7-snapshot/qml-extending.html#extension-objects

    This works as expected when I try it like this
    @qmlRegisterExtendedType<QDeclarativeItem, SomeObject>("QtQuick", 1, 1, "SomeItem");@
    but it does exactly nothing when I try the following
    @qmlRegisterExtendedType<QDeclarativeItem, SomeObject>("QtQuick", 1, 1, "Item");@

    What exactly is the reason for this behaviour? Is it somehow possible to change all QDeclarativeItem derived Components (e.g. Rectangle, Text, etc.) at once, without having to modify QDeclarativeItem's source code?

    Greets,
    Bernhard

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      Just a hunch : item is a reserved keyword?

      Qt Certified Specialist
      www.edalsolutions.be

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

        Yes, this might be the reason. But I thought of it as an easy way to add some properties to all Items available. Especially I expected this to work since the doc I mentioned above states, that the extension object is just a child of the extended object.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jombi
          wrote on last edited by
          #4

          Guys, I ran into the same problem. I was trying to extend QDeclarativeItem with some properties, but then I cannot access anymore the "implicitWidth" and "implicitHeight" properties. More, state change seems not to be signaled either... Any idea? This is using Qt 4.8.1 on Linux.

          Thx!

          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