First of all, I don't think you need to pass the signal. Probably you will always use triggered.
But anyway, you can do this:
QAction* MyClass
::createAction( const QString
& text,
const QString &shortcut,
const char * signal,
const char* slot,
const QString statusTip
) {
Q_CHECK_PTR(pAction);
pAction->setShortcut(tr( shortcut ));
pAction->setStatusTip(tr( statusTip ));
connect(pAction, signal , this, slot );
return pAction;
}
QAction* MyClass::createAction( const QString& text, const QString &shortcut, const char * signal, const char* slot, const QString statusTip )
{
QAction* pAction=new QAction(tr( text ), this);
Q_CHECK_PTR(pAction);
pAction->setShortcut(tr( shortcut ));
pAction->setStatusTip(tr( statusTip ));
connect(pAction, signal , this, slot );
return pAction;
}
To copy to clipboard, switch view to plain text mode
When you call createAction, for signal you pass something like:
SIGNAL( triggered() );
and for slot:
SLOT( dataSourceSelection() ).
createAction( "Data source", "CTRL+D", SIGNAL( triggered() ), SLOT( dataSourceSelection() ), "status tip..." );
createAction( "Data source", "CTRL+D", SIGNAL( triggered() ), SLOT( dataSourceSelection() ), "status tip..." );
To copy to clipboard, switch view to plain text mode
It will work.
By the way, I think you should have posted at least in the Newbie section.
Regards
Bookmarks