Sessions: Make manager usable again... for Linux

With the change that the activated signal switches to the current
session the manager becomes unusable e.g. in Linux/KDE with a single
click policy. This is because you can't select a session by mouse any
more in order to use one of the delete/rename/etc buttons.

Change-Id: I4e81ee21f37fba0b4f456e02e9ce2e9da14c5a88
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Lorenz Haas
2017-03-30 20:51:27 +02:00
parent 4a6d387cb7
commit 4a102213b9
3 changed files with 7 additions and 5 deletions

View File

@@ -53,7 +53,7 @@ void RemoveItemFocusDelegate::paint(QPainter* painter, const QStyleOptionViewIte
}
SessionView::SessionView(QWidget *parent)
: QTreeView(parent)
: Utils::TreeView(parent)
{
setItemDelegate(new RemoveItemFocusDelegate(this));
setSelectionBehavior(QAbstractItemView::SelectRows);
@@ -68,7 +68,7 @@ SessionView::SessionView(QWidget *parent)
selectionModel()->select(firstRow, QItemSelectionModel::QItemSelectionModel::
SelectCurrent);
connect(this, &QTreeView::activated, [this](const QModelIndex &index){
connect(this, &Utils::TreeView::activated, [this](const QModelIndex &index){
emit activated(m_sessionModel.sessionAt(index.row()));
});
connect(selectionModel(), &QItemSelectionModel::currentRowChanged, [this]
@@ -133,7 +133,7 @@ void SessionView::selectSession(const QString &sessionName)
void SessionView::showEvent(QShowEvent *event)
{
QTreeView::showEvent(event);
Utils::TreeView::showEvent(event);
selectActiveSession();
setFocus();
}