forked from qt-creator/qt-creator
Close opened files by middle click.
Change-Id: I548c62d6a043677e3989ec9f9082f2dcd731fae1 Reviewed-by: Dmitry Savchenko <dmitry.a.sav@gmail.com> Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
committed by
Eike Ziller
parent
a225e5b867
commit
a753126959
@@ -118,6 +118,7 @@ OpenEditorsWidget::OpenEditorsWidget()
|
||||
m_ui.editorList->header()->resizeSection(1, 16);
|
||||
m_ui.editorList->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
m_ui.editorList->installEventFilter(this);
|
||||
m_ui.editorList->viewport()->installEventFilter(this);
|
||||
|
||||
connect(em, SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||
this, SLOT(updateCurrentItem(Core::IEditor*)));
|
||||
@@ -162,6 +163,17 @@ bool OpenEditorsWidget::eventFilter(QObject *obj, QEvent *event)
|
||||
&& ke->modifiers() == 0) {
|
||||
closeEditor(m_ui.editorList->currentIndex());
|
||||
}
|
||||
} else if (obj == m_ui.editorList->viewport()
|
||||
&& event->type() == QEvent::MouseButtonRelease) {
|
||||
QMouseEvent * me = static_cast<QMouseEvent*>(event);
|
||||
if (me->button() == Qt::MiddleButton
|
||||
&& me->modifiers() == Qt::NoModifier) {
|
||||
QModelIndex index = m_ui.editorList->indexAt(me->pos());
|
||||
if (index.isValid()) {
|
||||
closeEditor(index);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user