Skip to content

Commit 1698b98

Browse files
committed
Implement workaround for QTBUG-131786
1 parent e97ee3f commit 1698b98

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

qml/app/MpvqcApplication.qml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,12 @@ ApplicationWindow {
161161
propagateComposedEvents: true
162162

163163
onPressed: event => {
164-
event.accepted = false;
164+
// *********************************************************
165+
// fixme: Workaround QTBUG-131786 to fake modal behavior on Windows
166+
event.accepted = !!root.nativePopupOpen;
167+
// *********************************************************
168+
169+
// event.accepted = false;
165170
root.focusCommentTable();
166171
}
167172
}
@@ -183,4 +188,25 @@ ApplicationWindow {
183188

184189
Material.background: root.mpvqcTheme.background
185190
Material.foreground: root.mpvqcTheme.foreground
191+
192+
// *********************************************************
193+
// fixme: Workaround QTBUG-131786 to fake modal behavior on Windows
194+
property bool nativePopupOpen: false
195+
property Timer modalFaker: Timer {
196+
interval: 100
197+
onTriggered: { root.nativePopupOpen = false; }
198+
}
199+
200+
function enableFakeModal(): void {
201+
if (Qt.platform.os === "windows") {
202+
root.nativePopupOpen = true;
203+
}
204+
}
205+
206+
function disableFakeModal(): void {
207+
if (Qt.platform.os === "windows") {
208+
modalFaker.restart();
209+
}
210+
}
211+
// *********************************************************
186212
}

qml/shared/MpvqcMenu.qml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,9 @@ Menu {
5050
return item instanceof MenuSeparator;
5151
}
5252

53+
// *********************************************************
54+
// fixme: Workaround QTBUG-131786 to fake modal behavior on Windows
55+
onAboutToShow: enableFakeModal();
56+
onAboutToHide: disableFakeModal();
57+
// *********************************************************
5358
}

0 commit comments

Comments
 (0)