pietrom
18th February 2009, 17:49
I have a problem with context menus. I would like to create one in a dynamic way, i.e. passing a set of string variables:
void MyClass::contextMenu(std::vector<QAction*>& labelsAct)
{
for(size_t i = 0; i < labelsAct.size(); ++i)
{
QObject::connect(labelsAct[i], SIGNAL(mySignal(int)),
this, SLOT(doSomething(int)));
}
}
This is the message I get at runtime:
Object::connect: No such signal QAction::mySignal(int)
doSomething(int) is defined in the MyClass class.
mySignal(int) is declared in the MyClass class; why does it look for the signal in QAction?
If I remove the int parameters from those function (definitions), the connect works correctly. But I need those parameters.
Thank you...
void MyClass::contextMenu(std::vector<QAction*>& labelsAct)
{
for(size_t i = 0; i < labelsAct.size(); ++i)
{
QObject::connect(labelsAct[i], SIGNAL(mySignal(int)),
this, SLOT(doSomething(int)));
}
}
This is the message I get at runtime:
Object::connect: No such signal QAction::mySignal(int)
doSomething(int) is defined in the MyClass class.
mySignal(int) is declared in the MyClass class; why does it look for the signal in QAction?
If I remove the int parameters from those function (definitions), the connect works correctly. But I need those parameters.
Thank you...