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. QGraphicsView: Don't show selection rectangle

QGraphicsView: Don't show selection rectangle

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 299 Views
  • 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.
  • G Offline
    G Offline
    Gino
    wrote on last edited by
    #1

    Hi,

    When I select an item in a QGraphicsView, a selection rectangle is automatically shown.
    How can I disable the drawing of such a selection rectangle?

    Best regards,
    Gino

    1 Reply Last reply
    0
    • G Offline
      G Offline
      Gino
      wrote on last edited by
      #2

      Found solution myself but thought I share for others:

      My Item was already a sublass of QGraphicsLineItem so in paint() I could simply clear the selected state flag and pass it to paint.
      QStyleOptionGraphicsItem saved_option = *option; // need a copy as option is const
      saved_option.state &= ~QStyle::State_Selected;
      QGraphicsLineItem::paint(painter, &saved_option, widget);

      This works

      1 Reply Last reply
      0
      • mzimmersM Offline
        mzimmersM Offline
        mzimmers
        wrote on last edited by
        #3
        This post is deleted!
        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