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. [Resolved] Close Widget Window if mouse clicked outside of it

[Resolved] Close Widget Window if mouse clicked outside of it

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

    This is sort of a chicken and egg problem. I'd like my widget window to be closed when the mouse clicks outside. As I understand it, there will be no mouse events for my widget for a click occurring outside of it. There is a SetFocus slot, but where is its counterpart or focus loss? "focusOutEvent" doesn't get called for my class.

    My widget window is a child window of a widget always shown on my main window and it's a "Qt::ToolTip", so I assume some problems could arise from that fact. Any way around that?

    My Goal: I have a custom toolbar widget where buttons on it may have "drop down" widgets. These drop down widgets have no standard windows frame. I don't want them to "steal" caption focus from the main window and I want them to disappear as soon as the user clicks ANYWHERE on the screen outside of their region. I have having serious difficulties finding a strategy that's not compromise on Qt to get this done.

    Am I missing something? (bet I am).

    1 Reply Last reply
    0
    • R Offline
      R Offline
      ronM71
      wrote on last edited by
      #2

      Okay, I am using

      @setWindowFlags(Qt::FramelessWindowHint | Qt::Popup);@

      Now my window receives the "focusOutEvent" event correctly and the focus isn't "stolen" from my main window thanks to the Qt::Popup.

      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