PDA

View Full Version : Resizing and transforming of QGraphicsItem's



NoRulez
16th February 2010, 22:24
Hey @all,

i've started to create a simple drawing editor for my own.
So, i have 2 questions about that:
1.) How can i draw "self resizing objects" (Rectangle, ellipse, ...).
With "self resizing objects" i mean, that i click with the mouse onto the graphicsscene and move the mouse while the left mouse key is pressed,
to draw e.g. rectangles in different sizes?
2.) Is there already a function or something similar to QGraphicsItem::ItemIsMoveable or QGraphicsItem::ItemIsSelectable which draws a border around the object with 8 small rectangles, so i can resize, transform or rotate the object?

I've already read the diagram scene example, but there aren't such functions used.

Thanks in advance

Best Regards
NoRulez

Lykurg
17th February 2010, 02:20
1.) How can i draw "self resizing objects" (Rectangle, ellipse, ...).
With "self resizing objects" i mean, that i click with the mouse onto the graphicsscene and move the mouse while the left mouse key is pressed,
to draw e.g. rectangles in different sizes?

Reimp mousepress, mousemove and mouserelease. On press you create a new item. on move you alter the rect and on release you "close" the item (=do nothing)


2.) Is there already a function or something similar to QGraphicsItem::ItemIsMoveable or QGraphicsItem::ItemIsSelectable which draws a border around the object with 8 small rectangles, so i can resize, transform or rotate the object?

No, but search the forum there were some threads about this one year ago, I think. And in the book from Johan you will find an example for that.

aamer4yu
17th February 2010, 06:14
Check this Fotowall (http://www.qt-apps.org/content/show.php/Fotowall?content=71316)application

NoRulez
19th February 2010, 18:59
I read the Book, but there isn't an example about this.

Best Regards
NoRulez

Lykurg
19th February 2010, 21:00
see page 220ff. "Interacting Using a Custom Item".