forked from qt-creator/qt-creator
Debugger: Work on WatchModel performance
Don't instantiate repeating boilerplate item data in some cases (such as large arrays). This makes it necessary to access parent WatchItems in a lot more cases than before and needs another separation of WatchItem/WatchModel code to keep the dumper autotests in a functional state. For a plain std::vector<int> with 1 mio items this reduces extraction time from more than 2 minutes to about 3 seconds. Change-Id: I175c5f6ee90434a6e85342d8bb71bd10a04dd271 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com> Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
@@ -193,11 +193,11 @@ void DraggableLabel::mouseMoveEvent(QMouseEvent * event)
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class ToolTipWatchItem : public Utils::TreeItem
|
||||
class ToolTipWatchItem : public TreeItem
|
||||
{
|
||||
public:
|
||||
ToolTipWatchItem() : expandable(false) {}
|
||||
ToolTipWatchItem(WatchItem *item);
|
||||
ToolTipWatchItem(TreeItem *item);
|
||||
|
||||
bool hasChildren() const { return expandable; }
|
||||
bool canFetchMore() const { return childCount() == 0 && expandable && model(); }
|
||||
@@ -214,17 +214,19 @@ public:
|
||||
QByteArray iname;
|
||||
};
|
||||
|
||||
ToolTipWatchItem::ToolTipWatchItem(WatchItem *item)
|
||||
ToolTipWatchItem::ToolTipWatchItem(TreeItem *item)
|
||||
{
|
||||
name = item->displayName();
|
||||
value = item->displayValue();
|
||||
type = item->displayType();
|
||||
iname = item->iname;
|
||||
valueColor = item->valueColor(1);
|
||||
const TreeModel *model = item->model();
|
||||
QModelIndex idx = model->indexForItem(item);
|
||||
name = model->data(idx.sibling(idx.row(), 0), Qt::DisplayRole).toString();
|
||||
value = model->data(idx.sibling(idx.row(), 1), Qt::DisplayRole).toString();
|
||||
type = model->data(idx.sibling(idx.row(), 2), Qt::DisplayRole).toString();
|
||||
iname = model->data(idx.sibling(idx.row(), 0), LocalsINameRole).toByteArray();
|
||||
valueColor = model->data(idx.sibling(idx.row(), 1), Qt::ForegroundRole).value<QColor>();
|
||||
expandable = item->hasChildren();
|
||||
expression = item->expression();
|
||||
expression = model->data(idx.sibling(idx.row(), 0), Qt::EditRole).toString();
|
||||
foreach (TreeItem *child, item->children())
|
||||
appendChild(new ToolTipWatchItem(static_cast<WatchItem *>(child)));
|
||||
appendChild(new ToolTipWatchItem(child));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
@@ -1175,7 +1177,7 @@ static void slotTooltipOverrideRequested
|
||||
purgeClosedToolTips();
|
||||
|
||||
// Prefer a filter on an existing local variable if it can be found.
|
||||
const WatchData *localVariable = engine->watchHandler()->findCppLocalVariable(context.expression);
|
||||
const WatchItem *localVariable = engine->watchHandler()->findCppLocalVariable(context.expression);
|
||||
if (localVariable) {
|
||||
context.expression = QLatin1String(localVariable->exp);
|
||||
if (context.expression.isEmpty())
|
||||
|
||||
Reference in New Issue
Block a user