Commit a16bab0e authored by Eike Ziller's avatar Eike Ziller

Fix escape logic for closing find tool bar in mode with editor view

E.g. open context help, press ctrl+f to search in help, press escape
(focus moves to help viewer), press escape: find tool bar should be
hidden, instead it was moving focus to the editor.

Change-Id: Ia5d8563458582e2871afd9e3107e49e71d03b3f5
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent 23d3ada7
......@@ -877,13 +877,13 @@ void EditorManager::doEscapeKeyFocusMoveMagic()
bool editorViewActive = (focus && focus == editorView->focusWidget());
bool editorViewVisible = editorView->isVisible();
bool stuffHidden = false;
FindToolBarPlaceHolder *findPane = FindToolBarPlaceHolder::getCurrent();
if (findPane && findPane->isVisible() && findPane->isUsedByWidget(focus)) {
findPane->hide();
stuffHidden = true;
}
if (!( editorViewVisible && !editorViewActive && editorView->window() == activeWindow )) {
bool stuffHidden = false;
QWidget *findPane = FindToolBarPlaceHolder::getCurrent();
if (findPane && findPane->isVisible() && findPane->window() == activeWindow) {
findPane->hide();
stuffHidden = true;
}
QWidget *outputPane = OutputPanePlaceHolder::getCurrent();
if (outputPane && outputPane->isVisible() && outputPane->window() == activeWindow) {
OutputPaneManager::instance()->slotHide();
......@@ -894,9 +894,9 @@ void EditorManager::doEscapeKeyFocusMoveMagic()
RightPaneWidget::instance()->setShown(false);
stuffHidden = true;
}
if (stuffHidden)
return;
}
if (stuffHidden)
return;
if (!editorViewActive && editorViewVisible) {
setFocusToEditorViewAndUnmaximizePanes(editorView);
......
......@@ -63,6 +63,20 @@ QWidget *FindToolBarPlaceHolder::owner() const
return m_owner;
}
/*!
* Returns if \a widget is a subwidget of the place holder's owner
*/
bool FindToolBarPlaceHolder::isUsedByWidget(QWidget *widget)
{
QWidget *current = widget;
while (current) {
if (current == m_owner)
return true;
current = current->parentWidget();
}
return false;
}
void FindToolBarPlaceHolder::setWidget(QWidget *widget)
{
if (m_subWidget) {
......
......@@ -44,6 +44,8 @@ public:
explicit FindToolBarPlaceHolder(QWidget *owner, QWidget *parent = 0);
~FindToolBarPlaceHolder();
QWidget *owner() const;
bool isUsedByWidget(QWidget *widget);
void setWidget(QWidget *widget);
static FindToolBarPlaceHolder *getCurrent();
......
Markdown is supported
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