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. Selecting Multiple QGraphicsItems within a QGraphicsPolygonItem (setDragMaode(QGraphicView::RubberbandDrag))
Forum Updated to NodeBB v4.3 + New Features

Selecting Multiple QGraphicsItems within a QGraphicsPolygonItem (setDragMaode(QGraphicView::RubberbandDrag))

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.7k 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.
  • J Offline
    J Offline
    jh224
    wrote on last edited by
    #1

    I'm having trouble selecting multiple items with RubberBandDrag when inside a QGraphicsPolygonItem. The polygonItem is lower(zValue 0.1) than the target items(zValue 1.1).

    I can start the mouse drag outside the polygon and then drag it inside to select the items inside the polygonitem. However when I start the mouse drag inside the polygonitem, I can not select the items inside the polygonitem.

    Any Suggestions?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Asperamanca
      wrote on last edited by
      #2

      If the polygonItem itself is selectable, you cannot start a rubber band clicking on it. This would run counter to how single-click-selection works.

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jh224
        wrote on last edited by
        #3

        Thank you for you response. Do you know of a work around where I can rubber band select items inside the polygonitem?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Asperamanca
          wrote on last edited by
          #4

          The obvious solution would be to make the polygonitem non-selectable, but I guess that's not what you want.

          You could however try to reimplement sceneEvent and handle the case of a left-button click. If you ignore the event, and not forward it to your baseclass in certain cases, you should get the rubberband. Of course, the polygonitem would no longer be selected on leftclick, but you can yourself define when the item is selected, and when the rubberband is started.

          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