Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-31

shiboken.wrapInstance returns the type of object passed whereas sip.wrapinstance returns the best possible match

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3: Somewhat important
    • 6.7.0
    • 1.1.0, 6.6.1
    • Shiboken
    • PySide 1.10, python 2.6 (Inside Maya2012 x64)
    • All
    • b4144265b (dev), 31e7f5325 (dev), 691ae2831 (dev)

    Description

      Inside maya we use sip to get python objects for maya ui elements like the main window. What is great is I don't have to tell it every time what kind of object I want back and I get the best match (A QtGui.QMainWindow in this case). Which I can then pass as a parent to other calls.

      However with PySide it returns exactly what we pass and nothing better, which requires us to pass the specific thing we want each time. Not a big deal but certainly less awesome.

      >>> import sip
      >>> from PyQt4 import QtCore as PyQt_QtCore
      >>> from PyQt4 import QtGui as PyQt_QtGui
      >>> import shiboken
      >>> from PySide import QtCore, QtGui
      >>>
      >>> ptr = apiUI.MQtUtil.mainWindow()
      >>> print sip.wrapinstance(long(ptr), PyQt_QtCore.QObject)
      <PyQt4.QtGui.QMainWindow object at 0x000000002F6CA840>
      >>> print shiboken.wrapInstance(long(ptr), QtCore.QObject)
      <PySide.QtCore.QObject object at 0x000000002F7765C8>

      Attachments

        1. pyside31_nonexisting_pyqt.py
          1 kB
        2. pyside31_nonexisting.py
          1 kB
        3. pyside31_pyqt.py
          1 kB
        4. pyside31.py
          1 kB

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              kleint Friedemann Kleint
              shrtcww Ian Jones
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes