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. Weird behavior of QT windows on Linux
Forum Updated to NodeBB v4.3 + New Features

Weird behavior of QT windows on Linux

Scheduled Pinned Locked Moved Solved General and Desktop
13 Posts 3 Posters 228 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.
  • deisikD deisik

    So how can I correct this behavior?

    Put simply, the first widget (a child of MainWindow) shouldn't be on top of other windows (other than the main window) and the main window shouldn't get minimized along with it. It's okay if the child is minimized with the parent, but not the other way around

    Pl45m4P Offline
    Pl45m4P Offline
    Pl45m4
    wrote last edited by
    #4

    @deisik

    Can you reproduce the weird/incorrect behavior also when not messing around with WindowStates and WindowFlags?!
    Maybe it's related to that


    If debugging is the process of removing software bugs, then programming must be the process of putting them in.

    ~E. W. Dijkstra

    deisikD 1 Reply Last reply
    0
    • deisikD deisik

      I have a main window (QMainWindow) which has a child widget (QDialog) and a window (another QDialog) on top of them (without a parent). When I hit the Minimize button on the first widget, the widget is minimized together with the main window (like it was modal). If I then close the second widget, the main window is restored

      This happens only when the second widget is visible and only on Linux. I tested it with two window managers (IceWM and openbox) -- the behavior is the same. On Windows only the widget is minimized (as should be)

      So the issue seems to be X related

      C Offline
      C Offline
      ChrisW67
      wrote last edited by
      #5

      @deisik said in Weird behavior of QT windows on Linux:

      So the issue seems to be X related

      Your somewhat unorthodox code works just fine here on Kubuntu 22.04, Qt 6.8, and

      vendor string:    The X.Org Foundation
      vendor release number:    12101011
      X.Org version: 21.1.11
      

      So this is either a windows manager difference or that you are not actually using X11 but Wayland.

      deisikD 1 Reply Last reply
      1
      • Pl45m4P Pl45m4

        @deisik

        Can you reproduce the weird/incorrect behavior also when not messing around with WindowStates and WindowFlags?!
        Maybe it's related to that

        deisikD Offline
        deisikD Offline
        deisik
        wrote last edited by deisik
        #6

        @Pl45m4

        I'm not sure what you mean by "messing around with WindowStates and WindowFlags"

        Anyway, it's not related to that

        Pl45m4P 1 Reply Last reply
        0
        • deisikD deisik

          @Pl45m4

          I'm not sure what you mean by "messing around with WindowStates and WindowFlags"

          Anyway, it's not related to that

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote last edited by
          #7

          @deisik said in Weird behavior of QT windows on Linux:

          I'm not sure what you mean by "messing around with WindowStates and WindowFlags"

          Setting states manually in combination with the show(), hide(), etc API function might break something on certain systems, but if it works the same... just an idea...

          As @ChrisW67 pointed out, are you sure that you don't use Wayland?!
          The behavior you describe would fit in there.


          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          deisikD 1 Reply Last reply
          0
          • C ChrisW67

            @deisik said in Weird behavior of QT windows on Linux:

            So the issue seems to be X related

            Your somewhat unorthodox code works just fine here on Kubuntu 22.04, Qt 6.8, and

            vendor string:    The X.Org Foundation
            vendor release number:    12101011
            X.Org version: 21.1.11
            

            So this is either a windows manager difference or that you are not actually using X11 but Wayland.

            deisikD Offline
            deisikD Offline
            deisik
            wrote last edited by deisik
            #8

            @ChrisW67

            No Wayland here

            X.Org X Server 1.21.1.16
            X Protocol Version 11, Revision 0
            
            1 Reply Last reply
            0
            • Pl45m4P Pl45m4

              @deisik said in Weird behavior of QT windows on Linux:

              I'm not sure what you mean by "messing around with WindowStates and WindowFlags"

              Setting states manually in combination with the show(), hide(), etc API function might break something on certain systems, but if it works the same... just an idea...

              As @ChrisW67 pointed out, are you sure that you don't use Wayland?!
              The behavior you describe would fit in there.

              deisikD Offline
              deisikD Offline
              deisik
              wrote last edited by deisik
              #9

              @Pl45m4

              They are for convenience only, and they are irrelevant

              But I found something else

              The main window goes down together with its child only if the second dialog has focus AND I click on the minimize button of the first dialog (a child of the main window)

              If I, on the hand, first click on the main window (so that it gets focus) and then minimize its child, only the child gets minimized

              It feels like the minimize event is being processed by the main window in the first case, and then both the parent and the child are minimized (which is a correct behavior)

              1 Reply Last reply
              0
              • deisikD Offline
                deisikD Offline
                deisik
                wrote last edited by deisik
                #10

                Regardless, the idea is to have a window which is always above the main window and at the same time always below all other windows (the emphasis on always here)

                Pl45m4P 1 Reply Last reply
                0
                • deisikD deisik

                  Regardless, the idea is to have a window which is always above the main window and at the same time always below all other windows (the emphasis on always here)

                  Pl45m4P Offline
                  Pl45m4P Offline
                  Pl45m4
                  wrote last edited by
                  #11

                  @deisik said in Weird behavior of QT windows on Linux:

                  the idea is to have a window which is always above the main window and at the same time always below all other windows other than the main window (the emphasis on always here)

                  Why not create some sort of overlay directly for your QMainWindow?


                  If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                  ~E. W. Dijkstra

                  deisikD 1 Reply Last reply
                  0
                  • Pl45m4P Pl45m4

                    @deisik said in Weird behavior of QT windows on Linux:

                    the idea is to have a window which is always above the main window and at the same time always below all other windows other than the main window (the emphasis on always here)

                    Why not create some sort of overlay directly for your QMainWindow?

                    deisikD Offline
                    deisikD Offline
                    deisik
                    wrote last edited by
                    #12

                    @Pl45m4

                    How's that?

                    1 Reply Last reply
                    0
                    • deisikD Offline
                      deisikD Offline
                      deisik
                      wrote last edited by deisik
                      #13

                      The solution was to make the main window stay on bottom with the Qt::WindowStaysOnBottomHint flag set (yes, I can live with that)

                      But if you have other ideas, please share

                      1 Reply Last reply
                      0
                      • deisikD deisik has marked this topic as solved

                      • Login

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