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

Shared pointer must be convertible to base class

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P4: Low P4: Low
    • 5.15.2
    • 5.15.1
    • Shiboken
    • None
    • All
    • eba68313c (dev), 3d3816a2b (dev), 6df09a034 (6.8), 0b2d89818 (6.8)

      In an example where we have two classes:

      class A {};
      
      class B:A {}; // has 'A' as base class
      

      Today is not possible to pass SharedPointer<B>  to a function that accepts SharedPointer<A>;

      Since SharedPointer<B> is not derived from SharedPointer<A> shiboken fails to covert it back to CPP;

      Problem #1 is signature

      RUN 1: ERROR: testSmartPointerConversions (__main__.SmartPointerTests)
      RUN 1: ----------------------------------------------------------------------
      RUN 1: Traceback (most recent call last):
      RUN 1:   File "sources/shiboken2/tests/smartbinding/smart_pointer_test.py", line 226, in testSmartPointerConversions
      RUN 1:     r = o.takeSharedPtrToInteger(integer2)
      RUN 1: TypeError: 'smart.Obj.takeSharedPtrToInteger' called with wrong argument types:
      RUN 1:   smart.Obj.takeSharedPtrToInteger(SharedPtr_Smart_Integer2)
      RUN 1: Supported signatures:
      RUN 1:   smart.Obj.takeSharedPtrToInteger(smart.SharedPtr[smart.Integer])
       

      Not sure if the C++ binding would work.

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

            renatofilho renato araujo oliveira filho
            renatofilho renato araujo oliveira filho
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: