I write the code for resizing a QRectItem and it works very well.
For example, to resize my custom QrectItem from the top-right corner, i calculate the new rect in this manner:
QRectF new_rect
(QPointF(rect
().
bottomLeft().
x(),event
->pos
().
y()),
QPointF(event
->pos
().
x(),boundingRect
().
bottomLeft().
y()));
QRectF new_rect(QPointF(rect().bottomLeft().x(),event->pos().y()),
QPointF(event->pos().x(),boundingRect().bottomLeft().y()));
To copy to clipboard, switch view to plain text mode
When I use the "same" approach for resizing my custom QPixmapItem, it give me problem and resize doesn't work!!
QRect new_rect
(QPoint(pixmap
().
rect().
bottomLeft().
x(),
event->pos().toPoint().y()),
QPoint(event
->pos
().
toPoint().
x(),
pixmap().rect().bottomLeft().y()));
QRect new_rect(QPoint(pixmap().rect().bottomLeft().x(),
event->pos().toPoint().y()),
QPoint(event->pos().toPoint().x(),
pixmap().rect().bottomLeft().y()));
To copy to clipboard, switch view to plain text mode
What's wrong???
Bookmarks