forked from qt-creator/qt-creator
Centralize rowCount calculation
Change-Id: I6e159702e533848c9eb9c98551743d5472f2155c Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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,
|
||||
|
@@ -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;
|
||||
|
@@ -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()
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user