Menu: fix contentItem's interactive
The interactive property of the Menu's contentItem depends on its Menu
(control) when Window.window is valid. In the case of a fixed-height
menu, even if the contentItem's height is smaller than
Window.window.height, the interactive property of the contentItem would
be false if the menu's height is smaller than the window's height and
also smaller than its contentItem's height.
Fixes: QTBUG-93856
Pick-to: 6.5 6.2
Change-Id: If95080250c3953d4293a9e1dbcc6225d21ee034f
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit d0a83e3330
)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
b407e37176
commit
e6478662c1
|
@ -22,8 +22,8 @@ T.Menu {
|
|||
implicitHeight: contentHeight
|
||||
model: control.contentModel
|
||||
interactive: Window.window
|
||||
? contentHeight + control.topPadding + control.bottomPadding > Window.window.height
|
||||
: false
|
||||
? contentHeight + control.topPadding + control.bottomPadding > control.height
|
||||
: false
|
||||
clip: true
|
||||
currentIndex: control.currentIndex
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ T.Menu {
|
|||
implicitHeight: contentHeight
|
||||
model: control.contentModel
|
||||
interactive: Window.window
|
||||
? contentHeight + control.topPadding + control.bottomPadding > Window.window.height
|
||||
: false
|
||||
? contentHeight + control.topPadding + control.bottomPadding > control.height
|
||||
: false
|
||||
clip: true
|
||||
currentIndex: control.currentIndex
|
||||
|
||||
|
|
|
@ -36,8 +36,8 @@ T.Menu {
|
|||
implicitHeight: contentHeight
|
||||
model: control.contentModel
|
||||
interactive: Window.window
|
||||
? contentHeight + control.topPadding + control.bottomPadding > Window.window.height
|
||||
: false
|
||||
? contentHeight + control.topPadding + control.bottomPadding > control.height
|
||||
: false
|
||||
clip: true
|
||||
currentIndex: control.currentIndex
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ T.Menu {
|
|||
implicitHeight: contentHeight
|
||||
model: control.contentModel
|
||||
interactive: Window.window
|
||||
? contentHeight + control.topPadding + control.bottomPadding > Window.window.height
|
||||
: false
|
||||
? contentHeight + control.topPadding + control.bottomPadding > control.height
|
||||
: false
|
||||
clip: true
|
||||
currentIndex: control.currentIndex
|
||||
|
||||
|
|
|
@ -42,8 +42,8 @@ T.Menu {
|
|||
|
||||
model: control.contentModel
|
||||
interactive: Window.window
|
||||
? contentHeight + control.topPadding + control.bottomPadding > Window.window.height
|
||||
: false
|
||||
? contentHeight + control.topPadding + control.bottomPadding > control.height
|
||||
: false
|
||||
clip: true
|
||||
currentIndex: control.currentIndex
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@ T.Menu {
|
|||
implicitHeight: contentHeight
|
||||
model: control.contentModel
|
||||
interactive: Window.window
|
||||
? contentHeight + control.topPadding + control.bottomPadding > Window.window.height
|
||||
: false
|
||||
? contentHeight + control.topPadding + control.bottomPadding > control.height
|
||||
: false
|
||||
clip: true
|
||||
currentIndex: control.currentIndex
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2023 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Window
|
||||
|
||||
Window {
|
||||
width: 300
|
||||
height: 300
|
||||
|
||||
property alias menu: menu
|
||||
|
||||
Menu {
|
||||
id: menu
|
||||
anchors.centerIn: parent
|
||||
height: 100
|
||||
visible: true
|
||||
Repeater {
|
||||
model: 10
|
||||
delegate: MenuItem {
|
||||
objectName: text
|
||||
text: (index + 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1788,6 +1788,7 @@ void tst_QQuickMenu::scrollable_data()
|
|||
QTest::addRow("Window") << QString::fromLatin1("windowScrollable.qml");
|
||||
QTest::addRow("ApplicationWindow") << QString::fromLatin1("applicationWindowScrollable.qml");
|
||||
QTest::addRow("WithPadding") << QString::fromLatin1("scrollableWithPadding.qml");
|
||||
QTest::addRow("FixedHeight") << QString::fromLatin1("scrollableWithFixedHeight.qml");
|
||||
}
|
||||
|
||||
void tst_QQuickMenu::scrollable()
|
||||
|
|
Loading…
Reference in New Issue