Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions qt6/src/qml/DialogWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Window {
property real leftPadding: DS.Style.dialogWindow.contentHMargin
property real rightPadding: DS.Style.dialogWindow.contentHMargin

property var transientParentWindow: null
transientParent: transientParentWindow

Item {
id: content
palette: control.active ? D.DTK.palette : D.DTK.inactivePalette
Expand Down Expand Up @@ -60,6 +63,24 @@ Window {
}
}

Component.onCompleted: {
if (control.modality === Qt.WindowModal && !transientParentWindow)
transientParentWindow = Qt.application.activeWindow
}

onVisibleChanged: {
if (!control.visible)
return
if (control.modality !== Qt.WindowModal)
return
if (!transientParentWindow || transientParentWindow === control)
transientParentWindow = Qt.application.activeWindow
Qt.callLater(function () {
control.raise()
control.requestActivate()
})
Comment on lines +66 to +81
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

transientParentWindow is only set when it is null (or equals control). Once it has been auto-assigned the first time, it will not update on subsequent shows. If a DialogWindow instance is reused across multiple top-level windows, the dialog can remain transient for the original window, causing the wrong window to gray out (or none) when shown from another active window. Consider recalculating the transient parent each time the dialog becomes visible (or clearing the auto-assigned parent when the dialog is hidden), while still respecting an explicitly provided transient parent when callers set one.

Copilot uses AI. Check for mistakes.
}

onClosing: function(close) {
// close can't reset sub control's hovered state. pms Bug:168405
// if we need to close, we can add closing handler to set `close.acceped = true`
Expand Down