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. Type error

Type error

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 455 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.
  • ODБOïO Offline
    ODБOïO Offline
    ODБOï
    wrote on last edited by
    #1

    I'm trying to test a class called SimpleBackend , it has a Q_Property bool co
    In one of my tests im doing this :

    bool conn = machine.co; // machine here is an instance of SimpleBackend
    

    and have this output :

    error: cannot convert 'SimpleBackend::co' from type 'bool (SimpleBackend::)()' to type 'bool'
    

    Can someone tell me how to solve this please ?
    Thx

    K 1 Reply Last reply
    0
    • ODБOïO ODБOï

      I'm trying to test a class called SimpleBackend , it has a Q_Property bool co
      In one of my tests im doing this :

      bool conn = machine.co; // machine here is an instance of SimpleBackend
      

      and have this output :

      error: cannot convert 'SimpleBackend::co' from type 'bool (SimpleBackend::)()' to type 'bool'
      

      Can someone tell me how to solve this please ?
      Thx

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @LeLev

      Did you try :

      bool conn = machine.co(); 
      

      At least that would be my guess based on the error message.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      2
      • ODБOïO Offline
        ODБOïO Offline
        ODБOï
        wrote on last edited by
        #3

        Hi @koahnig, Thank you. That solved the issue,
        Now i can understand the error message.

        So when you access a Q_PROPERTY :

        from QML :  property string v = myObject.prop
        from C++ :   QString        v = myObject.prop()
        
        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