Hi there,
I've got a Problem. Sorry for my bad english, that the reason why I want to show you my code. This tells more than my 1000 words...
1st my Class,
using namespace MyNamespace;
{
Q_OBJECT
public:
~SingleScanTreeWidgetItem();
void makeActions
(QMenu* menu
);
public slots:
void onAction();
};
using namespace MyNamespace;
class MyTreeWidgetItem : public QTreeWidgetItem
{
Q_OBJECT
public:
SingleScanTreeWidgetItem(QTreeWidget *parent);
~SingleScanTreeWidgetItem();
void makeActions(QMenu* menu);
public slots:
void onAction();
};
To copy to clipboard, switch view to plain text mode
Okay, and here is my implementation:
MyTreeWidgetItem
::MyTreeWidgetItem(QTreeWidget *parent
){
setText(0,"The Text");
}
MyTreeWidgetItem::~MyTreeWidgetItem()
{
}
void MyTreeWidgetItem
::makeActions(QMenu* menu
) {
menu->addAction(action);
QObject::connect(action,
SIGNAL(triggered
()),
this,
SLOT(onAction
()));
}
void MyTreeWidgetItem::onAction()
{
int test(0);
}
MyTreeWidgetItem::MyTreeWidgetItem(QTreeWidget *parent)
: QTreeWidgetItem(parent)
{
setText(0,"The Text");
}
MyTreeWidgetItem::~MyTreeWidgetItem()
{
}
void MyTreeWidgetItem::makeActions(QMenu* menu)
{
QAction* action = new QAction(QString("Test"),menu);
menu->addAction(action);
QObject::connect(action,SIGNAL(triggered()),this,SLOT(onAction()));
}
void MyTreeWidgetItem::onAction()
{
int test(0);
}
To copy to clipboard, switch view to plain text mode
So, thats all. But my compiler gives my an error:
CompileError C2665:
'function' : none of the number1 overloads can convert parameter number2 from type 'type'
So whats my mistake? How can I solve this problem?
Did anybody knows that?
Ciao + Thanks
Bookmarks