diff options
Diffstat (limited to 'src/plugins/git')
-rw-r--r-- | src/plugins/git/branchmodel.cpp | 5 | ||||
-rw-r--r-- | src/plugins/git/branchview.cpp | 15 | ||||
-rw-r--r-- | src/plugins/git/branchview.h | 2 |
3 files changed, 13 insertions, 9 deletions
diff --git a/src/plugins/git/branchmodel.cpp b/src/plugins/git/branchmodel.cpp index a7bba79a45..4c78bf5108 100644 --- a/src/plugins/git/branchmodel.cpp +++ b/src/plugins/git/branchmodel.cpp @@ -319,10 +319,7 @@ Qt::ItemFlags BranchModel::flags(const QModelIndex &index) const BranchNode *node = indexToNode(index); if (!node) return Qt::NoItemFlags; - if (index.column() == 0 && node->isLeaf() && node->isLocal()) - return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled; - else - return Qt::ItemIsSelectable | Qt::ItemIsEnabled; + return Qt::ItemIsSelectable | Qt::ItemIsEnabled; } void BranchModel::clear() diff --git a/src/plugins/git/branchview.cpp b/src/plugins/git/branchview.cpp index ddb3565f49..7487e73b5f 100644 --- a/src/plugins/git/branchview.cpp +++ b/src/plugins/git/branchview.cpp @@ -100,6 +100,8 @@ BranchView::BranchView() : this, &BranchView::BranchView::setIncludeTags); m_branchView->setContextMenuPolicy(Qt::CustomContextMenu); + connect(m_branchView, &QAbstractItemView::doubleClicked, + this, &BranchView::log); connect(m_branchView, &QWidget::customContextMenuRequested, this, &BranchView::slotCustomContextMenu); connect(m_model, &QAbstractItemModel::modelReset, @@ -192,11 +194,7 @@ void BranchView::slotCustomContextMenu(const QPoint &point) if (!fullName.isEmpty()) GitPlugin::client()->diffBranch(m_repository, fullName); }); - contextMenu.addAction(tr("Log"), this, [this] { - const QString branchName = m_model->fullName(selectedIndex(), true); - if (!branchName.isEmpty()) - GitPlugin::client()->log(m_repository, QString(), false, {branchName}); - }); + contextMenu.addAction(tr("Log"), this, [this] { log(selectedIndex()); }); contextMenu.addSeparator(); if (!currentSelected) { if (currentLocal) @@ -491,6 +489,13 @@ bool BranchView::cherryPick() return GitPlugin::client()->synchronousCherryPick(m_repository, branch); } +void BranchView::log(const QModelIndex &idx) +{ + const QString branchName = m_model->fullName(idx, true); + if (!branchName.isEmpty()) + GitPlugin::client()->log(m_repository, QString(), false, {branchName}); +} + BranchViewFactory::BranchViewFactory() { setDisplayName(tr("Git Branches")); diff --git a/src/plugins/git/branchview.h b/src/plugins/git/branchview.h index fdee914c50..096510f550 100644 --- a/src/plugins/git/branchview.h +++ b/src/plugins/git/branchview.h @@ -31,6 +31,7 @@ #include <QWidget> QT_BEGIN_NAMESPACE +class QModelIndex; class QPoint; class QToolButton; class QTreeView; @@ -79,6 +80,7 @@ private: bool merge(bool allowFastForward); void rebase(); bool cherryPick(); + void log(const QModelIndex &idx); QToolButton *m_addButton = nullptr; QToolButton *m_refreshButton = nullptr; |