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. Modeless QDialog hideEvent doesnt get called when clicked outside
Qt 6.11 is out! See what's new in the release blog

Modeless QDialog hideEvent doesnt get called when clicked outside

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

    Hi,

    I have a modeless dialog and I want to so some stuff when user clicks outside the dialog and the dialog is hidden. I try to overwrite QDialog's hideEvent() but strangely it never gets called.

    Do I need to set some property over the dialog?

    Regards,
    Smita

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Something's not clear in your description e.g. how is your dialog hidden when the user clicks outside of it ?

      Also, what version of Qt and OS are you running ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        smita30apr
        wrote on last edited by
        #3

        To be clear, I set setWindowModality(Qt::NonModal) on my QDialog which makes the dialog to hide, as it doesnt block user input. Doc says: "The window is not modal and does not block input to other windows."

        By setting this on my dialog, if I just click somewhere outside, the dialog automatically hides. I am trying to do something on this hideEvent. May be I am wrong and some other event is happening rather than hide().

        I am using Qt 5 with Linux

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Can you show the code of your hideEvent ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • S Offline
            S Offline
            smita30apr
            wrote on last edited by
            #5

            Well not much I am doing the hideEvent. I am just printing something so that I know hideEvent is called.

            void Info_Dialog::hideEvent(QHideEvent * e) {
            qDebug()<<"hide event called";
            }

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              You can also try looking for QHideEvent in the event(QEvent * event) function

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              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