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. Why is QGraphicsScene::focusItem() looking at isActive() and not hasFocus() to return the passive item.
Qt 6.11 is out! See what's new in the release blog

Why is QGraphicsScene::focusItem() looking at isActive() and not hasFocus() to return the passive item.

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 1 Posters 802 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.
  • A Offline
    A Offline
    avautour
    wrote on last edited by
    #1

    I am trying to understand why QGraphicsItem::focusItem() is implemented by going to the focused item if it is active, and the passive focus item if it is not active. The passive focus item is set in situation like clearFocus(), which sets the hasFocus() flag, so why shouldn't focusItem() use that same flag instead of looking if the scene is active.

    I have a Windows application that has a QGraphicsView as its only main view. From what I can tell, the scene is only inactive when the application itself is not active. When clicking into another widget, the scene loses focus, and I have no way to get at the item that had focus, because QGraphicsScene::focusItem() returns NULL, yet the passive focus item is set to the item I would like to have. Should it return the passive focus item in that situation, where the scene is active, but it does not have focus?

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

      Since I didn't get any feedback, I opted to file a bug as I am fairly sure this behaviour is incorrect:
      https://bugreports.qt.io/browse/QTBUG-85728

      1 Reply Last reply
      1

      • Login

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