qBittorrent icon indicating copy to clipboard operation
qBittorrent copied to clipboard

Window size not restoring properly after sleep

Open AGlezB opened this issue 9 months ago • 7 comments

qBittorrent & operating system versions

qBittorrent: v5.0.3 (64-bit) Operating system: Windows 10 Pro x64 (22H2) 19045.5371 Qt: 6.7.3 Libtorrent: 2.0.11.0 Boost: 1.86.0 OpenSSL: 3.4.0 zlib: 1.3.1

What is the problem?

After waking up from sleep, qBittorrent's window size is set to 1024x768 a moved to the top-left corner of the screen. The reason I'm reporting this as a bug is that all other applications maintain window size and possition as expected. Only qBittorrent has this issue.

Steps to reproduce

IMPORTANT: Do not try to replicate the issue by manually turning off the monitor. I tried and for some reason the issue only happens when the monitors enter sleep mode via Windows APM. It is possible the issue can be replicated by manually disconnecting the signal cable from the monitor.

  1. Copy qbittorrent.exe to a new folder
  2. Create a profile folder in the same location
  3. Run it
  4. Check the Behavior\Desktop\Minimize qbittorrent to notification area

Image

  1. Resize and move the window as shown here:

Image

The window size in the image is about 1720x1020 on a 1440p desktop. The important part is for the windows to be larger than 1024x768.

  1. Minimize the qbittorrent to the tray:

Image

  1. Lock the session and wait for the monitors to enter sleep mode.
  2. Press a key and wait for the monitor to wake up and Windows to show the login screen.
  3. Log back in.
  4. Restore qbittorrent from the tray. It will look like this:

Image

Check the size of the window, it should be 1024x768.

Additional context

My best guess about the cause is the monitors are detected as "disconnected" by Windows when they enter sleep mode. This causes the desktop to resize to the default size (1024x768). At that resolution qBittorrent's window is out of bounds so it reacts by repositioning and resizing, which souldn't happen because the window was minimized. Then the monitors come back online and Windows restores the desktop to 1440p and every other application remains in the size and position where I left them when I locked the session. All except qBittorrent, that is.

I don't know if this a Qt issue or a qBittorrent one but I can say for certain this didn't happen with qBittorrent v4.6.6 (qbittorrent_4.6.6_lt20_qt6_x64_setup.exe) which is the last v4 I used before upgrading to v5.

My PC is configured with the HP power plan and to never go to sleep, like this:

Image

Image

I have dual 1440p monitors connected via DisplayPort and the normal behavior when I lock the session is for the monitors to enter sleep mode a few seconds after locking. In my case the monitors first display a black screen and then a message indicating the DP signal was lost and a few seconds after that they enter sleep mode. That signal loss message is why I pointed out the issue might be replicating by disconnectin the DP cable. I don't know if this can be replicated with HDMI instead of DP but it is very like since the issue only requires Windows to "loose" the monitors for the desktop to revert to 1024x768.

In case it was a problem with the dual-monitor setup I tested this with one monitor disconnected and the issue still happens regrdless of the number of monitors.

Log(s) & preferences file(s)

qBittorrent doesn't log desktop size change events.

AGlezB avatar Feb 07 '25 16:02 AGlezB

having the same issue

High-rider avatar Feb 23 '25 05:02 High-rider

I have the same issue. Windows from other apps are fine, just qBittorrent is affected. NOTE: You only have to turn your display off then back on to make this happen. (At least in my case, with a 4K display and 150% scale set in the System Settings.)

I only noticed this begin to happen after upgrading to 24H2 of Windows 11 Pro. It didn't happen when I was still using 23H2.

ZebraFromPluto avatar Mar 04 '25 07:03 ZebraFromPluto

Found a ~solution~ workaround from this Gamer's Nexus video.

Some backgound first: When I first had this issue my displays were setup like this: Image with 1 being the main display.

After watching the video I decided to try swtiching the cables, since both my monitors are connected to DisplayPort. The new configuration looks like this: Image with 2 being the main display.

And that's it. I've been testing for a couple of days now and the issue is no longer present. That said, there is one more change I did which might have had some impact, which is rolling back NVidia drivers to 566.36, but that should have made no difference.

@High-rider and @ZebraFromPluto please give it a try and see if this works for you. I also suggest you give the video a watch in case some other workaround works best in your case.

AGlezB avatar Apr 09 '25 13:04 AGlezB

I use a laptop with no display attached to it and it still happens in single display.

High-rider avatar Apr 09 '25 14:04 High-rider

Is this a Qt related issue ?

luzpaz avatar Apr 10 '25 15:04 luzpaz

Is this a Qt related issue ?

I don't know. What is certain is that the issue affects qBittorrent where other applications behave normally.

AGlezB avatar Apr 10 '25 15:04 AGlezB

I recently upgraded my system (new MB+CPU+RAM) and now the issue is back regardless of how I've set up my monitors. It doesn't matter if I switch the cable like I did before. Nothing works.

AGlezB avatar May 29 '25 14:05 AGlezB

It has been a while after updating to Win 11 and things are not good. I have qBittorrent in my main monitor. If I exit and open qBittorrent again it opens in my secondary monitor instead of the primary.

It also has one more issue: after locking muy sesion and login back in, qBittorrent stays in my primary screen but opens confirmation dialogs in my secondary screen like so:

Image

In the image:

  • Blue: primary screen.
  • Red: secondary screen.
  • Yellow: main qBittorrent window.
  • Black: torrent delete confirmation dialog.

EDIT: IMO, confirmation dialogs should always be positioned centered over the main qBittorrent window, instead of having the position saved/restored.

AGlezB avatar Jul 05 '25 04:07 AGlezB

@AGlezB qBittorrent version/OS build/version/qBittorrent's preference file?

xavier2k6 avatar Jul 05 '25 09:07 xavier2k6

@AGlezB qBittorrent version/OS build/version/qBittorrent's preference file?

My apologies. I had qBittorrent 5.1.0 when I made the post. After updating to 5.1.2 both issues I mentioned in the post are no longer present. I'd love it if this was the end of qBittorrent's window positioning issues but I'll keep an eye out just in case. If it turns out all is well I'll close the issue.

OS: Windows 11 Pro 24H2 build 26100.4061 with Windows Feature Experience Pack 1000.26100.84.0

AGlezB avatar Jul 05 '25 17:07 AGlezB

The confirmation dialog opening in the wrong screen issue is still happening on 5.1.2. See my previous post for details.

qBittorrent v5.1.2 (64-bit) Qt: 6.9.1 Libtorrent: 2.0.11.0 Boost: 1.88.0 OpenSSL: 3.5.0 zlib: 1.3.1 OS: Windows 11 Pro 24H2 build 26100.4061 with Windows Feature Experience Pack 1000.26100.84.0

What's more, when the confirmation dialog shows in the wrong screen, if you close qBittorrent using CTRL+Q and then reopen it it opens in the wrong screen. This is a correction to my previous post: qBittorrent only opens in the wrong screen after the confirmation dialog issue happens.

Image

In the image:

  • Blue: primary screen.
  • Red: secondary screen.
  • Yellow: where the main qBittorrent window was before closing and where it should be after reopening.
  • Black: where the main qBittorrent actually is after reopening.

AGlezB avatar Jul 08 '25 15:07 AGlezB