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. How to cause a modeless dialog to block input only to his direct parent (but not to any other windows), as if it was modal?
Forum Updated to NodeBB v4.3 + New Features

How to cause a modeless dialog to block input only to his direct parent (but not to any other windows), as if it was modal?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 659 Views 2 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
    Samuel Lourenco
    wrote on last edited by
    #1

    Hi,

    I'm developing a new version of an application, called CP2130 Commander, which is able to communicate with several CP2130-based devices. Currently, although it has the capability of communicating with several devices at the same time, the application is unable to do so because the progress dialogs are modal.

    Basically, what happens is that the main window gives the user the ability to open several devices at the same time, by opening one device window instance per device opened. Each device window is then able to control the respective device, and through such windows it is possible to perform SPI transfers. The progress dialog is shown when an ongoing SPI transfer takes more than 500ms. So far, so good.

    The problem is that the progress dialog blocks input to every other window. I can make it modeless, but then it won't block input to its parent window, which is the device window instance from where it was opened. The idea is for it to be modeless, while still blocking input only to its immediate parent window, as if it was modal. Is it possible? Can I install an event filter? Or is there any other, more correct way, to do this?

    By the way, if you wish to see some code, pertaining the ongoing development version: https://github.com/bloguetronica/cp2130-com/tree/v4.0.

    Kind regards, Samuel Lourenço

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

      You can enable/disable UI event handling using the "enabled" property (that works both for widgets and QML items).
      Whether it's a good UI design choice is another question.

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

        Thanks! However, wouldn't that gray out the parent window? It is kind of what I want, but the disabled aspect, even if only momentarily, may send the wrong message to the user.

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

          Hi and welcome to devnet,

          Is your dialog tied to the "device" widget or is it to the window containing your device widget ?

          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
            Samuel Lourenco
            wrote on last edited by Samuel Lourenco
            #5

            @SGaist said in How to cause a modeless dialog to block input only to his direct parent (but not to any other windows), as if it was modal?:

            Hi and welcome to devnet,

            Is your dialog tied to the "device" widget or is it to the window containing your device widget ?

            Hi and thanks! There is no device widget per se, but there is a device window. I would say that the progress dialog, currently modal but soon to be modeless (I hope) is tied to the device window. The device window is the parent of the progress dialog.

            1 Reply Last reply
            0
            • S Samuel Lourenco

              Thanks! However, wouldn't that gray out the parent window? It is kind of what I want, but the disabled aspect, even if only momentarily, may send the wrong message to the user.

              A Offline
              A Offline
              Asperamanca
              wrote on last edited by Asperamanca
              #6

              @Samuel-Lourenco said in How to cause a modeless dialog to block input only to his direct parent (but not to any other windows), as if it was modal?:

              Thanks! However, wouldn't that gray out the parent window? It is kind of what I want, but the disabled aspect, even if only momentarily, may send the wrong message to the user.

              I don't believe "enabled" has visual cues, but that might depend on the platform.
              However, if memory serves, the enabled property propagates to children. So if the progress dialog is a child of the device window, disabling the device window would also block input into the progress dialog itself (e.g. to a "cancel" button)

              EDIT: That said, the "enabled" flag (on the platform side) is what modal dialogs (at least on the Windows platform) actually use to disable UI input to all other windows.

              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