diff options
author | Christiaan Janssen <christiaan.janssen@digia.com> | 2013-07-15 16:54:50 +0200 |
---|---|---|
committer | Christiaan Janssen <christiaan.janssen@digia.com> | 2013-08-06 15:58:34 +0300 |
commit | cb0ea6407fcac53f02be726476ad8fd43c32a208 (patch) | |
tree | f334717440411a29db1023414f398045fbdd0bc7 | |
parent | adcb00a4c36bdaea8ec73d3784e0a617bf615127 (diff) |
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>
12 files changed, 44 insertions, 3 deletions
diff --git a/plugins/qmlprofiler/abstracttimelinemodel.h b/plugins/qmlprofiler/abstracttimelinemodel.h index 2eecdeef54..eb7d7e9a44 100644 --- a/plugins/qmlprofiler/abstracttimelinemodel.h +++ b/plugins/qmlprofiler/abstracttimelinemodel.h @@ -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; diff --git a/plugins/qmlprofiler/qml/Label.qml b/plugins/qmlprofiler/qml/Label.qml index 5c0ac3ca60..afc96b92f1 100644 --- a/plugins/qmlprofiler/qml/Label.qml +++ b/plugins/qmlprofiler/qml/Label.qml @@ -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); } diff --git a/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp b/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp index 7457e33dc8..9002d93608 100644 --- a/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp +++ b/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.cpp @@ -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(); } diff --git a/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h b/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h index 677c5e5c17..eaf8e96664 100644 --- a/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h +++ b/plugins/qmlprofiler/qmlprofilerpainteventsmodelproxy.h @@ -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; diff --git a/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp b/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp index 3984b25c44..9e8da0251b 100644 --- a/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp +++ b/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.cpp @@ -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) diff --git a/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h b/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h index a8e6f08aa2..0a57541f8f 100644 --- a/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h +++ b/plugins/qmlprofiler/qmlprofilertimelinemodelproxy.h @@ -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; diff --git a/plugins/qmlprofiler/timelinemodelaggregator.cpp b/plugins/qmlprofiler/timelinemodelaggregator.cpp index 89f04d8daa..727b4ce23b 100644 --- a/plugins/qmlprofiler/timelinemodelaggregator.cpp +++ b/plugins/qmlprofiler/timelinemodelaggregator.cpp @@ -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); diff --git a/plugins/qmlprofiler/timelinemodelaggregator.h b/plugins/qmlprofiler/timelinemodelaggregator.h index 9c15f362b3..65dd3496c6 100644 --- a/plugins/qmlprofiler/timelinemodelaggregator.h +++ b/plugins/qmlprofiler/timelinemodelaggregator.h @@ -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; diff --git a/plugins/qmlprofilerextension/pixmapcachemodel.cpp b/plugins/qmlprofilerextension/pixmapcachemodel.cpp index db8cd938be..5f6c58784e 100644 --- a/plugins/qmlprofilerextension/pixmapcachemodel.cpp +++ b/plugins/qmlprofilerextension/pixmapcachemodel.cpp @@ -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() diff --git a/plugins/qmlprofilerextension/pixmapcachemodel.h b/plugins/qmlprofilerextension/pixmapcachemodel.h index 8fd38bb378..9b006e49ce 100644 --- a/plugins/qmlprofilerextension/pixmapcachemodel.h +++ b/plugins/qmlprofilerextension/pixmapcachemodel.h @@ -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; diff --git a/plugins/qmlprofilerextension/scenegraphtimelinemodel.cpp b/plugins/qmlprofilerextension/scenegraphtimelinemodel.cpp index bcca3987e7..ccde555093 100644 --- a/plugins/qmlprofilerextension/scenegraphtimelinemodel.cpp +++ b/plugins/qmlprofilerextension/scenegraphtimelinemodel.cpp @@ -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(); } diff --git a/plugins/qmlprofilerextension/scenegraphtimelinemodel.h b/plugins/qmlprofilerextension/scenegraphtimelinemodel.h index 83812643a3..ae8d14eb11 100644 --- a/plugins/qmlprofilerextension/scenegraphtimelinemodel.h +++ b/plugins/qmlprofilerextension/scenegraphtimelinemodel.h @@ -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; |