[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] signals/slots don't work for QQuickItem derived class
From: Phil Thompson <phil () riverbankcomputing ! com>
Date: 2018-04-10 17:58:09
Message-ID: F64BA1F6-D5F1-43CD-A31F-27AF2288385E () riverbankcomputing ! com
[Download RAW message or body]
I think this is fixed in tonight's snapshot. However, as always with QtQuick/QML changes, regressions can be difficult to avoid so testing is recommended.
Phil
> On 30 Mar 2018, at 7:55 am, Alexander Rössler <alexander@roessler.systems> wrote:
>
> Yes, here we go:
> https://github.com/machinekoder/demonstrate-pyqt-bug
>
> Alex
>
> Phil Thompson writes:
>
>> On 29 Mar 2018, at 4:28 pm, Alexander Rössler <alexander@roessler.systems> wrote:
>>>
>>> Hello everyone,
>>>
>>> I have something weird happening.
>>>
>>> Take a look at this code:
>>>
>>> class WidgetController(QQuickItem):
>>>
>>> nameChanged = pyqtSignal(str)
>>> proxyChanged = pyqtSignal(WidgetProxy)
>>>
>>> def __init__(self, parent=None):
>>> super(WidgetController, self).__init__(parent)
>>>
>>> self._name = ''
>>> self._proxy = None
>>> self._widget = None
>>>
>>> self.nameChanged.connect(self._update_widget)
>>> self.proxyChanged.connect(self._update_widget)
>>>
>>> ...
>>>
>>> def _update_widget(self):
>>> if not self._proxy:
>>> return
>>>
>>> self._widget = self._proxy.widgets.get(self._name, None)
>>>
>>> During instantiation from QtQuick I get following error:
>>>
>>> QObject::connect: No such signal QQuickItem::nameChanged(QString)
>>> Traceback (most recent call last):
>>> File ".../base/widgetcontroller.py", line 19, in __init__
>>> self.nameChanged.connect(self._update_widget)
>>> TypeError: connect() failed between WidgetController.nameChanged[str]
>>> and unislot()
>>>
>>>
>>> Exactly the same code works as intended when I subclass QObject instead
>>> of QQuickItem. What am I doing wrong here?
>>
>> Can you send me a *complete* example that demonstrates the problem.
>>
>> Phil
>
>
> --
> Alexander Rössler
> HMI Expert at Rössler Systems
> Tel: +43 680 1348338
> Web: https://roessler.systems
> Blog: https://machinekoder.com
> alexander@roessler.systems
> Lebnergasse 1/7/7
> 1210 Wien - Austria
> ATU72251528
>
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic