QmlProfiler: resetting expanded when data changes

Change-Id: Iaacbe03eecb0679da03006f439e10b1e2dfe9167
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Christiaan Janssen
2013-07-15 16:54:50 +02:00
parent adcb00a4c3
commit cb0ea6407f
12 changed files with 44 additions and 3 deletions

View File

@@ -64,6 +64,7 @@ public:
Q_INVOKABLE qint64 traceDuration() const;
Q_INVOKABLE int getState() const;
Q_INVOKABLE virtual bool expanded(int category) const = 0;
Q_INVOKABLE virtual void setExpanded(int category, bool expanded) = 0;
Q_INVOKABLE virtual int categoryDepth(int categoryIndex) const = 0;
Q_INVOKABLE virtual int categoryCount() const = 0;

View File

@@ -57,6 +57,8 @@ Item {
}
function updateHeight() {
if (expanded != qmlProfilerModelProxy.expanded(modelIndex, categoryIndex))
expanded = qmlProfilerModelProxy.expanded(modelIndex, categoryIndex);
height = root.singleRowHeight * qmlProfilerModelProxy.categoryDepth(modelIndex, categoryIndex);
}

View File

@@ -61,6 +61,7 @@ public:
QVector <PaintEventsModelProxy::QmlPaintEventData> eventList;
int minAnimationCount;
int maxAnimationCount;
bool expanded;
PaintEventsModelProxy *q;
};
@@ -113,6 +114,7 @@ void PaintEventsModelProxy::clear()
d->eventList.clear();
d->minAnimationCount = 1;
d->maxAnimationCount = 1;
d->expanded = false;
}
void PaintEventsModelProxy::dataChanged()
@@ -126,6 +128,7 @@ void PaintEventsModelProxy::dataChanged()
emit stateChanged();
emit dataAvailable();
emit emptyChanged();
emit expandedChanged();
}
bool compareStartTimes(const PaintEventsModelProxy::QmlPaintEventData &t1, const PaintEventsModelProxy::QmlPaintEventData &t2)
@@ -199,10 +202,15 @@ qint64 PaintEventsModelProxy::lastTimeMark() const
return d->eventList.last().startTime + d->eventList.last().duration;
}
bool PaintEventsModelProxy::expanded(int category) const
{
return d->expanded;
}
void PaintEventsModelProxy::setExpanded(int category, bool expanded)
{
Q_UNUSED(category);
Q_UNUSED(expanded);
d->expanded = expanded;
emit expandedChanged();
}

View File

@@ -80,6 +80,7 @@ public:
Q_INVOKABLE qint64 lastTimeMark() const;
Q_INVOKABLE bool expanded(int category) const;
Q_INVOKABLE void setExpanded(int category, bool expanded);
Q_INVOKABLE int categoryDepth(int categoryIndex) const;
Q_INVOKABLE int categoryCount() const;

View File

@@ -135,6 +135,7 @@ void BasicTimelineModel::dataChanged()
emit stateChanged();
emit dataAvailable();
emit emptyChanged();
emit expandedChanged();
}
void BasicTimelineModel::BasicTimelineModelPrivate::prepare()
@@ -393,6 +394,13 @@ qint64 BasicTimelineModel::lastTimeMark() const
return d->startTimeData.last().startTime + d->startTimeData.last().duration;
}
bool BasicTimelineModel::expanded(int category) const
{
if (d->categorySpan.count() <= category)
return false;
return d->categorySpan[category].expanded;
}
void BasicTimelineModel::setExpanded(int category, bool expanded)
{
if (d->categorySpan.count() <= category)

View File

@@ -101,6 +101,7 @@ public:
Q_INVOKABLE qint64 lastTimeMark() const;
Q_INVOKABLE bool expanded(int category) const;
Q_INVOKABLE void setExpanded(int category, bool expanded);
Q_INVOKABLE int categoryDepth(int categoryIndex) const;
Q_INVOKABLE int categoryCount() const;

View File

@@ -176,6 +176,11 @@ qint64 TimelineModelAggregator::lastTimeMark() const
return mark;
}
bool TimelineModelAggregator::expanded(int modelIndex, int category) const
{
return d->modelList[modelIndex]->expanded(category);
}
void TimelineModelAggregator::setExpanded(int modelIndex, int category, bool expanded)
{
// int modelIndex = modelIndexForCategory(category);

View File

@@ -68,6 +68,7 @@ public:
Q_INVOKABLE qint64 lastTimeMark() const;
Q_INVOKABLE bool expanded(int modelIndex, int category) const;
Q_INVOKABLE void setExpanded(int modelIndex, int category, bool expanded);
Q_INVOKABLE int categoryDepth(int modelIndex, int categoryIndex) const;
Q_INVOKABLE int categoryCount(int modelIndex) const;

View File

@@ -101,6 +101,11 @@ qint64 PixmapCacheModel::lastTimeMark() const
return d->eventList.last().startTime;
}
bool PixmapCacheModel::expanded(int category) const
{
return d->isExpanded;
}
void PixmapCacheModel::setExpanded(int category, bool expanded)
{
Q_UNUSED(category);
@@ -467,6 +472,7 @@ void PixmapCacheModel::clear()
d->pixmapSizes.clear();
d->collapsedRowCount = 1;
d->expandedRowCount = 1;
d->isExpanded = false;
}
void PixmapCacheModel::dataChanged()
@@ -480,7 +486,7 @@ void PixmapCacheModel::dataChanged()
emit stateChanged();
emit dataAvailable();
emit emptyChanged();
return;
emit expandedChanged();
}
void PixmapCacheModel::PixmapCacheModelPrivate::computeCacheSizes()

View File

@@ -73,6 +73,7 @@ public:
Q_INVOKABLE qint64 lastTimeMark() const;
Q_INVOKABLE bool expanded(int category) const;
Q_INVOKABLE void setExpanded(int category, bool expanded);
Q_INVOKABLE int categoryDepth(int categoryIndex) const;
Q_INVOKABLE int categoryCount() const;

View File

@@ -109,6 +109,11 @@ qint64 SceneGraphTimelineModel::lastTimeMark() const
return d->eventList.last().startTime;
}
bool SceneGraphTimelineModel::expanded(int category) const
{
return d->isExpanded;
}
void SceneGraphTimelineModel::setExpanded(int category, bool expanded)
{
Q_UNUSED(category);
@@ -462,6 +467,7 @@ void SceneGraphTimelineModel::loadData()
void SceneGraphTimelineModel::clear()
{
d->eventList.clear();
d->isExpanded = false;
}
void SceneGraphTimelineModel::dataChanged()
@@ -475,7 +481,7 @@ void SceneGraphTimelineModel::dataChanged()
emit stateChanged();
emit dataAvailable();
emit emptyChanged();
return;
emit expandedChanged();
}

View File

@@ -61,6 +61,7 @@ public:
Q_INVOKABLE qint64 lastTimeMark() const;
Q_INVOKABLE bool expanded(int category) const;
Q_INVOKABLE void setExpanded(int category, bool expanded);
Q_INVOKABLE int categoryDepth(int categoryIndex) const;
Q_INVOKABLE int categoryCount() const;