QmlJS: Fix focus handling in QML/JS console

We want the line editor to be focused by default when the console is
opened either by mouse or by keyboard interaction.

Change-Id: Ic366d1ac5f1306c0739c334584568402969895f3
Task-number: QTCREATORBUG-14931
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2015-10-28 13:32:53 +01:00
parent d8d7acbe75
commit 19ab78865c
3 changed files with 15 additions and 5 deletions

View File

@@ -164,9 +164,6 @@ void QmlConsoleView::mousePressEvent(QMouseEvent *event)
}
if (!handled)
Utils::TreeView::mousePressEvent(event);
} else {
selectionModel()->setCurrentIndex(model()->index(model()->rowCount() - 1, 0),
QItemSelectionModel::ClearAndSelect);
}
}
@@ -216,6 +213,13 @@ void QmlConsoleView::contextMenuEvent(QContextMenuEvent *event)
}
}
void QmlConsoleView::focusInEvent(QFocusEvent *event)
{
Q_UNUSED(event);
selectionModel()->setCurrentIndex(model()->index(model()->rowCount() - 1, 0),
QItemSelectionModel::ClearAndSelect);
}
void QmlConsoleView::onRowActivated(const QModelIndex &index)
{
if (!index.isValid())