View Full Version : Common slot on some widgets [Qt3]
Opilki_Inside
27th March 2006, 12: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, 14: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, 14: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, 15:26
You could also use a QButtonGroup.. ;)
SkripT
27th March 2006, 15:26
In this case it's more "elegant" to use QButtonGroup assigning an identificator for each icon.
vBulletin® v3.7.1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.