Update the default behavior of items with layout

The earlier patch 4ae537e67c99160f5dcac99f40d03a7921456556 had default
behavior as opt-out for size policy of items within the layout. This
can cause a lot more UI regressions than anticipated and, so make it as
opt-in (Qt::AA_QtQuickUseDefaultSizePolicy). This means that the user
needs to explicitly set this attribute to utilize the default size
policy of quick items.

Amends patch 4ae537e67c99160f5dcac99f40d03a7921456556

Task-number: QTBUG-117597
Change-Id: Ibdb3ea9897c19792a110cbb15834b27383b9103e
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit c606739ad1d5cf68449e61db751aa0c65cba3e00)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Santhosh Kumar 2024-02-27 15:35:56 +01:00 committed by Qt Cherry-pick Bot
parent d134378b20
commit 335307c6a3
2 changed files with 13 additions and 5 deletions

View File

@ -422,7 +422,7 @@ namespace Qt {
enum ApplicationAttribute
{
// AA_ImmediateWidgetCreation = 0,
AA_QtQuickDontUseDefaultSizePolicy = 1,
AA_QtQuickUseDefaultSizePolicy = 1 QT_TECH_PREVIEW_API,
AA_DontShowIconsInMenus = 2,
AA_NativeWindows = 3,
AA_DontCreateNativeWidgetSiblings = 4,

View File

@ -84,10 +84,18 @@
QCoreApplication::testAttribute().
\value [since 6.7] AA_QtQuickDontUseDefaultSizePolicy Qt Quick Layouts won't use the built-in
size policy of \l Item. This restores previous behavior where all items were fixed size
by default. Size policy can be customized by explicitly setting
\l{Layout::fillWidth}{Layout.fillWidth} or \l{Layout::fillHeight}{Layout.fillHeight}.
\value [since 6.7] AA_QtQuickUseDefaultSizePolicy Qt Quick Layouts use the built-in size
policy of \l Item. For example, when this is set, \l Button fills the available
width, but has a fixed height. When this is not set, it will use the default
sizing behavior of the layout it's in, which is to use its implicit size as the
preferred size. This is explained in detail in \l {Specifying preferred size} and
\l {Size constraints}. When this is set, the default size policy of the item
with the layout can be overridden by explicitly setting
\l{Layout::fillWidth}{Layout.fillWidth} or
\l{Layout::fillHeight}{Layout.fillHeight}.
\b Note: This API is considered tech preview and may change or be removed in future
versions of Qt.
\value AA_DontShowIconsInMenus Actions with the Icon property won't be
shown in any menus unless specifically set by the