-
Notifications
You must be signed in to change notification settings - Fork 53
fix: Main interface does not gray out when losing focus #570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
|
@@ -60,6 +63,27 @@ 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) { | ||
| var candidate = Qt.application.activeWindow | ||
| if (candidate && candidate !== control) | ||
| transientParentWindow = candidate | ||
| } | ||
| Qt.callLater(function () { | ||
| control.raise() | ||
| control.requestActivate() | ||
| }) | ||
|
Comment on lines
+66
to
+84
|
||
| } | ||
|
|
||
| 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` | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
更新transientParentWindow的代码封装一下,逻辑在omCompleted和visibleChanged的时候应该是一样的,