diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-08-21 17:33:53 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-08-25 14:42:22 +0000 |
commit | b5717a5315fb40b03f3d0b6b274a563381eb1ec0 (patch) | |
tree | 10b5a2b9984d70701795688211c1e7a793218fb8 /src/plugins/qmljstools/qmlconsoleview.cpp | |
parent | 0b3283281292848fe2bdab376ebc9ef8518ad265 (diff) | |
download | qt-creator-b5717a5315fb40b03f3d0b6b274a563381eb1ec0.tar.gz |
QmlJS: Lazy-load console items to allow for recursion
Using Utils:TreeView automatically gives us the capability for loading
item as they are expanded. This way we can show recursive structure in
the console as well as load data from the debug server on demand.
Also, properly print error messages received from unsuccessful
command evaluations.
Task-number: QTCREATORBUG-14931
Change-Id: I66d440eedd9723b04670169b27db1ee18f3f2891
Reviewed-by: hjk <hjk@theqtcompany.com>
Diffstat (limited to 'src/plugins/qmljstools/qmlconsoleview.cpp')
-rw-r--r-- | src/plugins/qmljstools/qmlconsoleview.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/plugins/qmljstools/qmlconsoleview.cpp b/src/plugins/qmljstools/qmlconsoleview.cpp index ee374f0f00..5c0f054a42 100644 --- a/src/plugins/qmljstools/qmlconsoleview.cpp +++ b/src/plugins/qmljstools/qmlconsoleview.cpp @@ -147,9 +147,9 @@ void QmlConsoleView::mousePressEvent(QMouseEvent *event) QModelIndex index = indexAt(pos); if (index.isValid()) { ConsoleItem::ItemType type = (ConsoleItem::ItemType)index.data( - QmlConsoleItemModel::TypeRole).toInt(); + ConsoleItem::TypeRole).toInt(); bool handled = false; - if (type == ConsoleItem::UndefinedType) { + if (type == ConsoleItem::DefaultType) { bool showTypeIcon = index.parent() == QModelIndex(); ConsoleItemPositions positions(visualRect(index), viewOptions().font, showTypeIcon, true); @@ -222,14 +222,14 @@ void QmlConsoleView::onRowActivated(const QModelIndex &index) return; // See if we have file and line Info - QString filePath = model()->data(index, QmlConsoleItemModel::FileRole).toString(); + QString filePath = model()->data(index, ConsoleItem::FileRole).toString(); const QUrl fileUrl = QUrl(filePath); if (fileUrl.isLocalFile()) filePath = fileUrl.toLocalFile(); if (!filePath.isEmpty()) { QFileInfo fi(filePath); if (fi.exists() && fi.isFile() && fi.isReadable()) { - int line = model()->data(index, QmlConsoleItemModel::LineRole).toInt(); + int line = model()->data(index, ConsoleItem::LineRole).toInt(); Core::EditorManager::openEditorAt(fi.canonicalFilePath(), line); } } @@ -240,15 +240,15 @@ void QmlConsoleView::copyToClipboard(const QModelIndex &index) if (!index.isValid()) return; - QString contents = model()->data(index, QmlConsoleItemModel::ExpressionRole).toString(); + QString contents = model()->data(index, ConsoleItem::ExpressionRole).toString(); // See if we have file and line Info - QString filePath = model()->data(index, QmlConsoleItemModel::FileRole).toString(); + QString filePath = model()->data(index, ConsoleItem::FileRole).toString(); const QUrl fileUrl = QUrl(filePath); if (fileUrl.isLocalFile()) filePath = fileUrl.toLocalFile(); if (!filePath.isEmpty()) { contents = QString::fromLatin1("%1 %2: %3").arg(contents).arg(filePath).arg( - model()->data(index, QmlConsoleItemModel::LineRole).toString()); + model()->data(index, ConsoleItem::LineRole).toString()); } QClipboard *cb = QApplication::clipboard(); cb->setText(contents); @@ -260,7 +260,7 @@ bool QmlConsoleView::canShowItemInTextEditor(const QModelIndex &index) return false; // See if we have file and line Info - QString filePath = model()->data(index, QmlConsoleItemModel::FileRole).toString(); + QString filePath = model()->data(index, ConsoleItem::FileRole).toString(); const QUrl fileUrl = QUrl(filePath); if (fileUrl.isLocalFile()) filePath = fileUrl.toLocalFile(); |