View Full Version : a quetion about signals and slots
krystosan
29th November 2012, 13:18
I started with signals and slots follwing the exercise at zetcode
button.clicked.connect(self.onClicked)
button = QGui.QPushButton()
if button is the object created
then what is clicked and connect
from what i understand if clicked is an event that occurred, so is it method defined inside QPushButton ?
what is connect then ?
amleto
29th November 2012, 13:34
clicked will represent the signal. connect is a method to join a signal to a slot
anda_skoa
30th November 2012, 17:43
from what i understand if clicked is an event that occurred, so is it method defined inside QPushButton ?
As amleto already said, "clicked" is what Qt calls a signal. Your guess was already very good, you can think of it as a high level event that the button sends whenever it is clicked and your assumption that it is implemented in the button class is also correct (not in QPushButton though, but in QPushButton's base class QAbstractButton).
what is connect then ?
Again as amleto said, it is a method to tell Qt which function you would like to get executed when the "clicked" signal/event happens.
Cheers,
_
krystosan
1st December 2012, 03:31
so can i think of clicked method sort of pure virtual function of C++:confused:
wysota
1st December 2012, 07:11
so can i think of clicked method sort of pure virtual function of C++:confused:
No, it's neither pure nor virtual. It's just a method declared in a class and implemented by a special tool called Meta-Object Compiler that is executed when Qt is built.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.