Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    Solved Prevent QMdiArea's current subwindow switching

    General and Desktop
    qmdiarea qmdisubwindow
    3
    6
    797
    Loading More Posts
    • 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.
    • diverger
      diverger last edited by diverger

      I have a QMdiArea with several subwindows, when the user wants to switch from one subwindow to another, I need to do some check, and may need to prevent the switching. I tried the below:

      • Capture "subWindowActivated" signal of QMdiArea, but the signal actually emited only after the switching

      • Capture the "aboutToActivate" signal of the subwindow, but in this signal I can't call "setActiveSubWindow" to force switching back to the previous window, or the application will crash.

      So, any good method to achieve my goal?

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        What kind of checks are they ?
        What about doing it the other way around: keep the other subwindows disabled until the checks pass ?

        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 Reply Quote 0
        • diverger
          diverger last edited by

          There are some input widgets on the subwindow, when user want to switch to other subwindow, I need to validate the user inputs, if there are some wrong data, I should force the user stay on current subwindow.

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            Then I stay by my suggestion: make your sub window "modal" so that your application users know that they have to first do things correctly before going further with their actions.

            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 Reply Quote 1
            • diverger
              diverger last edited by

              I finally use event filter to filter the "user click on tab" event to achieved my goal.

              L 1 Reply Last reply Reply Quote 0
              • L
                luzw @diverger last edited by

                @diverger I also have this problem, can you elaborate on how to solve it . thanks.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post