TodoView: Make behavior consistent with other views

Use double click on double click platforms.

Change-Id: I4ad6436dd56f370961db6a4bb8fcf788bd0cd579
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Daniel Teske
2014-04-09 17:07:17 +02:00
parent 920127933b
commit 921bf4b861
3 changed files with 4 additions and 17 deletions

View File

@@ -182,7 +182,7 @@ void TodoOutputPane::createTreeView()
m_todoTreeView = new TodoOutputTreeView(); m_todoTreeView = new TodoOutputTreeView();
m_todoTreeView->setModel(m_todoItemsModel); m_todoTreeView->setModel(m_todoItemsModel);
connect(m_todoTreeView, SIGNAL(clicked(QModelIndex)), SLOT(todoTreeViewClicked(QModelIndex))); connect(m_todoTreeView, SIGNAL(activated(QModelIndex)), SLOT(todoTreeViewClicked(QModelIndex)));
} }
void TodoOutputPane::freeTreeView() void TodoOutputPane::freeTreeView()

View File

@@ -40,7 +40,7 @@ namespace Todo {
namespace Internal { namespace Internal {
TodoOutputTreeView::TodoOutputTreeView(QWidget *parent) : TodoOutputTreeView::TodoOutputTreeView(QWidget *parent) :
QTreeView(parent), Utils::TreeView(parent),
m_textColumnDefaultWidth(0), m_textColumnDefaultWidth(0),
m_fileColumnDefaultWidth(0) m_fileColumnDefaultWidth(0)
{ {
@@ -105,18 +105,6 @@ void TodoOutputTreeView::resizeEvent(QResizeEvent *event)
setColumnWidth(Constants::OUTPUT_COLUMN_FILE, widthFile); setColumnWidth(Constants::OUTPUT_COLUMN_FILE, widthFile);
} }
void TodoOutputTreeView::keyPressEvent(QKeyEvent *e)
{
if (!e->modifiers()
&& (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter)
&& currentIndex().isValid()) {
emit clicked(currentIndex());
e->accept();
return;
}
QTreeView::keyPressEvent(e);
}
void TodoOutputTreeView::todoColumnResized(int column, int oldSize, int newSize) void TodoOutputTreeView::todoColumnResized(int column, int oldSize, int newSize)
{ {
Q_UNUSED(oldSize); Q_UNUSED(oldSize);

View File

@@ -30,12 +30,12 @@
#ifndef TODO_INTERNAL_TODOOUTPUTTREEVIEW_H #ifndef TODO_INTERNAL_TODOOUTPUTTREEVIEW_H
#define TODO_INTERNAL_TODOOUTPUTTREEVIEW_H #define TODO_INTERNAL_TODOOUTPUTTREEVIEW_H
#include <QTreeView> #include <utils/itemviews.h>
namespace Todo { namespace Todo {
namespace Internal { namespace Internal {
class TodoOutputTreeView : public QTreeView class TodoOutputTreeView : public Utils::TreeView
{ {
Q_OBJECT Q_OBJECT
public: public:
@@ -43,7 +43,6 @@ public:
~TodoOutputTreeView(); ~TodoOutputTreeView();
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event);
void keyPressEvent(QKeyEvent *e);
private slots: private slots:
void todoColumnResized(int column, int oldSize, int newSize); void todoColumnResized(int column, int oldSize, int newSize);