The code is as below,
{
Q_OBJECT
public:
...
MyElement* pE;
signals:
void itemSelected(MyElement* pE);
};
{
Q_OBJECT
public slots:
void toTreeWidget(MyElement* pE);
};
class MyRectItem : public QObject, public QGraphicsRectItem
{
Q_OBJECT
public:
...
MyElement* pE;
signals:
void itemSelected(MyElement* pE);
};
class MyView : public QMainWindow
{
Q_OBJECT
public slots:
void toTreeWidget(MyElement* pE);
};
To copy to clipboard, switch view to plain text mode
In myview.cpp,
MyRectItem *i = new MyRectItem(x, y, w, h);
QObject::connect(i,
SIGNAL(itemSelected
(pE
)),
this,
SLOT(toTreeWidget
(i
->pE
)));
MyRectItem *i = new MyRectItem(x, y, w, h);
QObject::connect(i, SIGNAL(itemSelected(pE)), this, SLOT(toTreeWidget(i->pE)));
To copy to clipboard, switch view to plain text mode
Why this doesn't work ??
Does this have something to do with using the object-pointer as argument of signal?
Bookmarks