Fwd: QObject::connect: Parentheses expected, signal Actor::

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Fwd: QObject::connect: Parentheses expected, signal Actor::

Maxime Lemonnier
When I derive a class from QObject and use it from qml, I get annoying warnings if I declare a property in the qml declaration, and bind that property anywhere.

I get one 

'QObject::connect: Parentheses expected, signal MyClass::'

per binding, which can amount to a lot. so many in fact that it slows down startup time of my app significantly (.5s on Linux, 15-20s on Windoze).

I can fix it by deriving from QQuickItem instead, but then I hit a mysterious:

'TypeError: a maximum of 30 QQuickItem types may be registered with QML'

Where does this limitation comes from?, I get no hit from google on it. 

thank you

(I sent this message once, but I forgot I unsubscribed to mailing list, so I'm resending it since it does not appear in the archive, sorry If I double-sent)

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

Re: Fwd: QObject::connect: Parentheses expected, signal Actor::

Phil Thompson-5
On 28 Feb 2019, at 9:10 pm, Maxime Lemonnier <[hidden email]> wrote:

>
> When I derive a class from QObject and use it from qml, I get annoying warnings if I declare a property in the qml declaration, and bind that property anywhere.
>
> I get one
>
> 'QObject::connect: Parentheses expected, signal MyClass::'
>
> per binding, which can amount to a lot. so many in fact that it slows down startup time of my app significantly (.5s on Linux, 15-20s on Windoze).
>
> I can fix it by deriving from QQuickItem instead, but then I hit a mysterious:
>
> 'TypeError: a maximum of 30 QQuickItem types may be registered with QML'
>
> Where does this limitation comes from?, I get no hit from google on it.

It's an arbitrary PyQt limit. It can be increased but I wouldn't want to (for example) increase it by 10x.

If you have a short script that demonstrates the original problem I can look at it.

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

Re: Fwd: QObject::connect: Parentheses expected, signal Actor::

Maxime Lemonnier
yes of course! Than you!

----- main.py ----------
import sys

from PyQt5.QtCore import QUrl, QObject, pyqtProperty as Property, pyqtSignal as Signal
from PyQt5.QtQuick import QQuickView
from PyQt5.QtQml import qmlRegisterType
from PyQt5.QtGui import QGuiApplication, QOpenGLVersionProfile, QSurfaceFormat


class MyClass(QObject):
    def __init__(self, parent = None):
        super(MyClass, self).__init__(parent)
        self._bar = None
    def get_bar(self):
        return self._bar
    def set_bar(self, p):
        self._bar = p
    barChanged = Signal()
    bar = Property(int, get_bar, set_bar, notify = barChanged)

qmlRegisterType(MyClass, "MyModule", 1, 0, "MyClass")

if __name__ == '__main__':
    app = QGuiApplication(sys.argv)
    view = QQuickView()
    view.setSource( QUrl.fromLocalFile('whatever.qml') )
    view.show()
    QGuiApplication.processEvents()
# you should see QObject::connect: Parentheses expected, signal MyClass:: in the console



---------- whatever.qml ---------------

import QtQuick 2.5
import MyModule 1.0
Rectangle
{
    height: 800
    width: 800
    color: "blue"

    MyClass
    {
        property var foo : [10,20,30]
        bar: foo[0]
    }
}


On Thu, Feb 28, 2019 at 5:01 PM Phil Thompson <[hidden email]> wrote:
On 28 Feb 2019, at 9:10 pm, Maxime Lemonnier <[hidden email]> wrote:
>
> When I derive a class from QObject and use it from qml, I get annoying warnings if I declare a property in the qml declaration, and bind that property anywhere.
>
> I get one
>
> 'QObject::connect: Parentheses expected, signal MyClass::'
>
> per binding, which can amount to a lot. so many in fact that it slows down startup time of my app significantly (.5s on Linux, 15-20s on Windoze).
>
> I can fix it by deriving from QQuickItem instead, but then I hit a mysterious:
>
> 'TypeError: a maximum of 30 QQuickItem types may be registered with QML'
>
> Where does this limitation comes from?, I get no hit from google on it.

It's an arbitrary PyQt limit. It can be increased but I wouldn't want to (for example) increase it by 10x.

If you have a short script that demonstrates the original problem I can look at it.

Phil

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

Re: QObject::connect: Parentheses expected, signal Actor::

Phil Thompson-5
In reply to this post by Maxime Lemonnier
On 28 Feb 2019, at 9:10 pm, Maxime Lemonnier <[hidden email]> wrote:

>
> When I derive a class from QObject and use it from qml, I get annoying warnings if I declare a property in the qml declaration, and bind that property anywhere.
>
> I get one
>
> 'QObject::connect: Parentheses expected, signal MyClass::'
>
> per binding, which can amount to a lot. so many in fact that it slows down startup time of my app significantly (.5s on Linux, 15-20s on Windoze).
>
> I can fix it by deriving from QQuickItem instead, but then I hit a mysterious:
>
> 'TypeError: a maximum of 30 QQuickItem types may be registered with QML'
>
> Where does this limitation comes from?, I get no hit from google on it.
>
> thank you
>
> (I sent this message once, but I forgot I unsubscribed to mailing list, so I'm resending it since it does not appear in the archive, sorry If I double-sent)

This should be fixed in tonight's snapshot. I think the message is benign - but I'm not completely sure.

I've also doubled the limit on the number of QQuickItem types you can register.

Phil

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

Re: QObject::connect: Parentheses expected, signal Actor::

Maxime Lemonnier
Hi, 
Thank you very much. It seems indeed benign as all the implied bindings work correclty afaik. when should I expect for it to make it to PyPI?

Thanks for upping the limit, but, why the need for a limit? There isn't any on the C++ side?

Is it a global PyQt5 limit, or, e.g. a per-module limit?

On Wed, Mar 6, 2019 at 11:54 AM Phil Thompson <[hidden email]> wrote:
On 28 Feb 2019, at 9:10 pm, Maxime Lemonnier <[hidden email]> wrote:
>
> When I derive a class from QObject and use it from qml, I get annoying warnings if I declare a property in the qml declaration, and bind that property anywhere.
>
> I get one
>
> 'QObject::connect: Parentheses expected, signal MyClass::'
>
> per binding, which can amount to a lot. so many in fact that it slows down startup time of my app significantly (.5s on Linux, 15-20s on Windoze).
>
> I can fix it by deriving from QQuickItem instead, but then I hit a mysterious:
>
> 'TypeError: a maximum of 30 QQuickItem types may be registered with QML'
>
> Where does this limitation comes from?, I get no hit from google on it.
>
> thank you
>
> (I sent this message once, but I forgot I unsubscribed to mailing list, so I'm resending it since it does not appear in the archive, sorry If I double-sent)

This should be fixed in tonight's snapshot. I think the message is benign - but I'm not completely sure.

I've also doubled the limit on the number of QQuickItem types you can register.

Phil


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

Re: QObject::connect: Parentheses expected, signal Actor::

Phil Thompson-5
On 6 Mar 2019, at 6:01 pm, Maxime Lemonnier <[hidden email]> wrote:
>
> Hi,
> Thank you very much. It seems indeed benign as all the implied bindings work correclty afaik. when should I expect for it to make it to PyPI?

With the next release of PyQt, which will probably be after the next release of Qt.

> Thanks for upping the limit, but, why the need for a limit? There isn't any on the C++ side?

C++ is a static language and the implementation is template based.  This means that the types need to be registered at compile time.

> Is it a global PyQt5 limit, or, e.g. a per-module limit?

Global.

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

Re: QObject::connect: Parentheses expected, signal Actor::

Maxime Lemonnier
I see, then, by curiosity, why is there a limit on qquickitem derivations, and not on qobject derivations?



Thanks

On Wed., Mar. 6, 2019, 3:46 p.m. Phil Thompson, <[hidden email]> wrote:
On 6 Mar 2019, at 6:01 pm, Maxime Lemonnier <[hidden email]> wrote:
>
> Hi,
> Thank you very much. It seems indeed benign as all the implied bindings work correclty afaik. when should I expect for it to make it to PyPI?

With the next release of PyQt, which will probably be after the next release of Qt.

> Thanks for upping the limit, but, why the need for a limit? There isn't any on the C++ side?

C++ is a static language and the implementation is template based.  This means that the types need to be registered at compile time.

> Is it a global PyQt5 limit, or, e.g. a per-module limit?

Global.

Phil

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

Re: QObject::connect: Parentheses expected, signal Actor::

Phil Thompson-5
On 7 Mar 2019, at 12:29 pm, Maxime Lemonnier <[hidden email]> wrote:
>
> I see, then, by curiosity, why is there a limit on qquickitem derivations, and not on qobject derivations?

What makes you think there is no limit on qobject derivations?

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