diff --git a/src/plugins/git/gerrit/gerritdialog.cpp b/src/plugins/git/gerrit/gerritdialog.cpp index 329f23330edbe97b216bc098ea743ebdb4c473e5..70fb173a28717e0b24a48446ef5c563ff0b81fb3 100644 --- a/src/plugins/git/gerrit/gerritdialog.cpp +++ b/src/plugins/git/gerrit/gerritdialog.cpp @@ -32,6 +32,7 @@ #include "gerritparameters.h" #include <utils/qtcassert.h> +#include <utils/itemviews.h> #include <coreplugin/icore.h> #include <QVBoxLayout> @@ -96,7 +97,7 @@ GerritDialog::GerritDialog(const QSharedPointer<GerritParameters> &p, , m_filterModel(new QSortFilterProxyModel(this)) , m_model(new GerritModel(p, this)) , m_queryModel(new QStringListModel(this)) - , m_treeView(new QTreeView) + , m_treeView(new Utils::TreeView) , m_detailsBrowser(new QTextBrowser) , m_queryLineEdit(new QueryValidatingLineEdit) , m_filterLineEdit(new Utils::FancyLineEdit) @@ -143,12 +144,13 @@ GerritDialog::GerritDialog(const QSharedPointer<GerritParameters> &p, m_treeView->setRootIsDecorated(false); m_treeView->setSelectionBehavior(QAbstractItemView::SelectRows); m_treeView->setSortingEnabled(true); + m_treeView->setActivationMode(Utils::DoubleClickActivation); QItemSelectionModel *selectionModel = m_treeView->selectionModel(); connect(selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(slotCurrentChanged())); - connect(m_treeView, SIGNAL(doubleClicked(QModelIndex)), - this, SLOT(slotDoubleClicked(QModelIndex))); + connect(m_treeView, SIGNAL(activated(QModelIndex)), + this, SLOT(slotActivated(QModelIndex))); QGroupBox *detailsGroup = new QGroupBox(tr("Details")); QVBoxLayout *detailsLayout = new QVBoxLayout(detailsGroup); @@ -224,7 +226,7 @@ GerritDialog::~GerritDialog() { } -void GerritDialog::slotDoubleClicked(const QModelIndex &i) +void GerritDialog::slotActivated(const QModelIndex &i) { if (const QStandardItem *item = itemAt(i)) QDesktopServices::openUrl(QUrl(m_model->change(item->row())->url)); diff --git a/src/plugins/git/gerrit/gerritdialog.h b/src/plugins/git/gerrit/gerritdialog.h index 444bc587ef152b70b00072d318c94854ecb85d31..2d6d675f2f260071e35fcebd24780f387a48f24e 100644 --- a/src/plugins/git/gerrit/gerritdialog.h +++ b/src/plugins/git/gerrit/gerritdialog.h @@ -48,6 +48,8 @@ class QDialogButtonBox; class QTextBrowser; QT_END_NAMESPACE +namespace Utils { class TreeView; } + namespace Gerrit { namespace Internal { class GerritParameters; @@ -93,7 +95,7 @@ public slots: private slots: void slotCurrentChanged(); - void slotDoubleClicked(const QModelIndex &); + void slotActivated(const QModelIndex &); void slotRefreshStateChanged(bool); void slotFetchDisplay(); void slotFetchCherryPick(); @@ -111,7 +113,7 @@ private: QSortFilterProxyModel *m_filterModel; GerritModel *m_model; QStringListModel *m_queryModel; - QTreeView *m_treeView; + Utils::TreeView *m_treeView; QTextBrowser *m_detailsBrowser; QueryValidatingLineEdit *m_queryLineEdit; Utils::FancyLineEdit *m_filterLineEdit;