View Full Version : Common slot on some widgets [Qt3]
Opilki_Inside
27th March 2006, 11:52
Hello!
I have some QToolButton widgets on my QDialog. I want to use common slot to process clicked() signal. How can I know wich one of the QToolButton was clicked?
evgenM
27th March 2006, 13:19
u have connectio (blabla, SIGNAL(clicked()),SLOT(slot()))
void ClassName::slot()
{
QToolButton* tb = qobject_cast<QToolButton*>(sender());
if (tb)
{
do something with current toolbutton
}
}
Opilki_Inside
27th March 2006, 13:26
u have connectio (blabla, SIGNAL(clicked()),SLOT(slot()))
void ClassName::slot()
{
QToolButton* tb = qobject_cast<QToolButton*>(sender());
if (tb)
{
do something with current toolbutton
}
}
Thanks! It works fine!
jpn
27th March 2006, 14:26
You could also use a QButtonGroup.. ;)
SkripT
27th March 2006, 14:26
In this case it's more "elegant" to use QButtonGroup assigning an identificator for each icon.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.