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. Modal Dialog does not blocking the user input.
QtWS25 Last Chance

Modal Dialog does not blocking the user input.

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 1.5k 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.
  • S Offline
    S Offline
    Sebastian
    wrote on last edited by aha_1980
    #1

    Dear Friends,
    I am having one issue regarding the modal dialog. basically it should stop user input. I set the window modality(setWindowModality(Qt::ApplicationModal);) it blocking the mouse click but unable to stop the tab key navigation and you can say keyboard input still i can give.I want to stop both mouse click plus keyborad input when dialog are pop up.Please suggest a solution if you have.

    TIA

    [Edit ~aha_1980: model -> modal]

    JonBJ 1 Reply Last reply
    1
    • S Sebastian

      Dear Friends,
      I am having one issue regarding the modal dialog. basically it should stop user input. I set the window modality(setWindowModality(Qt::ApplicationModal);) it blocking the mouse click but unable to stop the tab key navigation and you can say keyboard input still i can give.I want to stop both mouse click plus keyborad input when dialog are pop up.Please suggest a solution if you have.

      TIA

      [Edit ~aha_1980: model -> modal]

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Sebastian
      A modal dialog should be stopping any key presses getting through to the window/dialog behind it, as well as mouse clicks.

      1 Reply Last reply
      3
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi
        Can you show the code?
        It should block any interaction with the windows behind it.

        1 Reply Last reply
        2
        • S Offline
          S Offline
          Sebastian
          wrote on last edited by
          #4

          Actually the scenario is like i have a QWidget(parent) that holds another widget which have the layout in which we have 3 buttons Yes ,No and Cancel. Basicly my requirement is if I am navigating through the tab button then focus should go on Yes,No and Cancel buttons afterwards again in Yes button.I mean it should be cyclic.
          I tried so many things.

               raise();
               activateWindow();
               setFocusPolicy(Qt::StrongFocus);
               setWindowModality(Qt::ApplicationModal);
          

          I also tried in evenfilter and overrided the keyEvent->key() == Qt::Key_Tab from there i return the true.So from this i am able to solve my first problem which i posted first but now u want tab focus should be cyclic(Yes,No and Cancel buttons).

          Please advise something i am really stuck.

          mrjjM 1 Reply Last reply
          0
          • S Sebastian

            Actually the scenario is like i have a QWidget(parent) that holds another widget which have the layout in which we have 3 buttons Yes ,No and Cancel. Basicly my requirement is if I am navigating through the tab button then focus should go on Yes,No and Cancel buttons afterwards again in Yes button.I mean it should be cyclic.
            I tried so many things.

                 raise();
                 activateWindow();
                 setFocusPolicy(Qt::StrongFocus);
                 setWindowModality(Qt::ApplicationModal);
            

            I also tried in evenfilter and overrided the keyEvent->key() == Qt::Key_Tab from there i return the true.So from this i am able to solve my first problem which i posted first but now u want tab focus should be cyclic(Yes,No and Cancel buttons).

            Please advise something i am really stuck.

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Sebastian
            Hi
            TabOrder you can set in editor
            alt text

            so make sure the buttons are 1,2,3 and nothing else can take focus.

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

              Hi,

              Why not use a QDialog with QDialogButtonBox ?

              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
              1

              • Login

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