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. Prevent QMdiArea's current subwindow switching
Forum Updated to NodeBB v4.3 + New Features

Prevent QMdiArea's current subwindow switching

Scheduled Pinned Locked Moved Solved General and Desktop
qmdiareaqmdisubwindow
6 Posts 3 Posters 1.5k 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.
  • divergerD Offline
    divergerD Offline
    diverger
    wrote on last edited by diverger
    #1

    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
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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
      0
      • divergerD Offline
        divergerD Offline
        diverger
        wrote on last edited by
        #3

        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
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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
          1
          • divergerD Offline
            divergerD Offline
            diverger
            wrote on last edited by
            #5

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

            L 1 Reply Last reply
            0
            • divergerD diverger

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

              L Offline
              L Offline
              luzw
              wrote on last edited by
              #6

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

              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