Commit 7369f471 authored by Peter Mühlenpfordt's avatar Peter Mühlenpfordt
Browse files

Set focus back to image view after leaving edit tool

Summary:
If you click on the toolbar of an image edit tool (crop, redeye)
the focus is lost after leaving the tool and you cannot switch images
with cursor keys.
This patch resets the focus to image view after leaving the edit tool.

BUG: 321091

Test Plan:
* Open image in Gwenview View Mode (normal or fullscreen)
* Start crop tool ({key Shift C})
* Click on {nav Crop} or {nav Cancel}
* Switching images with cursor keys should work as usual

Reviewers: #gwenview, rkflx

Reviewed By: #gwenview, rkflx

Subscribers: rkflx, huoni

Differential Revision: https://phabricator.kde.org/D11899
parent f46bd3a3
......@@ -347,6 +347,9 @@ struct ViewMainPagePrivate
Q_ASSERT(mActivityResources.contains(view));
mActivityResources.value(view)->notifyFocusedIn();
QObject::connect(view, &DocumentView::currentToolChanged,
q, &ViewMainPage::updateFocus);
}
QModelIndex indexForView(DocumentView* view) const
......@@ -810,4 +813,11 @@ void ViewMainPage::showMessageWidget(QGraphicsWidget* widget, Qt::Alignment alig
d->mDocumentViewContainer->showMessageWidget(widget, align);
}
void ViewMainPage::updateFocus(const AbstractRasterImageViewTool* tool)
{
if (!tool) {
d->mDocumentViewContainer->setFocus();
}
}
} // namespace
......@@ -37,6 +37,7 @@ class KActionCollection;
namespace Gwenview
{
class AbstractRasterImageViewTool;
class DocumentView;
class GvCore;
class RasterImageView;
......@@ -150,6 +151,8 @@ protected:
private:
friend struct ViewMainPagePrivate;
ViewMainPagePrivate* const d;
void updateFocus(const AbstractRasterImageViewTool* tool);
};
} // namespace
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment