Results 1 to 10 of 10

Thread: Get QRect of a widget using mouseevent

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    Join Date
    Mar 2008
    Location
    France
    Posts
    149
    Thanks
    2
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Get QRect of a widget using mouseevent

    You got the idea,

    Call update() in void theGui::mouseMoveEvent(QMouseEvent *event), not in theGui::drawRect(QPoint _s, QPoint, _e) (rename it drawRectSelection(QPoint _s, QPoint, _e) to avoid confusion QPainter:rawRect(etc...)) .
    No need to calll drawRect(startPoint,event->pos()) in void theGui::mouseMoveEvent(QMouseEvent *event);
    Use your flag in theGui:aintEvent(QPaintEvent *event) and do the painting of the selection rectangle in this function only.


    Or you can use QRubberBand as suggested...

  2. The following user says thank you to toutarrive for this useful post:

    arpspatel (8th March 2010)

Similar Threads

  1. difference of QRect and QRectF
    By gbmtoday in forum Newbie
    Replies: 1
    Last Post: 14th January 2010, 22:52
  2. Pass mouseEvent to sibling widget?
    By nish in forum Qt Programming
    Replies: 5
    Last Post: 1st September 2009, 13:00
  3. Replies: 11
    Last Post: 17th January 2009, 09:06
  4. Move QCompleter on QRect x,y
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 8th August 2007, 10:33
  5. Replies: 1
    Last Post: 14th April 2007, 13:42

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
  •  
Qt is a trademark of The Qt Company.