Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. RTTI for non-QObject classes
QtWS25 Last Chance

RTTI for non-QObject classes

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.2k 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.
  • E Offline
    E Offline
    Eonz
    wrote on last edited by
    #1

    I am wanting to create a small GUI builder to allow editing of the properties of certain Qt types at runtime with a single function call. To do this it seems I should use QObject::metaObject().

    But some of the things I want to make editable (like QVector3D) do not derive from QObject, at least not as far as I can tell. Is there any other way to list the properties of a non-QObject class?

    Or will my GUI builder simply have to make special provision for those classes I wish to handle but that do not derive from QObject? In that case I might need to pass a void pointer to my function - how would I safely check if they point to certain types of classes (like QVector3D)?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      You can't in C++. QVector3D has no virtuals, thus no virtual table nor RTTI information. You need to use other means to store that information (QVariant / QMetaType come to mind).

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      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