OpenBoard-org / OpenBoard

OpenBoard is a cross-platform interactive whiteboard application intended for use in a classroom setting.
https://openboard.ch/
GNU General Public License v3.0
2.39k stars 428 forks source link

[Bug] Geometry issues with Qt6 #1080

Closed letsfindaway closed 1 month ago

letsfindaway commented 2 months ago

Describe the bug

When starting OpenBoard, the icons in the toolbar are too narrow spaced. The right sidebar (palette) does not have its previous size, but is smaller. When opening a document, it is not centered.

To Reproduce

  1. Build OpenBoard with Qt6. I'm using Qt 6.6.3 on openSUSE Leap 15.6.
  2. Start OpenBoard. The upper right corner looks as follows:

grafik

  1. The icons in the title bar are too narrow, the right palette has not the previous size.
  2. Resize the right palette, close and reopen OpenBoard. It is again smaller.
  3. Switch to Document mode and back to Board: the toolbar icons are correctly spaced.
  4. Open a document. The lower right corner of the page size indicator rectangle is in the center of the screen. I had this only with dev, not with master.
  5. Enable and disable multiscreen mode: the document is then correctly centered.

I also had a situation where control screen and display screen where shown on the same monitor, but cannot reproduce this.

Context

Additional context

My assumption is that some screen geometry information is not available at the right time.

Edit: The issue does not occur when I disconnect my second monitor.

letsfindaway commented 2 months ago

Some more investigations:

The issue occurs also with Qt 6.7.2 as we have on Tumbleweed.

The geometry is written to the log file. When I use a single monitor I get

control geometry QRect(1680,0 1920x1080)

This is correct, the right monitor is my primary monitor and is used as control screen. When I switch to multi monitor mode I get

control geometry QRect(1680,0 1920x1080)
display geometry QRect(0,0 1680x1050)

This is also correct, but in fact control and display screen are now shown on the left monitor and also with the size of that monitor! So it's not the geometry information which is wrong, but setGeometry() seems not to have the desired effect.

If I ask for the geometry immediately after setting it i get

Code:
        qDebug() << "control geometry" << geometry;
        controlWidget->setGeometry(geometry);
        qDebug() << "control geometry1" << controlWidget->geometry();

Log output:
control geometry QRect(1680,0 1920x1080)
control geometry1 QRect(0,0 400x163)
letsfindaway commented 2 months ago

And here my solution. UBDisplayManager:382:

        qDebug() << "control geometry" << geometry;
        controlWidget->setGeometry(geometry);
        // with Qt6, setGeometry has not the desired effect so we additionally use move and resize
        controlWidget->move(geometry.topLeft());
        controlWidget->resize(geometry.size());
        UBPlatformUtils::showFullScreen(controlWidget);

Adding the move() and resize() calls solves the problem for me. In fact, setGeometry() could then even be omitted.

Before creating a PR with this workaround I would like to get more feedback on this problem.

letsfindaway commented 1 month ago

@jbruechert: On my system this also happens with the current Flatpak, which uses Qt6 under the hood. Jonah, have you observed something like this?

@Vekhir: You also work a lot with Qt6: what are your observations? Did you have this issue?

Note: Two monitors must be connected in order to evoke this issue.

Vekhir commented 1 month ago

I usually work with a single monitor, though I sometimes test with virtual monitors created via

$ xrandr --addmode DisplayPort-0 1920x1080
$ xrandr --output DisplayPort-0 --mode 1920x1080 --right-of HDMI-A-0

and destroyed via xrandr --output DisplayPort-0 --off.

With this setup, your issue does not occur on my system with Qt 6.7.2. The text in the top right corner is fully visible for every icon. I'm running from the dev branch with my PRs applied, in case it matters. I also tested with the 1.7.1 release version on Arch, also no issue.

letsfindaway commented 1 month ago

Closed as #1095 was merged