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.
Forum Updated to NodeBB v4.3 + New Features

Modal Dialog does not blocking the user input.

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 1.5k Views 3 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
    Sebastian
    wrote on 29 Aug 2018, 06:23 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]

    J 1 Reply Last reply 29 Aug 2018, 07:37
    1
    • S Sebastian
      29 Aug 2018, 06:23

      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]

      J Offline
      J Offline
      JonB
      wrote on 29 Aug 2018, 07:37 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
      • M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 29 Aug 2018, 07:41 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 3 Sept 2018, 12:18 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.

          M 1 Reply Last reply 3 Sept 2018, 15:01
          0
          • S Sebastian
            3 Sept 2018, 12:18

            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.

            M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 3 Sept 2018, 15:01 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
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 3 Sept 2018, 20:02 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

              6/6

              3 Sept 2018, 20:02

              • Login

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