Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
None
-
None
Description
Setting a minimum and maximum size on a QWidget is basically treated as a hint, but is currently not documented as such. Sometimes the platform (e.g. on fullscreen platforms) will not support the size constraints, and we need to find a way to recover. The typical recovery in Qt is currently to resize the window the system preference and break the min/max constraints.
The QWindow::setMinimumSize docs accounts for this and calls the size a hint for the system. But for QWidget the documentation says more strictly that the widget will never be smaller than its minimum size.
So the question is what to do on platforms where we cannot respect the minimum/maximum size.
This came up recently in QTBUG-121445: A recent change on Wayland caused it to apply the same recovery as on other platforms, because neglecting to respect the system's requirements on this is considered a protocol error and the connection to the compositor will shut down, hence the application will crash. Unfortunately, this is experienced as a regression on compositors which previously chose to ignore the protocol error and let the application have its way.
There is a lot of discussion on QTBUG-121445 which is relevant to this. In the end, the suggestion was that QWidget should respect the size constraints even if the underlying window does not (so if the window is smaller, then it will be clipped). So basically the same behavior as putting the widget into a different top-level window without adding it to a layout. This would cause the implementation to follow the QWidget docs and existing apps which make assumptions based on this promise will continue to work when ported to the non-compliant platforms.
Alternatively, we could update the documentation to match QWindow and also document how to implement the cropping mechanism using the existing API.
Since the discussion was confined to a very platform-specific crowd, we're making this to bring the discussion to those in a position to make the decision here.
Attachments
Issue Links
- relates to
-
QTBUG-112994 QWidget::setMinimumSize API guarantee is broken on i3
- Reported
- replaces
-
QTBUG-121445 [REG 6.6 -> 6.7] Top-level QWidget minimum/maximum size API promise is broken on Wayland
- Closed