Hello everyone.
I try to create a custom QGraphicsitem.
This is the code of QGraphicsItemDot.h:
Code:
#ifndef QGRAPHICSITEMDOT_H #define QGRAPHICSITEMDOT_H #include <QWidget> #include <QGraphicsItem> #include <Qpainter> #include <QRectF> #include <QLine> #include <QLineF> #include <QPoint> #include <QPointF> #include <globalTypes.h> public: //QGraphicsItemDot(QPointF &dot, QGraphicsItem* parent = 0); QPointF dot; }; #endif
This is the code of QGraphicsItemDot.cpp:
Code:
#include "QGraphicsItemDot.h" //QGraphicsItemDot::QGraphicsItemDot(QPointF &dot, QGraphicsItem* parent) : QGraphicsItem(parent) { //setDot(dot); //} prepareGeometryChange(); dot = argdot; update(); } } void QGraphicsItemDot::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { painter->drawPoint(dot); }
Booth of this files compile ok.
I try to create and return a object like this:
Code:
QGraphicsItemDot qDrawData::createItemDot(tpStockDataRow coord) { //Calculations... QGraphicsItemDot tmpdot; return tmpdot; }
But this throws that error:
Code:
Error 1 error C2248: 'QGraphicsItem::QGraphicsItem' : cannot access private member declared in class 'QGraphicsItem' QGraphicsItemDot.h 20
Can someone help me with this problem?
Thank you, Louis.