I'm trying to establish an array of QGraphicsPixmapItems.
// Pre-Try as a general check:
pixmapItemA.setPixmap( pixmapA );
// This works
// Pre-Try as a general check:
QPixmap pixmapA = QPixmap( ":/images/imageA.png" );
QGraphicsPixmapItem pixmapItemA;
pixmapItemA.setPixmap( pixmapA );
// This works
To copy to clipboard, switch view to plain text mode
But then:
// First Try
itemVector[23].setPixmap( pixmapA );
// Fails: In QGraphicsPixmapItem, 'DISABLE COPY' is private
// First Try
QVector< QGraphicsPixmapItem > itemVector( 100 );
itemVector[23].setPixmap( pixmapA );
// Fails: In QGraphicsPixmapItem, 'DISABLE COPY' is private
To copy to clipboard, switch view to plain text mode
And:
// Second Try:
pixmapItemA.setPixmap( pixmapA );
itemVector[23] = pixmapItemA;
// Fails: In QGraphicsPixmapItem, 'operator=' is private
// Second Try:
QVector< QGraphicsPixmapItem > itemVector( 100 );
QGraphicsPixmapItem pixmapItemA;
pixmapItemA.setPixmap( pixmapA );
itemVector[23] = pixmapItemA;
// Fails: In QGraphicsPixmapItem, 'operator=' is private
To copy to clipboard, switch view to plain text mode
And, finally:
// Third Try:
pixmapItemA.setPixmap( pixmapA );
itemVector[23] = pixmapItemA;
// Fails - invalid abstract return type 'QGraphicsItem'
// Third Try:
QVector< QGraphicsItem > itemVector( 100 );
QGraphicsPixmapItem pixmapItemA;
pixmapItemA.setPixmap( pixmapA );
itemVector[23] = pixmapItemA;
// Fails - invalid abstract return type 'QGraphicsItem'
To copy to clipboard, switch view to plain text mode
Is there something I'm missing?
Or, am I going to have to subclass QGraphicsPixmapItem in order to get this to work?
If the latter, could somebody please point me to a reasonably straightforward link on subclassing? I've never tried anything like that and have numerous trepidations.
BTW, I do note in qglobal.h :
/*
Some classes do not permit copies to be made of an object. These
classes contains a private copy constructor and assignment
operator to disable copying (the compiler gives an error message).
*/
#define Q_DISABLE_COPY(Class) \
Class(const Class &) Q_DECL_EQ_DELETE;\
Class &operator=(const Class &) Q_DECL_EQ_DELETE;
/*
Some classes do not permit copies to be made of an object. These
classes contains a private copy constructor and assignment
operator to disable copying (the compiler gives an error message).
*/
#define Q_DISABLE_COPY(Class) \
Class(const Class &) Q_DECL_EQ_DELETE;\
Class &operator=(const Class &) Q_DECL_EQ_DELETE;
To copy to clipboard, switch view to plain text mode
Why would copies not be permitted? If there's a valid reason, subclassing to get past it might break something, in which case Qt would seem not to be what I need to use ???
Bookmarks