forked from qt-creator/qt-creator
SearchResultTreeView: Use Utils::TreeView as base class
Slightly fixes the keyboard handling. Change-Id: Ifd7f19012457fb6d8e29f511cf63566db6093665 Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -39,7 +39,7 @@ namespace Core {
|
||||
namespace Internal {
|
||||
|
||||
SearchResultTreeView::SearchResultTreeView(QWidget *parent)
|
||||
: QTreeView(parent)
|
||||
: Utils::TreeView(parent)
|
||||
, m_model(new SearchResultTreeModel(this))
|
||||
, m_autoExpandResults(false)
|
||||
{
|
||||
@@ -90,16 +90,6 @@ void SearchResultTreeView::emitJumpToSearchResult(const QModelIndex &index)
|
||||
emit jumpToSearchResult(item);
|
||||
}
|
||||
|
||||
void SearchResultTreeView::keyPressEvent(QKeyEvent *e)
|
||||
{
|
||||
if (!e->modifiers() && e->key() == Qt::Key_Return) {
|
||||
emit activated(currentIndex());
|
||||
e->accept();
|
||||
return;
|
||||
}
|
||||
QTreeView::keyPressEvent(e);
|
||||
}
|
||||
|
||||
SearchResultTreeModel *SearchResultTreeView::model() const
|
||||
{
|
||||
return m_model;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#include "searchresultwindow.h"
|
||||
|
||||
#include <QTreeView>
|
||||
#include <utils/itemviews.h>
|
||||
|
||||
namespace Core {
|
||||
namespace Internal {
|
||||
@@ -40,7 +40,7 @@ namespace Internal {
|
||||
class SearchResultTreeModel;
|
||||
class SearchResultColor;
|
||||
|
||||
class SearchResultTreeView : public QTreeView
|
||||
class SearchResultTreeView : public Utils::TreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -61,8 +61,6 @@ public slots:
|
||||
void emitJumpToSearchResult(const QModelIndex &index);
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *e);
|
||||
|
||||
SearchResultTreeModel *m_model;
|
||||
bool m_autoExpandResults;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user