Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. Tags
    3. qobjectcast
    Log in to post

    • UNSOLVED How to check from C++ whether an object is of QML type Foo
      QML and Qt Quick • c++ type qobjectcast • • Stefan Monov76  

      8
      0
      Votes
      8
      Posts
      3135
      Views

      @Roumed: Thanks, the childItems suggestion sounds good, I'll implement it as it's more semantically correct. But for now I'll combine it with the isFoo workaround described here, because I'm not sure if Qt won't decide to insert visual children in my item if I change something in the future. Just like I didn't expect it would insert nonvisual children.
    • qobject_cast and dynamic cast fail, while static_cast seems to work
      General and Desktop • qsslsocket qobjectcast disconnected dynamiccast staticcast • • Bart_Vandewoestyne  

      8
      0
      Votes
      8
      Posts
      4148
      Views

      @Bart_Vandewoestyne said: Could my educated guess be correct? Your guess sounds reasonable to me. Does anybody have any idea why the original author of this code decided to make a difference between linux and non-linux? If I remove the ifdef and simply use close() in all situations, things seem to work, although it seems that in this case the ClientSslSocket destructor is no longer called (and I'm not sure if this is a good thing...). Nope, sorry. Are there any comments in the code, or in the commit history? Could you ask the author directly? What would be the clean solution here? How should FooBar's destructor look like? It's hard to say without knowing how the rest of the program is designed. Maybe you can manually disconnect the socket before deleting it?
    • qobject_cast() vs dynamic_cast()
      General and Desktop • qobjectcast dynamiccast • • Bart_Vandewoestyne  

      4
      0
      Votes
      4
      Posts
      12828
      Views

      In the meanwhile, I have code for #3 too, see https://github.com/BartVandewoestyne/Qt/tree/master/tests/qobject_cast_test I'm sure it can be improved and made more elegant (see e.g. the TODO in the file). Comments, suggestions or pull requests are definitely still welcome! When I run this program on my computer, it shows me that qobject_cast is about 6 to 13 times faster than dynamic_cast.
    • const qobject_cast for interfaces
      General and Desktop • qobjectcast qdeclareinterfa • • Asperamanca  

      1
      0
      Votes
      1
      Posts
      547
      Views

      No one has replied