-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix #312442: Fix palette search shortcut functionality #6802
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 1 commit
acefb69
4c24c59
3e38b70
a7bab93
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 |
|---|---|---|
|
|
@@ -26,6 +26,7 @@ | |
| #include "qml/nativetooltip.h" | ||
|
|
||
| #include <QQmlContext> | ||
| #include <QTimer> | ||
|
|
||
| namespace Ms { | ||
|
|
||
|
|
@@ -119,10 +120,13 @@ void PaletteWidget::setupStyle() | |
|
|
||
| void PaletteWidget::activateSearchBox() | ||
| { | ||
| int delay = isFloating() ? 300 : 0; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May seem strange, but when palette is floating, the focus in event ends up occuring "after" the focus in event of the searchText and ends up then removing the preparation for search string. Adding a slight delay to the request only when floating clears this up |
||
| ensureQmlViewFocused(); | ||
| const bool invoked = QMetaObject::invokeMethod(rootObject(), "requestPaletteSearch"); | ||
| Q_UNUSED(invoked); | ||
| Q_ASSERT(invoked); | ||
| QTimer::singleShot(delay, this, [&](){ | ||
| const bool invoked = QMetaObject::invokeMethod(rootObject(), "requestPaletteSearch"); | ||
| Q_UNUSED(invoked); | ||
| Q_ASSERT(invoked); | ||
| }); | ||
| } | ||
|
|
||
| //--------------------------------------------------------- | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -211,8 +211,10 @@ QQuickView* QmlDockWidget::getView() | |
|
|
||
| void QmlDockWidget::ensureQmlViewFocused() | ||
| { | ||
| if (_view && !_view->activeFocusItem()) | ||
| if (_view && !_view->activeFocusItem()) { | ||
| widget()->activateWindow(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This ends up allowing using the search shortcut while floating. Unfortunately took quite some time for me to figure this out, even though it's only one function call extra. |
||
| widget()->setFocus(); | ||
| } | ||
| } | ||
|
|
||
| //--------------------------------------------------------- | ||
|
|
||
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.
Likewise, this allows for pressing ESCAPE and from within the search string while floating and have the score resume focus. Unfortunately doesn't work without this PR/Commit.