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

Shared pointer return value in virtual function

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 5.14.0, 5.13.2
    • Shiboken
    • None
    • I've tested on windows with Visual Studio 2015, but probably this problem is also present for other systems.
    • All
    • 242f0fa7269e9baf331679dc413c28471b1f7d05 (pyside/pyside-setup/5.15)

    Description

      Wrapping classes which return shared pointers in a virtual method leads to this message

       

       #error: CppGenerator::writeVirtualMethodNative: B::genA(): Could not find a minimal constructor for type 'QSharedPointer<A >'. This will result in a compilation error.

      This is the header file which should be wrapped:

      #ifndef TEST_H
      #define TEST_H
      
      #include <QtCore/QSharedPointer>
      
      // if uncommented, you will get the following error when calling shiboken
      // #error:  CppGenerator::writeVirtualMethodNative: B::genA(): Could not find a minimal constructor for type 'QSharedPointer<A >'. This will result in a compilation error.
      #define SHIBOKEN_ERROR
      
      class A
      {
          public:
              int a;
              A(int _a);
              virtual ~A();
      };
      
      class B
      {
          public:
              int b;
              B(int _b);
              virtual ~B();
              void doSomething(QSharedPointer<A> a);
      #ifdef SHIBOKEN_ERROR
              virtual
      #endif
              QSharedPointer<A> genA();
      };
      
      #endif
       

      and this is the typesystem xml file:

      <!--?xml version="1.0"?-->
       <typesystem package="ptest">
       <load-typesystem name="typesystem_core.xml" generate="no" />
      
      <smart-pointer-type name="QSharedPointer" type="shared" getter="data" />
      
      <object-type name="A" />
       <object-type name="B" />
       </typesystem>
      

      Attachments

        Issue Links

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

          Activity

            People

              kleint Friedemann Kleint
              bdev a dev
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes