all right, thank you a lot, I'll come back soon with the errors... 
but honestly thanks, I think now I get it. off to try.
Added after 6 minutes:
Bearhug for JohannesMunk! 
For some similarly beginner's interest the whole code together:
the derived class declaration:
{
private:
public:
myQGraphichsItem();
QRectF boundingRect
() const{ return bRect;
} void setBoundingRect
(int x1,
int y1,
int x2,
int y2
){bRect
= QRect(x1,y1,x2,y2
);
} };
class myQGraphichsItem : public QGraphicsItem
{
private:
QRect bRect;
public:
myQGraphichsItem();
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
QRectF boundingRect() const{ return bRect; }
void setBoundingRect(int x1,int y1,int x2,int y2){bRect = QRect(x1,y1,x2,y2);}
};
To copy to clipboard, switch view to plain text mode
the paint method reimplemented:
{
painter->drawRect(boundingRect());
}
void myQGraphichsItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
painter->drawRect(boundingRect());
}
To copy to clipboard, switch view to plain text mode
in useage:
myQGraphichsItem *mgi = new myQGraphichsItem;
mgi->setBoundingRect(30,60,90,100);
scene->addItem(mgi);
ui->graphicsView->setScene(scene);
QGraphicsScene *scene = new QGraphicsScene;
myQGraphichsItem *mgi = new myQGraphichsItem;
mgi->setBoundingRect(30,60,90,100);
scene->addItem(mgi);
ui->graphicsView->setScene(scene);
To copy to clipboard, switch view to plain text mode
Bookmarks