Commit 1ed0c476 authored by Christoph Cullmann's avatar Christoph Cullmann

better handling of mouse clicks

be consistent with the project tree view

1) single click activates document, like in project tree
2) non-document tree parts collapse/expand like normal

BUG: 395082
parent c1c44790
......@@ -62,7 +62,6 @@ KateFileTree::KateFileTree(QWidget *parent): QTreeView(parent)
// handle activated (e.g. for pressing enter) + clicked (to avoid to need to do double-click e.g. on Windows)
connect(this, &KateFileTree::activated, this, &KateFileTree::mouseClicked);
connect(this, &KateFileTree::clicked, this, &KateFileTree::mouseClicked);
connect(this, &KateFileTree::pressed, this, &KateFileTree::mouseClicked);
m_filelistReloadDocument = new QAction(QIcon::fromTheme(QLatin1String("view-refresh")), i18nc("@action:inmenu", "Reloa&d"), this);
connect(m_filelistReloadDocument, &QAction::triggered, this, &KateFileTree::slotDocumentReload);
......@@ -203,13 +202,9 @@ void KateFileTree::slotCurrentChanged(const QModelIndex &current, const QModelIn
void KateFileTree::mouseClicked(const QModelIndex &index)
{
KTextEditor::Document *doc = model()->data(index, KateFileTreeModel::DocumentRole).value<KTextEditor::Document *>();
if (doc) {
if (auto doc = model()->data(index, KateFileTreeModel::DocumentRole).value<KTextEditor::Document *>()) {
emit activateDocument(doc);
} else {
setExpanded(index, !isExpanded(index));
}
}
void KateFileTree::contextMenuEvent(QContextMenuEvent *event)
......
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