I'm trying to modify code I found, but I'm blocked by my lack of understanding of the purpose, importance, and/or relevance of this virtual operator:
Constructor in .h: virtual void operator()(QGraphicsItem* item, const QRectF& rect) = 0;
Call in .cpp: (*resizer_)(parentItem(), rect_);
- Can someone provide insight as to why this operator is necessary or useful?
- Am I right in thinking it takes
parentItem()
,rect_
, andresizer_
as parameters, then modifies the value ofresizer_
?
Trimmed context for the constructor for reference:
class SizeGripItem : public QGraphicsItem
{
private:
class HandleItem : public QGraphicsRectItem
{
public:
HandleItem(int positionFlags, SizeGripItem* parent);
private:
SizeGripItem* parent_;
};
public:
class Resizer
{
public:
virtual void operator()(QGraphicsItem* item,
const QRectF& rect) = 0;
};
SizeGripItem(Resizer* resizer = 0, QGraphicsItem* parent = 0);
virtual ~SizeGripItem();
private:
void doResize();
QRectF rect_;
Resizer* resizer_;
};
Aucun commentaire:
Enregistrer un commentaire