PyQt 5.11: Connecting to QAbstractItemModel::headerDataChanged fails

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

PyQt 5.11: Connecting to QAbstractItemModel::headerDataChanged fails

Florian Bruhin
Hi,

I did just run my testsuite with PyQt 5.11, and it looks like connecting
to the QAbstractItemModel::headerDataChanged signal fails (which causes
anything using pytest-qt's modeltester[1] to fail):

    >>> from PyQt5.QtGui import QStandardItemModel
    >>> model = QStandardItemModel()
    >>> model.headerDataChanged
    <bound PYQT_SIGNAL headerDataChanged of QStandardItemModel object at 0x7f53e465e438>
    >>> model.headerDataChanged.connect(lambda: None)
    QObject::connect: No such signal QStandardItemModel::headerDataChanged(Orientation,int,int)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: connect() failed between (Qt::Orientation,int,int) and unislot()

The same thing also seems to happen with a @pyqtSlot-decorated slot in a
QObject.

I've also tried somehow getting the correct overload via
headerDataChanged[int, int, int] and [Qt.Orientation, int, int], without
any luck.

Not sure yet whether it's only that signal, or whether it also affects
other signals using enums or so... I've only seen it there so far.

[1] http://pytest-qt.readthedocs.io/en/latest/modeltester.html

Florian

--
https://www.qutebrowser.org | [hidden email] (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
         I love long mails! | https://email.is-not-s.ms/

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: PyQt 5.11: Connecting to QAbstractItemModel::headerDataChanged fails

Detlev Offenbach
Hi,

I am observing a similar issue. I am getting

QObject::connect: No such signal
Editor::marginClicked(int,int,KeyboardModifiers)

The method/slot to is defined with

    @pyqtSlot(int, int, Qt.KeyboardModifiers)
    def __marginClicked(self, margin, line, modifiers):

The same error message is given, if the @pyqtSlot line is absent.

How can I overcome this issue because it means, that eric is not usable with
PyQt 5.11.

Detlev

Am Samstag, 23. Juni 2018, 17:07:56 CEST schrieb Florian Bruhin:

> Hi,
>
> I did just run my testsuite with PyQt 5.11, and it looks like connecting
> to the QAbstractItemModel::headerDataChanged signal fails (which causes
>
> anything using pytest-qt's modeltester[1] to fail):
>     >>> from PyQt5.QtGui import QStandardItemModel
>     >>> model = QStandardItemModel()
>     >>> model.headerDataChanged
>
>     <bound PYQT_SIGNAL headerDataChanged of QStandardItemModel object at
> 0x7f53e465e438>
>     >>> model.headerDataChanged.connect(lambda: None)
>
>     QObject::connect: No such signal
> QStandardItemModel::headerDataChanged(Orientation,int,int) Traceback (most
> recent call last):
>       File "<stdin>", line 1, in <module>
>     TypeError: connect() failed between (Qt::Orientation,int,int) and
> unislot()
>
> The same thing also seems to happen with a @pyqtSlot-decorated slot in a
> QObject.
>
> I've also tried somehow getting the correct overload via
> headerDataChanged[int, int, int] and [Qt.Orientation, int, int], without
> any luck.
>
> Not sure yet whether it's only that signal, or whether it also affects
> other signals using enums or so... I've only seen it there so far.
>
> [1] http://pytest-qt.readthedocs.io/en/latest/modeltester.html
>
> Florian

--
Detlev Offenbach
[hidden email]


_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: PyQt 5.11: Connecting to QAbstractItemModel::headerDataChanged fails

Florian Bruhin
Hey,

On Sat, Jun 23, 2018 at 06:10:36PM +0200, Detlev Offenbach wrote:
> QObject::connect: No such signal
> Editor::marginClicked(int,int,KeyboardModifiers)

I assume Editor::marginClicked is a custom signal? How is it defined?

FWIW, as a workaround I added a definition of the headerDataChanged
signal to my model subclasses, like so:

    class CompletionModel(QAbstractItemModel):
   
        if PYQT_VERSION == 0x050b00:
            headerDataChanged = pyqtSignal(Qt.Orientation, int, int)
   
        def __init__(self, ...):
            ...

I'm not sure what happens when the model actually gets emitted (from
either Qt or PyQt), but at least that allows pytest-qt to connect to it
again.

Florian

--
https://www.qutebrowser.org | [hidden email] (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
         I love long mails! | https://email.is-not-s.ms/

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: PyQt 5.11: Connecting to QAbstractItemModel::headerDataChanged fails

Detlev Offenbach

Am Samstag, 23. Juni 2018, 18:23:44 CEST schrieb Florian Bruhin:
> Hey,
>
> On Sat, Jun 23, 2018 at 06:10:36PM +0200, Detlev Offenbach wrote:
> > QObject::connect: No such signal
> > Editor::marginClicked(int,int,KeyboardModifiers)

No, class Editor is derived from QsciScintilla and the signal is one of the
QsciScintilla base class.

>
> I assume Editor::marginClicked is a custom signal? How is it defined?
>
> FWIW, as a workaround I added a definition of the headerDataChanged
> signal to my model subclasses, like so:
>
>     class CompletionModel(QAbstractItemModel):
>
>         if PYQT_VERSION == 0x050b00:
>             headerDataChanged = pyqtSignal(Qt.Orientation, int, int)
>
>         def __init__(self, ...):
>             ...
>
> I'm not sure what happens when the model actually gets emitted (from
> either Qt or PyQt), but at least that allows pytest-qt to connect to it
> again.
>
> Florian

