I have a custom QGraphicsItem, that (among other things) changed the cursor to an open hand when clicked, using the standard procedure as described in the Qt documentation. This worked fine for the past two weeks or so.
Yesterday, I changed a few things inside the class. Most significantly, I now subclass directly from QGraphicsPixmapItem instead of QGraphicsItem.
At some point I started to get the following error (partly my own translation):
C664: Conversion of parameter 1 from 'Qt::CursorShape' to 'const
QCursor &' not possible. Source or target has incomplete type.
I now try to figure out why my item has an incomplete type. Unfortunately I can't retrace when exactly this problem started to occur. The changed base class was my only guess, but I could not really think of a way how this could be the cause. After googling the error, I found examples, where members of the class were somewhat ill-defined, but I could not find an error in my declarations. So, here is the Header, in case I missed something:
#include <QGraphicsPixmapItem>
class Collection;
class ItemSource;
class PhotoItem : public QGraphicsPixmapItem
{
public:
PhotoItem( QString sourceFilePath, Collection *collection =0, QColor color =Qt::white, qreal size = 80.0);
enum Orientation { portrait, landscape };
QPixmap content();
bool hasContent();
QColor color();
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
QRectF boundingRect() const;
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
private:
qreal _size;
Orientation _orientation;
QPixmap _content;
QColor _color;
Collection *_collection;
ItemSource *_source;
};
If this file is correct, then are there any common problems that lead to undefined types that I can check out? Maybe I am even searching at the wrong place?
Thanks for your time,
Louise
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…