Qt5 and dynamic meta object



  • 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


  • Moderators

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


  • Moderators

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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.