Menu

Problem with virtual const MyClass& = 0; as return value

Help
Tonka
2017-04-06
2017-04-06
  • Tonka

    Tonka - 2017-04-06

    Hey,

    i have a problem with member functions like virtual const MyReturnValueClass& foo() const = 0;
    I have the following class.

    class Person : public QObject
    {
        ...
    
        virtual const MyReturnValueClass& foo() const;
        ...
    }
    

    My Problem:
    My PythonQTShell_Person get the following method implementation:

    const MyReturnValueClass& foo() const
    {
        return const MyReturnValueClass&();
    }
    

    which simply does not compile.

    Is there anyway to make it work (like a code injection, modify or anything like that), because rejection does not work because it is pure virtual method.

    I'm using the lastest svn-trunk version from PythonQt and Qt 5.6.1 on Windows 7 x64 with Visual Studio 2010 SP1

    Thanks in advance
    Tonka

     
  • Florian Link

    Florian Link - 2017-04-06

    The problem is the const &, since PythonQt need to generate a shell class for the abstract class to allow deriving that class... If you don't need the shell class because you don't want to derive from that class in Python, then you can disable the shell generation for that class. Look in the typesystem files for "shell", there should be a keyword to disable the shell.
    Injection for abstract functions is not yet supported.

     
  • Tonka

    Tonka - 2017-04-07

    Hey Florian,

    thanks for answer. Reject from shell is a good option, i will try it. I also works when i reject the function and add a new one with inject-code, but the "remove from shell" is more my case.

    Thx

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.