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: Unresolved
    • P1: Critical
    • 6.0
    • 1.1.0
    • Shiboken
    • PySide 1.10, python 2.6 (Inside Maya2012 x64)

    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

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated: