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. Qt5 and dynamic meta object
Forum Updated to NodeBB v4.3 + New Features

Qt5 and dynamic meta object

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 3.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.
  • R Offline
    R Offline
    renato.filho
    wrote on last edited by
    #1

    I'm working to port a library based on qt4.8 and qtquick 1.1 to qt5 and qtquick 2.0.
    This library uses dynamic metaobject to export dynamic properties signals and slot.
    What this library does is override the metaObject() function to return a new custom metaobject.
    This use to work on qt4 as you can see on this "example":https://github.com/renatofilho/qml4.git [1], but during my port to qt5 this stoped to work,
    I'm not sure whats happen but now the same "code ported to qt5":https://github.com/renatofilho/test-qml.git [2] does not work as expected.

    Could someone help me on that, I'm afraid of that now qtquick check on static metaobject information, before query for any property value.
    This will make impossible to port the current code to work in the same way in qt5.

    [1] Qt4.8 example: https://github.com/renatofilho/qml4.git
    [2] Qt5.0 beta1 example: https://github.com/renatofilho/test-qml.git

    Thanks

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      First - please fix the lionks, they don't work (first two).
      Second - you lack Q_OBJECT macro in small_object.h.
      Third - I'm not really sure that you want to achieve. Isn't it easier to work just on QObjects instead of reverting to QMO?

      (Z(:^

      1 Reply Last reply
      0
      • R Offline
        R Offline
        renato.filho
        wrote on last edited by
        #3

        [quote author="sierdzio" date="1349674255"]First - please fix the lionks, they don't work (first two).
        Second - you lack Q_OBJECT macro in small_object.h.
        Third - I'm not really sure that you want to achieve. Isn't it easier to work just on QObjects instead of reverting to QMO?[/quote]

        Hi sierdzio, Thanks for the hands up about the links, I have fixed it.
        About the macro "Q_OBJECT" This was not necessary to prove my problem, but anyway I have added it to make sure everithing is correct. (I have added the moc file too since I'm overriding the metaObject function and this function is automatic genereted by the moc command)

        What I'm tring to achieve/prove here is that. The method "metaObject()" is not called in Qt5 to check for properties, if you run both tests you will be able to see the message "Metaobject called" in the Qt4 version but not in Qt5.

        This is a very small example of my problem, what I really need to do is create a meta object dynamically and return it in the first call of "metaObject()" function with new properties based on some aruguments used in constructor.

        I'm tring to port "dconf-qt":https://gitorious.org/dconf-qt [1] to qt5 and because of that I need some dynamic metaobject, I have ported all the code the only missing problem now is with QML engine which does not call the "metaObject()" function.

        [1] https://gitorious.org/dconf-qt

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          I see. Not sure if I can help more right now, but at least this extended description will help someone else pick it up.

          (Z(:^

          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