Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-75312

"window->hide()" and "window->show()" is not fully restoring window position

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 4.8.x, 5.6.2
    • None
    • Linux Mint Cinnamon (based on Ubuntu). Several different releases for at least two years.
    • Linux/X11

    Description

      Some software that uses Qt is not able to properly restore its window position after being minimized (and/or closed to the tray) and then called back. Some software works properly, but some doesn't. Sometimes the mistake seems to be of merely one pixel, while sometimes the jump is a way bigger.

      I first encountered this bug two years ago (May 2017) in Telegram Desktop app ( https://github.com/telegramdesktop/tdesktop ). I contacted the developer of said app and he was able to reproduce the bug and confirm that the problem is in Qt (" If I call window->hide() and in a second window->show() — it shows it moving a bit."). Two years have passed, my devious and cunning plan of waiting for someone else to report this bug without me doing anything is clearly not working, so here I am.

      Basically explained, when I open the Telegram and close it, the Telegram window is moving 1px to the left. The size of the window stays the same. Opening/closing the Telegram window multiple times causes the window to go to left as many times as this cycle was done.

      On my monitor I usually have a browser on 2/3 of the left and the 1/3 on the right is for media players, LibreOffice, Telegram. I align Telegram appropriately, but after several cycles the Telegram window is no longer aligned with the right border of my Desktop nor with the browser window.This is very irritating as I am closing/opening Telegram dozens/hundreds of times a day and I have to fix its position every time the gap starts to bug me (so very often).

      The problem is at the "closing to tray" stage because:

      1. Closing Telegram competely without first putting to tray, the position is remembered.
      2. If first closing Telegram to the tray and then closing completely, in this case Telegram window is moving one pixel to the left.

      It's easier to explain what it looks like by checking this video I recorded: https://www.youtube.com/watch?v=qxgr3EUdW88

      The algorithms seems to be:

      1. If the window is touching the top edge of the desktop/monitor, then closing/opening it causes it to move 1px to the left.
      2. If the window does not touch neither the top nor the bottom edge, then closing/opening it causes it to jump both the significant amount of pixels up and also one pixel to the left.
      3. If the window touches or is beyond the bottom edge (meaning that you take the full-vertical window and move the whole window so the top part is in the middle of the monitor while another half is below the window bar), then closing/opening it causes it to jump to the very top edge. As well as move it 1px to the left.

      In September 2017 I checked other programs I had and could confirm the same bug with the Clementine music player 1.2 ( http://www.clementine-player.org/ ; Qt version 4.8.6). Interestingly enough, the bug in the Clementine looked different from how the bug behaves with Telegram Desktop. In Clementine, "closing the program" -> "minimizes to tray" worked properly... except when using a Cinnamon's system-wide shortcut functionality. I have a combination "Super-c" (Left Windows key + C) assigned for the "Minimise window" functionality. And this caused this bug to appear. Pressing this combination minimizes Clementine to the windows bar (so not even to the tray), and when activated, Clementine has changed its location.

      Now in April 2019 I re-checked Clementine and the bug, at least in the way it showed itself 1.5 years ago, is gone. The current version tested is: Clementine (music player) 1.3.1 (Qt 4.8.7), so only a minor version changes. During this time I also updated my Linux Mint Cinnamon system to the newest version, as well as installed and removed a bunch of software. I am not sure how and why the bug is not there anymore in the Clementine.

      But it's still very much present in the Telegram Desktop. It is a very popular messenger and a piece of software and I hope that you can locate the bug and fix it.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              Unassigned Unassigned
              mixer Mikko Vedru
              Veli-Pekka Heinonen Veli-Pekka Heinonen
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes