Menu

modify-function sometimes does not work

Help
Tonka
2017-04-12
2017-04-12
  • Tonka

    Tonka - 2017-04-12

    Hey Florian,

    i have a strange problem with <modify-function>, sometimes it does not work.

    f.e.

    <object-type name="MyClass">
        <extra-includes>
          <include file-name="MyExtraClass" location="global"/>
        </extra-includes>
        <modify-function signature="myfunction()const" remove="all"/>
      </object-type>
    

    With some classes this works, but for some other classes it does not work. The only workaround i have found is to use the <rejection> directive before.

    <rejection name="MyClass" function-name="myfunction"/>
    <object-type name="MyClass">
        <extra-includes>
          <include file-name="MyExtraClass" location="global"/>
        </extra-includes>
      </object-type>
    

    The example above is a stripped down version. I have multiple removes in the same class. When i use the rejection method, i have to write my class name over and over again.

    Do you have any idea why this happen?
    I've tried to find the problem in the code but i'm not 100% sure where the rejection happens.

    I've use the latest truk version of pythonqt.

    Thx in advance
    Tonka

     
  • Florian Link

    Florian Link - 2017-04-12

    Hm, the class system is basically the original code from the QtScript generator. The rejection only matches the method name and even supports asterix. The modify function is very picky, you have to write the function name exactly like the class parser has seen it, I had trouble with the correct writing as well...

     
  • Tonka

    Tonka - 2017-04-13

    Ok. Do you now a good trick how i can print out (f.e. stdout) how the parser see the function definition?

     
  • Florian Link

    Florian Link - 2017-04-13

    I remember that I added a comment somewhere to print functions as the parser sees it, but I don't remember where, maybe look for commented couts...
    I think it would make sense to add an option to modify function that only matches by name, not by full signature or a remove-function tag. Maybe you can do that? If you grep for the xml tags you should find the place in the code easily.

     
  • Tonka

    Tonka - 2017-04-13

    I think it would make sense to add an option to modify function that only matches by name, not by full signature or a remove-function tag. Maybe you can do that?

    That make sense. If i find some time i will do it.
    At the moment i have some troubles with export macro as modifier on a methods, it seems that PythonQt will fallback to it's class-name as return value if there is a export macro in front of it.

     

    Last edit: Tonka 2017-04-13

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.