--
Detlev Offenbach
[hidden email]


_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: PyQt 5.11: Connecting to QAbstractItemModel::headerDataChanged fails

Phil Thompson-5
In reply to this post by Florian Bruhin
On 23 Jun 2018, at 4:07 pm, Florian Bruhin <[hidden email]> wrote:

>
> Hi,
>
> I did just run my testsuite with PyQt 5.11, and it looks like connecting
> to the QAbstractItemModel::headerDataChanged signal fails (which causes
> anything using pytest-qt's modeltester[1] to fail):
>
>>>> from PyQt5.QtGui import QStandardItemModel
>>>> model = QStandardItemModel()
>>>> model.headerDataChanged
>    <bound PYQT_SIGNAL headerDataChanged of QStandardItemModel object at 0x7f53e465e438>
>>>> model.headerDataChanged.connect(lambda: None)
>    QObject::connect: No such signal QStandardItemModel::headerDataChanged(Orientation,int,int)
>    Traceback (most recent call last):
>      File "<stdin>", line 1, in <module>
>    TypeError: connect() failed between (Qt::Orientation,int,int) and unislot()
>
> The same thing also seems to happen with a @pyqtSlot-decorated slot in a
> QObject.
>
> I've also tried somehow getting the correct overload via
> headerDataChanged[int, int, int] and [Qt.Orientation, int, int], without
> any luck.
>
> Not sure yet whether it's only that signal, or whether it also affects
> other signals using enums or so... I've only seen it there so far.
>
> [1] http://pytest-qt.readthedocs.io/en/latest/modeltester.html

There will be new releases tomorrow. Unfortunately its a regression in the SIP code generator that affects all the wheels.

Phil
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: PyQt 5.11: Connecting to QAbstractItemModel::headerDataChanged fails

Florian Bruhin
On Sat, Jun 23, 2018 at 09:11:55PM +0100, Phil Thompson wrote:
> There will be new releases tomorrow. Unfortunately its a regression in the SIP code generator that affects all the wheels.

I've just tried 5.11.1 as I saw it on PyPI, but unfortunately, it seems
worse.

Connecting to QObject::destroyed seems to fail:

  >>> from PyQt5.QtCore import QObject
  >>> obj = QObject()
  >>> obj.destroyed.connect(lambda: None)
  QObject::connect: No such signal QObject::destroyed(*)
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  TypeError: connect() failed between (QObject*) and unislot()

Connecting to QAbstractItemModel::layoutAboutToBeChanged and
QAbstractItemModel::layoutChanged:

  >>> from PyQt5.QtGui import QStandardItemModel
  >>> model = QStandardItemModel()
  >>> model.layoutAboutToBeChanged.connect(lambda: None)
  QObject::connect: No such signal QStandardItemModel::layoutAboutToBeChanged(QList<QPersistentModelIndex>,LayoutChangeHint)
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  TypeError: connect() failed between (QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint) and unislot()

Connecting to QWebEnginePage::featurePermissionRequested:

  >>> from PyQt5.QtWidgets import QApplication
  >>> from PyQt5.QtWebEngineWidgets import QWebEnginePage
  >>> app = QApplication([])
  >>> page = QWebEnginePage()
  >>> page.featurePermissionRequested.connect(lambda: None)
  QObject::connect: No such signal QWebEnginePage::featurePermissionRequested(QUrl,Feature)
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  TypeError: connect() failed between (QUrl,QWebEnginePage::Feature) and unislot()

Connecting to QProcess::error:

  >>> from PyQt5.QtCore import QProcess
  >>> proc = QProcess()
  >>> proc.error.connect(lambda: None)
  QObject::connect: No such signal QProcess::error(ProcessError)
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  TypeError: connect() failed between (QProcess::ProcessError) and unislot()

Connecting to QLocalSocket::error:

  >>> from PyQt5.QtNetwork import QLocalSocket
  >>> socket = QLocalSocket()
  >>> socket.error.connect(lambda: None)
  QObject::connect: No such signal QLocalSocket::error(LocalSocketError)
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  TypeError: connect() failed between (QLocalSocket::LocalSocketError) and unislot()

Trying to *emit* QNetworkReply::error:

  >>> from PyQt5.QtNetwork import QNetworkReply
  >>> class ErrorNetworkReply(QNetworkReply):
  ...   def __init__(self, *args):
  ...     super().__init__(*args)
  ...     self.error.emit(QNetworkReply.TimeoutError)
  ...
  >>> reply = ErrorNetworkReply()
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "<stdin>", line 4, in __init__
  AttributeError: 'ErrorNetworkReply' does not have a signal with the signature error(NetworkError)

Florian

--
https://www.qutebrowser.org | [hidden email] (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
         I love long mails! | https://email.is-not-s.ms/

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

signature.asc (849 bytes) Download Attachment