Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buttons don't fit on window #360

Closed
ozon85 opened this issue Feb 24, 2024 · 5 comments · Fixed by #396
Closed

Buttons don't fit on window #360

ozon85 opened this issue Feb 24, 2024 · 5 comments · Fixed by #396
Labels
enhancement New feature or request

Comments

@ozon85
Copy link

ozon85 commented Feb 24, 2024

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

@ozon85 ozon85 added the enhancement New feature or request label Feb 24, 2024
@sonic2kk
Copy link
Contributor

sonic2kk commented Feb 24, 2024

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)).

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):

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 😅 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
Copy link
Contributor

sonic2kk commented Mar 3, 2024

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
Copy link
Owner

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
Copy link
Contributor

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 DavidoTek mentioned this issue May 13, 2024
5 tasks
@DavidoTek
Copy link
Owner

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

#396

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants