forked from qt-creator/qt-creator
GerritDialog: Fix keyboard activation
Open the change in a browser on Return/Enter Change-Id: I6ed6d832e3bebf625adb3765415929cc0670d4e4 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user