Results 1 to 5 of 5

Thread: select a particular area

  1. #1
    Join Date
    Jan 2007
    Location
    Chennai, India
    Posts
    25
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default select a particular area

    how to select a particular area in qwidget using mouseevents

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: select a particular area

    Here's a one approach:

    press event:
    - store the event position

    move event:
    - draw a rectangle from press point to move event position

    release event:
    - apply the selection
    - invalidate press point
    J-P Nurmi

  3. #3
    Join Date
    Jan 2007
    Location
    Chennai, India
    Posts
    25
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Question Re: select a particular area

    How to draw a rectangle in application

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: select a particular area

    Use QPainter. Here's an example from the docs:
    Qt Code:
    1. void SimpleExampleWidget::paintEvent()
    2. {
    3. QPainter paint( this );
    4. paint.setPen( Qt::blue );
    5. paint.drawText( rect(), AlignCenter, "The Text" );
    6. }
    To copy to clipboard, switch view to plain text mode 
    Replace QPainter::drawText() with QPainter::drawRect()..
    J-P Nurmi

  5. #5
    Join Date
    Jan 2007
    Location
    Chennai, India
    Posts
    25
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: select a particular area

    thank you its working properly

Similar Threads

  1. displaying png image for a given area..
    By sar_van81 in forum Qt Programming
    Replies: 1
    Last Post: 17th January 2007, 13:56
  2. abstract scroll area
    By moowy in forum Qt Programming
    Replies: 2
    Last Post: 2nd October 2006, 09:15
  3. Sql Server cannot retrieve data from select
    By Atomino in forum Qt Programming
    Replies: 10
    Last Post: 7th September 2006, 16:37
  4. Initialise toolbar in a different area
    By georgie in forum Qt Programming
    Replies: 4
    Last Post: 4th May 2006, 03:49
  5. QRubberBand painting in the scroll area widget
    By SkripT in forum Qt Programming
    Replies: 7
    Last Post: 17th January 2006, 16:48

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.