DavidoTek / ProtonUp-Qt

Install and manage GE-Proton, Luxtorpeda & more for Steam and Wine-GE & more for Lutris with this graphical user interface.
https://davidotek.github.io/protonup-qt
GNU General Public License v3.0
1.16k stars 39 forks source link

Buttons don't fit on window #360

Closed ozon85 closed 1 month ago

ozon85 commented 4 months ago

Hello. I have a problem: It is not possible to resize the window, and the buttons do not fit in the "Custom install Directory" window. And "Install Compatibillity Tool" too. I have an enlarged font. buttons

Solution I'd like Make the window resizable or automatically adjusted to the required size

sonic2kk commented 4 months ago

I believe the core of this problem is ProtonUp-Qt's fixed window sizes, which came up at least once before (https://github.com/DavidoTek/ProtonUp-Qt/discussions/309#discussioncomment-7606883).

I don't think simply making dialogs resizeable is the fix here, because right now widgets are not always positioned relative. For example making this dialog resizeable would have this problem (screenshot taken running from main @ 21e2b3fdde73298ca14bf89c42c08cd95d8a2cc1 with the maximumSize property reset the default from Qt Designer, 16777215x16777215):

image

We also can't fix this by just making the window size bigger, as someone with an even bigger font size could come along and report the same problem. It would simply mask the issue.

On a related note, sometimes windows have the opposite problem, but it is once again related to font sizes. For example, on my system with the ProtonUp-Qt Flatpak, some dialogs are slightly too big and buttons don't align properly to the bottom.

image

So I think the overall fix is to move away from fixed with/height window sizes, which means we'd have to position things like buttons more "relatively" to the bottom of the window (which would fix the resizing issue in the first screenshot), and also ensure that windows are the correct size to display the widgets they're meant to.


In terms of how to actually solve this, though, I don't have any real ideas :sweat_smile: This is just some additional context to the problem. Setting QT_SCALE_FACTOR to a value < 1 may work but I doubt it, as it will probably take the same window sizing and just shrink it down, making the same problem but with a smaller window.

sonic2kk commented 4 months ago

I figured out from this StackOverflow answer that, from Qt Designer, we can set the top-level layout for a dialog to have a layoutSizeConstraint of SetFixedSize. This means the layout will decide the size of the window, and the minimum/maximum size for the dialog is mostly ignored. I say mostly, because if the minimum and maximum size are still the same, Qt will still infer that the window should not be resizeable, but we can probably set this flag from code if we really want to remove the minimum/maximum size from the .ui file.

I tested this out on the Custom Install Directory dialog and it "works", in that, I set the dialog height to 1,000, and the height was correctly clamped to the minimum required size for the dialog. I didn't touch the width, however, as you can see, it's a little... off...

image

(It's resizeable because I have the height set to 1,000)

The width of the elements seems to shrink. This isn't a case of the dialog getting wider, if you compare with the earlier screenshots, you can see the width of the elements has shrunk.

I tried fiddling with the size policies of the form layout and nested horizontal layout in the dialog, as well as the widgets themselves, but didn't get anywhere.

Still, maybe this is a step in the right direction? Hopefully it's at least a bit of a hint :-)

DavidoTek commented 3 months ago

I believe the core of this problem is ProtonUp-Qt's fixed window sizes, which came up at least once before (#309 (reply in thread)).

Yes

So I think the overall fix is to move away from fixed with/height window sizes, which means we'd have to position things like buttons more "relatively" to the bottom of the window

Ideally, if all layouts were perfect, all windows can be resized to any size and it would still look good. We need to fix the layouts for this and disable the fixed size.

I figured out from this StackOverflow answer that, from Qt Designer, we can set the top-level layout for a dialog to have a layoutSizeConstraint of SetFixedSize. This means the layout will decide the size of the window, and the minimum/maximum size for the dialog is mostly ignored Still, maybe this is a step in the right direction? Hopefully it's at least a bit of a hint :-)

That seems to be the way to go. I guess we can still set a minimum size if it gets too small.

sonic2kk commented 1 month ago

If ProtonUp-Qt is using the KDE Breeze theme (currently only happens if using a systemwide PySide6, which the AUR packages may use), the KDE Breeze theme has a similar problem to this issue. In my case, it isn't as extreme as OP.

image

There is also an issue in the Games List dialog, where the window is a bit too small for the games list table, meaning it will show a scrollbar.

image

As an aside, some other parts of the UI look a bit off with this Breeze theme, such as on the CtInfo dialog, the table widget in the stacked layout is missing a border that other table widgets have:

image


If there was a good way to set a minimum window size for dialogs that currently have fixed sizes based on their content (so that it occupies the minimum amount of space + potentially some padding that we can define), I think that would fix the problem in the OP. My experiments after my earlier comment didn't lead anywhere unfortunately.

DavidoTek commented 1 month ago

If there was a good way to set a minimum window size for dialogs that currently have fixed sizes based on their content (so that it occupies the minimum amount of space + potentially some padding that we can define), I think that would fix the problem in the OP. My experiments after my earlier comment didn't lead anywhere unfortunately.

I guess we need to get rid of fixed sized dialogs at some point and make them resizable. Setting a minimum size should be possible in Qt Designer:

grafik

I don't think simply making dialogs resizeable is the fix here, because right now widgets are not always positioned relative. For example making this dialog resizeable would have this problem (screenshot taken running from main @ 21e2b3f with the maximumSize property reset the default from Qt Designer, 16777215x16777215):

That can be fixed quite easily be setting a layout to the QDialog instead of adding one manually:

grafik

grafik

https://github.com/DavidoTek/ProtonUp-Qt/pull/396