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

Typesystem created functions don't get injected in child classes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 5.12.0
    • Shiboken
    • None

    Description

      After the regression of including a new signature for QAbstractItemModel that supports a PyObject* as a third argument.

      createIndex(int, int, PyObject*);
      

      the QHelpIndexModel (which inherits from QAbstractItemModel) does not properly inject the code, and leave an empty case inside the wrapper. (qhelpindexmodel_wrapper.cpp)

              case 2: // createIndex(int row, int column, PyObject * ptr) const                              
              {                                                                                              
                  int cppArg0;                                                                               
                  pythonToCpp[0](pyArgs[0], &cppArg0);                                                       
                  int cppArg1;                                                                               
                  pythonToCpp[1](pyArgs[1], &cppArg1);                                                       
                                                                                                             
                  if (!PyErr_Occurred()) {                                                                   
                      // createIndex(int,int,PyObject*)const                                                 
                                                                                                             
                                                                                                             
                  }                                                                                          
                  break;                                                                                     
              } 
      

      The build output is:

      qt.shiboken: (help) Wrong index for %PYARG variable (3) on QHelpIndexModel::createIndex(int row, int column, PyObject * ptr) const
      

      A small "workaround" to get the code injected is to manually transform
      %PYARG_3 by pyArgs[3-1] (which is done by shiboken)

      // @snippet qabstractitemmodel-createindex
      //%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(%1, %2, %PYARG_3);
      %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(%1, %2, pyArgs[3-1]);
      %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
      // @snippet qabstractitemmodel-createindex
      

      but then the wrapper itself doesn't understand there is new overloads to the "createIndex" function.

      PySide2/QtHelp/PySide2/QtHelp/qhelpindexmodel_wrapper.cpp: In function ‘PyObject* Sbk_QHelpIndexModelFunc_createIndex(PyObject*, PyObject*, PyObject*)’:
      PySide2/QtHelp/PySide2/QtHelp/qhelpindexmodel_wrapper.cpp:222:91: error: no matching function for call to ‘QHelpIndexModel::createIndex(int&, int&, PyObject*&)’
                       QModelIndex cppResult = cppSelf->createIndex(cppArg0, cppArg1, pyArgs[3-1]);
                                                                                                 ^
      In file included from /home/crmaurei/dev/qt5.12-install/qtbase/include/QtHelp/qhelpindexwidget.h:1,
                       from PySide2/QtHelp/PySide2/QtHelp/pyside2_qthelp_python.h:59,
                       from PySide2/QtHelp/PySide2/QtHelp/qhelpindexmodel_wrapper.cpp:56:
      /home/crmaurei/dev/qt5.12/qttools/src/assistant/help/qhelpindexwidget.h:60:10: note: candidate: ‘void QHelpIndexModel::createIndex(const QString&)’
           void createIndex(const QString &customFilterName);
                ^~~~~~~~~~~
      /home/crmaurei/dev/qt5.12/qttools/src/assistant/help/qhelpindexwidget.h:60:10: note:   candidate expects 1 argument, 3 provided
      PySide2/QtHelp/PySide2/QtHelp/qhelpindexmodel_wrapper.cpp:248:91: error: no matching function for call to ‘QHelpIndexModel::createIndex(int&, int&, PyObject*&)’
                       QModelIndex cppResult = cppSelf->createIndex(cppArg0, cppArg1, pyArgs[3-1]);
                                                                                                 ^
      In file included from /home/crmaurei/dev/qt5.12-install/qtbase/include/QtHelp/qhelpindexwidget.h:1,
                       from PySide2/QtHelp/PySide2/QtHelp/pyside2_qthelp_python.h:59,
                       from PySide2/QtHelp/PySide2/QtHelp/qhelpindexmodel_wrapper.cpp:56:
      /home/crmaurei/dev/qt5.12/qttools/src/assistant/help/qhelpindexwidget.h:60:10: note: candidate: ‘void QHelpIndexModel::createIndex(const QString&)’
           void createIndex(const QString &customFilterName);
                ^~~~~~~~~~~
      /home/crmaurei/dev/qt5.12/qttools/src/assistant/help/qhelpindexwidget.h:60:10: note:   candidate expects 1 argument, 3 provided
      

      See https://codereview.qt-project.org/#/c/249231/ reverting https://codereview.qt-project.org/#/c/244992/

      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
              crmaurei Cristian Maureira-Fredes
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes