Help with autoconnect

More
5 years 5 months ago #207769 by persei8
I'm sick of editing the signal/slot connections that get broken every time I move a widget. Apparently, QT can auto-connect widget signals to handler slots. What I have is:
Code:
from PyQt5 import QtCore from qtvcp.qt_makegui import VCPWindow WIDGETS = VCPWindow()
Then down in the initialized__(self) module:
Code:
QtCore.QMetaObject.connectSlotsByName(WIDGETS)
I have tried self, self.w and WIDGETS. Using the latter 2 does not create errors but no connections are made either.
The slots look like this:
Code:
@QtCore.pyqtSlot() def on_object_name_clicked(): etc.
All slots that I'm trying to autoconnect have been deleted from the designer signal/slot editor.
Any advice on what I'm doing wrong?
Jim

Please Log in to join the conversation.

More
5 years 5 months ago #207838 by cmorley
Replied by cmorley on topic Help with autoconnect
self (the HandlerClasss) is not a subclass of QObject so connecting by 'slotname' won't work.
self.w is a subclass of QObject but doesn't have the handler functions in it in a way that 'slotname' can find it it seems.
I don't quite understand how designer connects to the handler file functions at the moment.
Code:
from qtvcp.qt_makegui import VCPWindow WIDGETS = VCPWindow()

Don't use this in the handler file- it's exactly the same as self.w

Chris

Please Log in to join the conversation.

More
5 years 5 months ago #207900 by persei8
Replied by persei8 on topic Help with autoconnect
OK thanks. I find it just as easy to create a new class in another module that explicitly makes all the connections. It works good and makes it way easier to manage especially when doing extensive changes to the designer file. I may integrate it with the handler later.
Jim

Please Log in to join the conversation.

Time to create page: 0.079 seconds
Powered by Kunena Forum