Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. QA Tools
  3. Squish
  4. Passing return parameters from python to Qt object methods, like QVariant.toInt(bool* ok)
Forum Updated to NodeBB v4.3 + New Features

Passing return parameters from python to Qt object methods, like QVariant.toInt(bool* ok)

Scheduled Pinned Locked Moved Unsolved Squish
1 Posts 1 Posters 414 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.
  • D Offline
    D Offline
    Dave Hickerson
    wrote on last edited by Dave Hickerson
    #1

    Many of the object methods in Qt take pointer arguments that are meant to return data. I am trying to get runtime data out of QVariant that has either a list or an int stored in it for a Squish test using python. To me this seemed like a basic programming thing that would have been documented, but I can't find anything on it. I tried using the ctypes that is part of python,

    import ctypes
    # more code
    ok = ctypes.c_bool()
    count = object_qvariant_type.toInt(ctypes.byref(ok))
    if(ok)
        # do something with the int
    else
        # do something with the list
    

    but something in the ctypes byref() is returning a ctypes object that doesn't mess with the squish changes.

    I also tried this, assuming squish may have worked out some things under the covers:

    ok = false
    count = object_qvariant_type.toInt(ok)
    

    count returns fine, but ok doesn't get set by toInt() and appears the squish version of bool is not mutable like the python one.

    Can you get parameters in methods from Qt classes to return data using Squish?

    Dave Hickerson
    Blue Origin Senior Software Design Engineer
    dhickerson@blueorigin.com

    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