Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. A working example of a selection rectangle with grab handles, in a QGraphicsScene
Forum Updated to NodeBB v4.3 + New Features

A working example of a selection rectangle with grab handles, in a QGraphicsScene

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 3.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Phlip
    wrote on last edited by
    #1

    I can muddle through this myself, so the best answer would be working code I can crib from. I need to avoid the tedium of discovering what details work and which ones don’t.

    Many art programs, such as Gimp, allow you to draw a temporary rectangle, then fine-tune it with grab handles. A grab handle on each side lets you pull the side; a grab handle in each corner lets you pull two sides, etc.

    Does anyone have an example of a working application, in any language, with the rest of this system? Beyond the “scene.addRect(x, y, w, h, _pens[color])” part?

    1 Reply Last reply
    0
    • I Offline
      I Offline
      issam
      wrote on last edited by
      #2

      more explanation needed. :)

      http://www.iissam.com/

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Phlip
        wrote on last edited by
        #3

        Open up MSPaint.exe (or the equivalent art program on your platform) click on the Select tool, and drag a rectangle on your image.

        The rectangle has little "grab handles" in each corner, and in the middle of each line. Hovering over a grab handle turns your mouse pointer into an appropriate icon, and dragging that drag handle adjusts its lines.

        I know how to research and implement each detail of such a feature - marking a rectangle with drag handles, changing the mouse pointer, capturing the mouse, etc.

        I'm asking if anyone has already implemented "drag handles on floating rectangle, to select something in an image", and if there's already source code out there (in any language) that I can crib from.

        1 Reply Last reply
        0
        • I Offline
          I Offline
          issam
          wrote on last edited by
          #4

          I understand now :)
          You want to select a set of items in a GraphicsView by pressing and moving the mouse, simultaneously.
          I think the solution is like when you draw a line by pressing/moving the mouse. You can see the diagramscene example, to get an idea.

          In the other hand I know a libre soft that uses this trick.
          You can get its source here [Umbrello UML Modeller]http://uml.sourceforge.net/

          Good luck !

          http://www.iissam.com/

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved