From 21e7a6ecca466e6b7f954160693aa91bd9f82210 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 25 Apr 2013 12:32:36 +0200 Subject: [PATCH] Let EditorView handle mouse click (setting current view) itself Moves the handling from SplitterOrView to EditorView. Change-Id: I187093ff4570709bac111c4cb4cf901c971a1973 Reviewed-by: David Schulz --- .../coreplugin/editormanager/editorview.cpp | 16 ++++++++-------- .../coreplugin/editormanager/editorview.h | 4 +--- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp index 98fc3ec020f..04f3fd91c85 100644 --- a/src/plugins/coreplugin/editormanager/editorview.cpp +++ b/src/plugins/coreplugin/editormanager/editorview.cpp @@ -185,6 +185,14 @@ void EditorView::paintEvent(QPaintEvent *) painter.drawRoundedRect(m_container->geometry().adjusted(r , r, -r, -r), r * 2, r * 2); } +void EditorView::mousePressEvent(QMouseEvent *e) +{ + if (e->button() != Qt::LeftButton) + return; + setFocus(Qt::MouseFocusReason); + ICore::editorManager()->setCurrentView(this); +} + void EditorView::addEditor(IEditor *editor) { if (m_editors.contains(editor)) @@ -493,14 +501,6 @@ SplitterOrView::~SplitterOrView() m_splitter = 0; } -void SplitterOrView::mousePressEvent(QMouseEvent *e) -{ - if (e->button() != Qt::LeftButton) - return; - setFocus(Qt::MouseFocusReason); - ICore::editorManager()->setCurrentView(view()); -} - EditorView *SplitterOrView::findFirstView() { if (m_splitter) { diff --git a/src/plugins/coreplugin/editormanager/editorview.h b/src/plugins/coreplugin/editormanager/editorview.h index 615194b11ef..74009d04f05 100644 --- a/src/plugins/coreplugin/editormanager/editorview.h +++ b/src/plugins/coreplugin/editormanager/editorview.h @@ -101,6 +101,7 @@ public: protected: void paintEvent(QPaintEvent *); + void mousePressEvent(QMouseEvent *e); private slots: void closeView(); @@ -190,9 +191,6 @@ public: void unsplitAll(); -protected: - void mousePressEvent(QMouseEvent *e); - private: void unsplitAll_helper(); SplitterOrView *findNextView_helper(SplitterOrView *view, bool *found);