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. Catching 'FocusOut' or 'MouseButtonPress' from a modal dialog
Qt 6.11 is out! See what's new in the release blog

Catching 'FocusOut' or 'MouseButtonPress' from a modal dialog

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 674 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.
  • C Offline
    C Offline
    comgate3
    wrote on last edited by
    #1

    Hi

    what I am trying to do is to close a modal dialog (a dialog opened by calling 'exec()') by click/touch outside of the dialog area. (it's like..'cancel' actions u can see in mobile applications. in order to 'cancel' or 'go back', u touch the shaded area.)

    say I have...a MainWindow instance and a button to popup a modal dialog.
    I place 'eventFilter' to 'mainwindow', 'modal dialog', and even 'QApplication' instance. but none actually catches FocusOut or MouseButtonPress event.

    QApplication eventFilter was able to catch FocusOut event when I click another application while the modal dialog is up, but that's not what I am trying to do. I need to catch FocusOut/MouseButtonPress when I click anywhere within my application, except the inside of the modal dialog.

    I thought catching events in QApplication instance might catch 'MouseButtonPress' event since it's the top level QObject, but it didn't. It seems the modal dialog is raised above the application instance when it is up, and all events are blocked to every other widgets and even qapplication instance except the modal dialog.

    Am I correct? and if anyone know a solution to my problem, please help me out. Please.

    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