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. Passing objects derived from 'B' to functions that expect parameters of type 'B'
QtWS25 Last Chance

Passing objects derived from 'B' to functions that expect parameters of type 'B'

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 775 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
    Exotic_Devel
    wrote on last edited by
    #1

    I think this is a matter of OOP.

    In my test I am getting a type error:

    @expected data of type 'QObject*', got 'TestDataAccess*' for element 0 of data with tag 'Normal'@

    But 'TestDataAccess' is derived from QObject. How to make the method receives any object that derives QObject?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      arsinte_andrei
      wrote on last edited by
      #2

      did you tried to cast it?
      like @
      AtpSingleApplication *singleApp = qobject_cast<AtpSingleApplication *> (qApp);@

      1 Reply Last reply
      0
      • E Offline
        E Offline
        Exotic_Devel
        wrote on last edited by
        #3

        Thanks! this solved

        1 Reply Last reply
        0
        • A Offline
          A Offline
          arsinte_andrei
          wrote on last edited by
          #4

          then if you want to mark it as [SOLVED] for others to know

          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