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 editorViewActive = (focus && focus == editorView->focusWidget());
|
||||||
bool editorViewVisible = editorView->isVisible();
|
bool editorViewVisible = editorView->isVisible();
|
||||||
|
|
||||||
if (!( editorViewVisible && !editorViewActive && editorView->window() == activeWindow )) {
|
|
||||||
bool stuffHidden = false;
|
bool stuffHidden = false;
|
||||||
QWidget *findPane = FindToolBarPlaceHolder::getCurrent();
|
FindToolBarPlaceHolder *findPane = FindToolBarPlaceHolder::getCurrent();
|
||||||
if (findPane && findPane->isVisible() && findPane->window() == activeWindow) {
|
if (findPane && findPane->isVisible() && findPane->isUsedByWidget(focus)) {
|
||||||
findPane->hide();
|
findPane->hide();
|
||||||
stuffHidden = true;
|
stuffHidden = true;
|
||||||
}
|
}
|
||||||
|
if (!( editorViewVisible && !editorViewActive && editorView->window() == activeWindow )) {
|
||||||
QWidget *outputPane = OutputPanePlaceHolder::getCurrent();
|
QWidget *outputPane = OutputPanePlaceHolder::getCurrent();
|
||||||
if (outputPane && outputPane->isVisible() && outputPane->window() == activeWindow) {
|
if (outputPane && outputPane->isVisible() && outputPane->window() == activeWindow) {
|
||||||
OutputPaneManager::instance()->slotHide();
|
OutputPaneManager::instance()->slotHide();
|
||||||
@@ -894,9 +894,9 @@ void EditorManager::doEscapeKeyFocusMoveMagic()
|
|||||||
RightPaneWidget::instance()->setShown(false);
|
RightPaneWidget::instance()->setShown(false);
|
||||||
stuffHidden = true;
|
stuffHidden = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (stuffHidden)
|
if (stuffHidden)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (!editorViewActive && editorViewVisible) {
|
if (!editorViewActive && editorViewVisible) {
|
||||||
setFocusToEditorViewAndUnmaximizePanes(editorView);
|
setFocusToEditorViewAndUnmaximizePanes(editorView);
|
||||||
|
|||||||
@@ -63,6 +63,20 @@ QWidget *FindToolBarPlaceHolder::owner() const
|
|||||||
return m_owner;
|
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)
|
void FindToolBarPlaceHolder::setWidget(QWidget *widget)
|
||||||
{
|
{
|
||||||
if (m_subWidget) {
|
if (m_subWidget) {
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ public:
|
|||||||
explicit FindToolBarPlaceHolder(QWidget *owner, QWidget *parent = 0);
|
explicit FindToolBarPlaceHolder(QWidget *owner, QWidget *parent = 0);
|
||||||
~FindToolBarPlaceHolder();
|
~FindToolBarPlaceHolder();
|
||||||
QWidget *owner() const;
|
QWidget *owner() const;
|
||||||
|
bool isUsedByWidget(QWidget *widget);
|
||||||
|
|
||||||
void setWidget(QWidget *widget);
|
void setWidget(QWidget *widget);
|
||||||
|
|
||||||
static FindToolBarPlaceHolder *getCurrent();
|
static FindToolBarPlaceHolder *getCurrent();
|
||||||
|
|||||||
Reference in New Issue
Block a user