And I dind't understand the use of QPushButton in your requirement.
But you can invoke this signal - void currentIndexChanged(const QString & text)
I think this helps
connect(comboBox,
SIGNAL(currentIndexChanged
(QString)),
this,
SLOT(onComboIndexChanged
(QString)));
// Write your slot something like this
void CYourClass
::onComboIndexChanged(QString str
) {
if(str == "cat")
{
cat();
}
else if(str == "dog")
{
dog();
}
}
connect(comboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(onComboIndexChanged(QString)));
// Write your slot something like this
void CYourClass::onComboIndexChanged(QString str)
{
if(str == "cat")
{
cat();
}
else if(str == "dog")
{
dog();
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks