View Full Version : How to Draw and resize Rectangle
ranjithreddykommareddy
16th December 2015, 06:36
hii...,
i new to qt .i want to draw and resize rectangle using mouse events on Qimage which is in label
anda_skoa
16th December 2015, 10:16
You could use QRubberBand.
Or derive a class from QLabel, implement mouse event handlers to get the values for the rect.
Reimplement paintEvent() such that you first call the implementation of the base class and then paint your rect on top of it.
Cheers,
_
ranjithreddykommareddy
21st December 2015, 08:17
thanks for reply earlier i used QRubberBand but it is not compatible to my application and using mouse events i draw rectangle with QPainter. but my problem is resizeing that rectangle
anda_skoa
21st December 2015, 09:49
using mouse events i draw rectangle with QPainter. but my problem is resizeing that rectangle
The QRect API is usually pretty straight forward.
How do you attempt to resize the rectangle?
Cheers,
_
ranjithreddykommareddy
22nd December 2015, 07:25
then how can i do that resizing part..?i want to bound the objects in image so i need resizing .
anda_skoa
22nd December 2015, 11:22
I assume you have a member variable of type QRect.
So resizing the rect means changing that member's values and then calling update().
Cheers,
_
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.