Hi all,
As the title says, I am trying to sub-class a standard Qt QAction class so that I can create an action trigger that sends a QString text message to the event handler. That way I can simply create one event handler for a context menu I need to present and have the event handler figure out which menu item was selected by examining the passed text string. I got the code from an article I read on the net and am including a copy of it.
Code:
class MyAction : public QAction
{
Q_OBJECT
public:
MyAction(QString someActionInfo)
: someActionInfo_(someActionInfo)
{
connect(this, SIGNAL(triggered()),
this, SLOT(onTriggered()));
}
signals:
void triggered(QString someActionInfo);
private slots:
void onTriggered() {
emit triggered(someActionInfo_);
}
private:
QString someActionInfo_;
};
I am also including a link to the article in case anyone else wants to take a look at it:
http://schneide.wordpress.com/tag/qt4/
The error I am receiving is "no matching function call to 'QAction::QAction()'. The error is being generated by the constructor line. I am not sure why the error is being generated, the code looks okay to me. Any help on figuring out what the error is referring to is greatly appreciated.