forked from qt-creator/qt-creator
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: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
@@ -877,13 +877,13 @@ void EditorManager::doEscapeKeyFocusMoveMagic()
|
||||
bool editorViewActive = (focus && focus == editorView->focusWidget());
|
||||
bool editorViewVisible = editorView->isVisible();
|
||||
|
||||
if (!( editorViewVisible && !editorViewActive && editorView->window() == activeWindow )) {
|
||||
bool stuffHidden = false;
|
||||
QWidget *findPane = FindToolBarPlaceHolder::getCurrent();
|
||||
if (findPane && findPane->isVisible() && findPane->window() == activeWindow) {
|
||||
FindToolBarPlaceHolder *findPane = FindToolBarPlaceHolder::getCurrent();
|
||||
if (findPane && findPane->isVisible() && findPane->isUsedByWidget(focus)) {
|
||||
findPane->hide();
|
||||
stuffHidden = true;
|
||||
}
|
||||
if (!( editorViewVisible && !editorViewActive && editorView->window() == activeWindow )) {
|
||||
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 (!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();
|
||||
|
||||
Reference in New Issue
Block a user