[PyQt] sip reimplemented protected function

Phil Thompson phil at riverbankcomputing.com
Fri Jan 17 15:01:52 GMT 2014


On 16-01-2014 4:29 pm, Matt Newell wrote:
> I have a sip wrapped class HtmlHighlighter that inherits from
> QSyntaxHighlighter, and it won't compile giving the error:
>
> /usr/share/sip/PyQt4/QtGui/qsyntaxhighlighter.sip: In function 
> ‘PyObject*
> meth_HtmlHighlighter_setCurrentBlockUserData(PyObject*, PyObject*,
> PyObject*)’:
> /usr/share/sip/PyQt4/QtGui/qsyntaxhighlighter.sip:78:77: error:
> ‘qtgui_wrap_ancestors’ was not declared in this scope
>              PyObject *py_td = qtgui_wrap_ancestors(td,
> sipType_QTextDocument);
>
> First of all if QSyntaxHighlighter is already wrapped in PyQt[45], I 
> would
> think a subclass should not need to have the non-virtual protected 
> methods
> reimplemented to be accessible at the python level.  It should be
> safe to let
> python call meth_QSyntaxHighlighter_setCurrentBlockUserData, which 
> will call
> sipQSyntaxHighlighter's version.  I realize that sipHtmlHighlighter
> won't be a
> subclass of sipQSyntaxHighlighter, but that shouldn't actually matter
> in this
> case.  This may even be the case for virtual function, but I'm not 
> sure.
>
> Second, I think there should be a class annotation specifying that
> the wrapped
> class doesn't need access to the protected functions.

I think this is already fixed in the current snapshot.

Phil


More information about the PyQt mailing list