Skip to content

Commit

Permalink
Implement workaround for QTBUG-131786
Browse files Browse the repository at this point in the history
  • Loading branch information
trin94 committed Feb 2, 2025
1 parent e97ee3f commit 1698b98
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
28 changes: 27 additions & 1 deletion qml/app/MpvqcApplication.qml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,12 @@ ApplicationWindow {
propagateComposedEvents: true

onPressed: event => {
event.accepted = false;
// *********************************************************
// fixme: Workaround QTBUG-131786 to fake modal behavior on Windows
event.accepted = !!root.nativePopupOpen;
// *********************************************************

// event.accepted = false;
root.focusCommentTable();
}
}
Expand All @@ -183,4 +188,25 @@ ApplicationWindow {

Material.background: root.mpvqcTheme.background
Material.foreground: root.mpvqcTheme.foreground

// *********************************************************
// fixme: Workaround QTBUG-131786 to fake modal behavior on Windows
property bool nativePopupOpen: false
property Timer modalFaker: Timer {
interval: 100
onTriggered: { root.nativePopupOpen = false; }
}

function enableFakeModal(): void {
if (Qt.platform.os === "windows") {
root.nativePopupOpen = true;
}
}

function disableFakeModal(): void {
if (Qt.platform.os === "windows") {
modalFaker.restart();
}
}
// *********************************************************
}
5 changes: 5 additions & 0 deletions qml/shared/MpvqcMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,9 @@ Menu {
return item instanceof MenuSeparator;
}

// *********************************************************
// fixme: Workaround QTBUG-131786 to fake modal behavior on Windows
onAboutToShow: enableFakeModal();
onAboutToHide: disableFakeModal();
// *********************************************************
}

0 comments on commit 1698b98

Please sign in to comment.