Commit a5b09336 authored by mae's avatar mae Committed by con

Fixed crash in combination with splits (some spurious

focus in events resulted in currentEditorView() being 0)
(cherry picked from commit a922accd)
parent 81ed95dd
......@@ -1484,8 +1484,8 @@ void EditorManager::updateActions()
m_d->m_gotoNextDocHistoryAction->setEnabled(m_d->m_editorModel->rowCount() != 0);
m_d->m_gotoPreviousDocHistoryAction->setEnabled(m_d->m_editorModel->rowCount() != 0);
EditorView *view = currentEditorView();
m_d->m_goBackAction->setEnabled(view->canGoBack());
m_d->m_goForwardAction->setEnabled(view->canGoForward());
m_d->m_goBackAction->setEnabled(view ? view->canGoBack() : false);
m_d->m_goForwardAction->setEnabled(view ? view->canGoForward() : false);
bool hasSplitter = m_d->m_splitter->isSplitter();
m_d->m_removeCurrentSplitAction->setEnabled(hasSplitter);
......
......@@ -617,7 +617,6 @@ SplitterOrView::SplitterOrView(OpenEditorsModel *model)
m_view = new EditorView(model);
m_splitter = 0;
m_layout->addWidget(m_view);
setFocusPolicy(Qt::ClickFocus);
}
SplitterOrView::SplitterOrView(Core::IEditor *editor)
......@@ -629,7 +628,6 @@ SplitterOrView::SplitterOrView(Core::IEditor *editor)
m_view->addEditor(editor);
m_splitter = 0;
m_layout->addWidget(m_view);
setFocusPolicy(Qt::ClickFocus);
}
SplitterOrView::~SplitterOrView()
......@@ -642,10 +640,11 @@ SplitterOrView::~SplitterOrView()
m_splitter = 0;
}
void SplitterOrView::focusInEvent(QFocusEvent *)
void SplitterOrView::mousePressEvent(QMouseEvent *e)
{
if (e->button() != Qt::LeftButton)
return;
setFocus(Qt::MouseFocusReason);
CoreImpl::instance()->editorManager()->setCurrentView(this);
}
......@@ -664,6 +663,7 @@ void SplitterOrView::paintEvent(QPaintEvent *)
const int r = 3;
painter.drawRoundedRect(rect().adjusted(r, r, -r, -r), r * 2, r * 2);
#if 0
if (hasFocus()) {
#ifdef Q_WS_MAC
// With QMacStyle, we have to draw our own focus rect, since I didn't find
......@@ -687,6 +687,7 @@ void SplitterOrView::paintEvent(QPaintEvent *)
}
#endif
}
#endif
}
SplitterOrView *SplitterOrView::findFirstView()
......
......@@ -199,8 +199,8 @@ public:
void unsplitAll();
protected:
void focusInEvent(QFocusEvent *);
void paintEvent(QPaintEvent *);
void mousePressEvent(QMouseEvent *e);
private:
......
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