Results 1 to 3 of 3

Thread: Question about how to do a mouse selection box

  1. #1
    Join Date
    Jun 2008
    Posts
    83
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Question about how to do a mouse selection box

    Hi:

    I'm working on a program that uses QGraphicsView and QGraphicsItem. One of the things I need to do is zoom in on a certain area of the drawing.

    My question is quite simple is there an option I can set that will make the mouse create the dotted box while dragging the mouse? I needed it for the user to select an area of the drawing. Or is my only option to write a custom code under the mouseDragEvent of my QGraphicsView?

    Thanks for any help.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Question about how to do a mouse selection box

    That selection rectangle is called a rubber band.
    setDragMode(QGraphicsView::RubberBandDrag);

  3. #3
    Join Date
    Jun 2008
    Posts
    83
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Question about how to do a mouse selection box

    Thank you very much!

Similar Threads

  1. Replies: 1
    Last Post: 30th October 2009, 08:52
  2. the question about define my own selection behavior
    By calmspeaker in forum Qt Programming
    Replies: 1
    Last Post: 20th June 2009, 11:40
  3. Question about mouse,keyboard event handler?
    By Sheng in forum Qt Programming
    Replies: 2
    Last Post: 24th February 2009, 07:50
  4. Dragging mouse selection in QTableWidget
    By yartov in forum Qt Programming
    Replies: 1
    Last Post: 12th April 2008, 15:03
  5. mouse moving don't produce mouse events
    By coralbird in forum Qt Programming
    Replies: 1
    Last Post: 13th September 2006, 06:13

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.