diff options
author | Ulf Hermann <ulf.hermann@digia.com> | 2014-09-11 11:02:52 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@digia.com> | 2014-09-15 12:29:20 +0300 |
commit | 2aff8c4ea9a9ec3d22649e1a621ac176c0cbe14d (patch) | |
tree | 711937d6c4100de48d107831227498203dab4c55 | |
parent | 4f0e7208933d502804d070bceec19f6396d931bb (diff) | |
download | qt-creator-2aff8c4ea9a9ec3d22649e1a621ac176c0cbe14d.tar.gz |
Centralize rowCount calculation
Change-Id: I6e159702e533848c9eb9c98551743d5472f2155c
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
6 files changed, 3 insertions, 37 deletions
diff --git a/plugins/qmlprofilerextension/memoryusagemodel.cpp b/plugins/qmlprofilerextension/memoryusagemodel.cpp index 332ad80645..c7fcdcd270 100644 --- a/plugins/qmlprofilerextension/memoryusagemodel.cpp +++ b/plugins/qmlprofilerextension/memoryusagemodel.cpp @@ -52,11 +52,6 @@ quint64 MemoryUsageModel::features() const return (1 << QmlDebug::ProfileMemory) | QmlDebug::Constants::QML_JS_RANGE_FEATURES; } -int MemoryUsageModel::rowCount() const -{ - return isEmpty() ? 1 : 3; -} - int MemoryUsageModel::rowMaxValue(int rowNumber) const { Q_D(const MemoryUsageModel); @@ -263,6 +258,7 @@ void MemoryUsageModel::loadData() computeNesting(); + d->expandedRowCount = d->collapsedRowCount = 3; d->modelManager->modelProxyCountUpdated(d->modelId, 1, 1); } diff --git a/plugins/qmlprofilerextension/memoryusagemodel.h b/plugins/qmlprofilerextension/memoryusagemodel.h index 03eec96f05..7b71b2977e 100644 --- a/plugins/qmlprofilerextension/memoryusagemodel.h +++ b/plugins/qmlprofilerextension/memoryusagemodel.h @@ -51,7 +51,6 @@ public: MemoryUsageModel(QObject *parent = 0); quint64 features() const; - int rowCount() const; int rowMaxValue(int rowNumber) const; int row(int index) const; diff --git a/plugins/qmlprofilerextension/pixmapcachemodel.cpp b/plugins/qmlprofilerextension/pixmapcachemodel.cpp index fff5cab4e0..708c4c2a64 100644 --- a/plugins/qmlprofilerextension/pixmapcachemodel.cpp +++ b/plugins/qmlprofilerextension/pixmapcachemodel.cpp @@ -72,7 +72,6 @@ public: QVector<PixmapCacheEvent> data; QVector<Pixmap> pixmaps; - int collapsedRowCount; qint64 maxCacheSize; private: @@ -85,7 +84,6 @@ PixmapCacheModel::PixmapCacheModel(QObject *parent) QmlDebug::PixmapCacheEvent, QmlDebug::MaximumRangeType, parent) { Q_D(PixmapCacheModel); - d->collapsedRowCount = 1; d->maxCacheSize = 1; } @@ -94,16 +92,6 @@ quint64 PixmapCacheModel::features() const return 1 << QmlDebug::ProfilePixmapCache; } -int PixmapCacheModel::rowCount() const -{ - Q_D(const PixmapCacheModel); - if (isEmpty()) - return 1; - if (d->expanded) - return d->pixmaps.count() + 2; - return d->collapsedRowCount; -} - int PixmapCacheModel::rowMaxValue(int rowNumber) const { Q_D(const PixmapCacheModel); @@ -490,7 +478,6 @@ void PixmapCacheModel::clear() { Q_D(PixmapCacheModel); d->pixmaps.clear(); - d->collapsedRowCount = 1; d->maxCacheSize = 1; d->data.clear(); AbstractTimelineModel::clear(); @@ -548,6 +535,7 @@ void PixmapCacheModel::PixmapCacheModelPrivate::flattenLoads() // Starting from 0, count is maxIndex+1 collapsedRowCount++; + expandedRowCount = pixmaps.count() + 2; } int PixmapCacheModel::PixmapCacheModelPrivate::updateCacheCount(int lastCacheSizeEvent, diff --git a/plugins/qmlprofilerextension/pixmapcachemodel.h b/plugins/qmlprofilerextension/pixmapcachemodel.h index e37997a03c..280667993a 100644 --- a/plugins/qmlprofilerextension/pixmapcachemodel.h +++ b/plugins/qmlprofilerextension/pixmapcachemodel.h @@ -56,7 +56,6 @@ public: PixmapCacheModel(QObject *parent = 0); quint64 features() const; - int rowCount() const; int rowMaxValue(int rowNumber) const; int row(int index) const; diff --git a/plugins/qmlprofilerextension/scenegraphtimelinemodel.cpp b/plugins/qmlprofilerextension/scenegraphtimelinemodel.cpp index 565116d410..3510bdbe3a 100644 --- a/plugins/qmlprofilerextension/scenegraphtimelinemodel.cpp +++ b/plugins/qmlprofilerextension/scenegraphtimelinemodel.cpp @@ -101,8 +101,6 @@ class SceneGraphTimelineModel::SceneGraphTimelineModelPrivate : public AbstractTimelineModel::AbstractTimelineModelPrivate { public: - SceneGraphTimelineModelPrivate(); - int collapsedRowCount; void flattenLoads(); QVector<SceneGraphEvent> data; @@ -110,11 +108,6 @@ private: Q_DECLARE_PUBLIC(SceneGraphTimelineModel) }; -SceneGraphTimelineModel::SceneGraphTimelineModelPrivate::SceneGraphTimelineModelPrivate() : - collapsedRowCount(1) -{ -} - SceneGraphTimelineModel::SceneGraphTimelineModel(QObject *parent) : AbstractTimelineModel(new SceneGraphTimelineModelPrivate, tr(QmlProfilerModelManager::featureName(QmlDebug::ProfileSceneGraph)), @@ -127,14 +120,6 @@ quint64 SceneGraphTimelineModel::features() const return 1 << QmlDebug::ProfileSceneGraph; } -int SceneGraphTimelineModel::rowCount() const -{ - Q_D(const SceneGraphTimelineModel); - if (isEmpty()) - return 1; - return expanded() ? (MaximumSceneGraphStage + 1) : d->collapsedRowCount; -} - int SceneGraphTimelineModel::row(int index) const { Q_D(const SceneGraphTimelineModel); @@ -329,6 +314,7 @@ void SceneGraphTimelineModel::SceneGraphTimelineModelPrivate::flattenLoads() // Starting from 0, count is maxIndex+1 collapsedRowCount++; + expandedRowCount = MaximumSceneGraphStage + 1; } void SceneGraphTimelineModel::clear() diff --git a/plugins/qmlprofilerextension/scenegraphtimelinemodel.h b/plugins/qmlprofilerextension/scenegraphtimelinemodel.h index 0bf3aecd98..0eea81ce22 100644 --- a/plugins/qmlprofilerextension/scenegraphtimelinemodel.h +++ b/plugins/qmlprofilerextension/scenegraphtimelinemodel.h @@ -44,8 +44,6 @@ public: SceneGraphTimelineModel(QObject *parent = 0); quint64 features() const; - int rowCount() const; - int row(int index) const; int eventId(int index) const; QColor color(int index) const; |