forked from qt-creator/qt-creator
Let EditorView handle mouse click (setting current view) itself
Moves the handling from SplitterOrView to EditorView. Change-Id: I187093ff4570709bac111c4cb4cf901c971a1973 Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -185,6 +185,14 @@ void EditorView::paintEvent(QPaintEvent *)
|
|||||||
painter.drawRoundedRect(m_container->geometry().adjusted(r , r, -r, -r), r * 2, r * 2);
|
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)
|
void EditorView::addEditor(IEditor *editor)
|
||||||
{
|
{
|
||||||
if (m_editors.contains(editor))
|
if (m_editors.contains(editor))
|
||||||
@@ -493,14 +501,6 @@ SplitterOrView::~SplitterOrView()
|
|||||||
m_splitter = 0;
|
m_splitter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplitterOrView::mousePressEvent(QMouseEvent *e)
|
|
||||||
{
|
|
||||||
if (e->button() != Qt::LeftButton)
|
|
||||||
return;
|
|
||||||
setFocus(Qt::MouseFocusReason);
|
|
||||||
ICore::editorManager()->setCurrentView(view());
|
|
||||||
}
|
|
||||||
|
|
||||||
EditorView *SplitterOrView::findFirstView()
|
EditorView *SplitterOrView::findFirstView()
|
||||||
{
|
{
|
||||||
if (m_splitter) {
|
if (m_splitter) {
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *);
|
void paintEvent(QPaintEvent *);
|
||||||
|
void mousePressEvent(QMouseEvent *e);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void closeView();
|
void closeView();
|
||||||
@@ -190,9 +191,6 @@ public:
|
|||||||
|
|
||||||
void unsplitAll();
|
void unsplitAll();
|
||||||
|
|
||||||
protected:
|
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void unsplitAll_helper();
|
void unsplitAll_helper();
|
||||||
SplitterOrView *findNextView_helper(SplitterOrView *view, bool *found);
|
SplitterOrView *findNextView_helper(SplitterOrView *view, bool *found);
|
||||||
|
|||||||
Reference in New Issue
Block a user