Results 1 to 4 of 4

Thread: Display rectangle on Image

  1. #1
    Join Date
    Feb 2008
    Location
    Porbandar
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Display rectangle on Image

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Display rectangle on Image

    Have you seen QRubberBand?

  3. #3
    Join Date
    Feb 2008
    Location
    Porbandar
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Talking Re: Display rectangle on Image

    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

  4. #4
    Join Date
    Aug 2006
    Location
    Bangalore,India
    Posts
    419
    Thanks
    37
    Thanked 53 Times in 40 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Display rectangle on Image

    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

    Qt Code:
    1. class Label : QLabel
    2. {
    3. public:
    4. ...
    5. void paintEvent(QPaintEvent *event)
    6. {
    7. QLabel::paintEvent(event);
    8. QPainter painter(this);
    9. //setup painter
    10. painter->drawRect(..);
    11. }
    12. };
    To copy to clipboard, switch view to plain text mode 
    The biggest difference between time and space is that you can't reuse time.
    -- Merrick Furst

Similar Threads

  1. Display only PNG image on desktop
    By durbrak in forum Qt Programming
    Replies: 32
    Last Post: 15th March 2008, 21:55
  2. Finding marks on scanned image for alignment
    By caduel in forum Qt Programming
    Replies: 1
    Last Post: 23rd September 2007, 02:10
  3. Display and divide the image
    By kiransu123 in forum Qt Programming
    Replies: 19
    Last Post: 5th March 2007, 20:40
  4. Simple display of an image
    By bruccutler in forum Newbie
    Replies: 1
    Last Post: 15th January 2007, 23:49
  5. How and when to repaint a widget ?
    By yellowmat in forum Newbie
    Replies: 7
    Last Post: 3rd April 2006, 16:36

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.