PDA

View Full Version : Display rectangle on Image



parmar ranjit
21st February 2008, 11:14
Hi,
I am using Linux, Qt4.3
Dear freinds,

I am to draw editable rectangle at given coordinates of image.
or say
How to superimpose editable rectangle at given coordinates of image

Presently I am able to draw the rubbeband rectangle with mouse event directly on image which is on QLABEL. But editing rectangle is my next phase. I am finding problem in first phase with second phase ready....!

Problem: How to draw rectangle at specified coordinate of image?

Early answer awaited....
Advance thanx

jacek
21st February 2008, 20:24
Have you seen QRubberBand?

parmar ranjit
22nd February 2008, 05:31
yes jacek,
I had seen QRubberband and have been able to draw the rubber band rectangles directly on image .

But my question is : Initially I want to draw certain rectangles on image( I mean on QLabel) having their coordinates specified in our program code itself. And then I should be able to rubber band it or modify it by mouse .

So editing is next phase, firstly I want to draw rectangles on image via coordinats in program code in an array .
I hope I have been able to make you understand the problem

And Ya ofcourse thanx a lot for help..

Ranjit
INDIA

Gopala Krishna
22nd February 2008, 13:09
I don't know whether i understood your problem correctly or not.
I think you can accomplish your task by inheriting QLabel and reimplement paintEvent something like


class Label : QLabel
{
public:
...
void paintEvent(QPaintEvent *event)
{
QLabel::paintEvent(event);
QPainter painter(this);
//setup painter
painter->drawRect(..);
}
};