Custom QGraphicsItems not compiling and give object is is private error
- by bahree
Hi,
I am trying to create a Custom QGraphicsItem button as shown by Fred here. The code which he posted can be found here.
The problem is when I try and compile the code I get the following two errors:
/usr/include/qt4/QtGui/qgraphicsitem.h
‘QGraphicsItem::QGraphicsItem(const
QGraphicsItem&)’ is private
/usr/include/qt4/QtCore/qobject.h
‘QObject::QObject(const QObject&)’ is
private
Here is the code snippet which essentially is the same as that in the sample above. The error is on the class deceleration.
class MyButton : public QObject, public QGraphicsItem
{
Q_OBJECT
Q_INTERFACES(QGraphicsItem)
public:
MyButton(QGraphicsItem *parent = 0);
MyButton(const QString normal, const QString pressed = "", QGraphicsItem *parent = 0);
....
}
Interestingly the other sample as shown here works fine. The sample code for that can be found here.
Any idea what is wrong? Thanks in advance.