diff options
author | Dheerendra Purohit <[email protected]> | 2025-07-02 12:13:23 +0530 |
---|---|---|
committer | Qt Cherry-pick Bot <[email protected]> | 2025-07-02 17:02:25 +0000 |
commit | cf5276fbfcc1eac13426d933dab188a0d90e2572 (patch) | |
tree | 53264f2e4477202df392b91fb20d0d34084e51b4 | |
parent | bdce476ab847f9302fa34e660fb99e3541c314e4 (diff) |
QScrollBar: Set parent for context menu to match other widgets
The QMenu created by QScrollBar::createStandardContextMenu(QPoint)
had no parent, unlike similar widgets like QLineEdit or QTextEdit,
which set themselves as the parent. This change sets 'this' as the
parent of the QMenu to ensure consistent behavior, proper object
ownership, and proper transient window handling.
Amends: 75ecb176df837331fdac0c386812f5c36e7a6359
Fixes: QTBUG-138049
Change-Id: Ie29fe2100ab91f66eec9f02cd5d768005f78afbc
Reviewed-by: Volker Hilsheimer <[email protected]>
(cherry picked from commit 8649e06a14ef141995a1c63926a6cccd64caa8f6)
Reviewed-by: Qt Cherry-pick Bot <[email protected]>
-rw-r--r-- | src/widgets/widgets/qscrollbar.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp index 431faf9e24d..af7a2e011b8 100644 --- a/src/widgets/widgets/qscrollbar.cpp +++ b/src/widgets/widgets/qscrollbar.cpp @@ -382,7 +382,7 @@ QMenu *QScrollBar::createStandardContextMenu(QPoint position) { #if QT_CONFIG(menu) const bool horiz = HORIZONTAL; - QMenu *menu = new QMenu(); + QMenu *menu = new QMenu(this); menu->setObjectName("qt_scrollbar_menu"_L1); if (window() && window()->windowHandle()) { |