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;
|
return (1 << QmlDebug::ProfileMemory) | QmlDebug::Constants::QML_JS_RANGE_FEATURES;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MemoryUsageModel::rowCount() const
|
|
||||||
{
|
|
||||||
return isEmpty() ? 1 : 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
int MemoryUsageModel::rowMaxValue(int rowNumber) const
|
int MemoryUsageModel::rowMaxValue(int rowNumber) const
|
||||||
{
|
{
|
||||||
Q_D(const MemoryUsageModel);
|
Q_D(const MemoryUsageModel);
|
||||||
@@ -263,6 +258,7 @@ void MemoryUsageModel::loadData()
|
|||||||
|
|
||||||
|
|
||||||
computeNesting();
|
computeNesting();
|
||||||
|
d->expandedRowCount = d->collapsedRowCount = 3;
|
||||||
d->modelManager->modelProxyCountUpdated(d->modelId, 1, 1);
|
d->modelManager->modelProxyCountUpdated(d->modelId, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -51,7 +51,6 @@ public:
|
|||||||
MemoryUsageModel(QObject *parent = 0);
|
MemoryUsageModel(QObject *parent = 0);
|
||||||
quint64 features() const;
|
quint64 features() const;
|
||||||
|
|
||||||
int rowCount() const;
|
|
||||||
int rowMaxValue(int rowNumber) const;
|
int rowMaxValue(int rowNumber) const;
|
||||||
|
|
||||||
int row(int index) const;
|
int row(int index) const;
|
||||||
|
@@ -72,7 +72,6 @@ public:
|
|||||||
|
|
||||||
QVector<PixmapCacheEvent> data;
|
QVector<PixmapCacheEvent> data;
|
||||||
QVector<Pixmap> pixmaps;
|
QVector<Pixmap> pixmaps;
|
||||||
int collapsedRowCount;
|
|
||||||
|
|
||||||
qint64 maxCacheSize;
|
qint64 maxCacheSize;
|
||||||
private:
|
private:
|
||||||
@@ -85,7 +84,6 @@ PixmapCacheModel::PixmapCacheModel(QObject *parent)
|
|||||||
QmlDebug::PixmapCacheEvent, QmlDebug::MaximumRangeType, parent)
|
QmlDebug::PixmapCacheEvent, QmlDebug::MaximumRangeType, parent)
|
||||||
{
|
{
|
||||||
Q_D(PixmapCacheModel);
|
Q_D(PixmapCacheModel);
|
||||||
d->collapsedRowCount = 1;
|
|
||||||
d->maxCacheSize = 1;
|
d->maxCacheSize = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,16 +92,6 @@ quint64 PixmapCacheModel::features() const
|
|||||||
return 1 << QmlDebug::ProfilePixmapCache;
|
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
|
int PixmapCacheModel::rowMaxValue(int rowNumber) const
|
||||||
{
|
{
|
||||||
Q_D(const PixmapCacheModel);
|
Q_D(const PixmapCacheModel);
|
||||||
@@ -490,7 +478,6 @@ void PixmapCacheModel::clear()
|
|||||||
{
|
{
|
||||||
Q_D(PixmapCacheModel);
|
Q_D(PixmapCacheModel);
|
||||||
d->pixmaps.clear();
|
d->pixmaps.clear();
|
||||||
d->collapsedRowCount = 1;
|
|
||||||
d->maxCacheSize = 1;
|
d->maxCacheSize = 1;
|
||||||
d->data.clear();
|
d->data.clear();
|
||||||
AbstractTimelineModel::clear();
|
AbstractTimelineModel::clear();
|
||||||
@@ -548,6 +535,7 @@ void PixmapCacheModel::PixmapCacheModelPrivate::flattenLoads()
|
|||||||
|
|
||||||
// Starting from 0, count is maxIndex+1
|
// Starting from 0, count is maxIndex+1
|
||||||
collapsedRowCount++;
|
collapsedRowCount++;
|
||||||
|
expandedRowCount = pixmaps.count() + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PixmapCacheModel::PixmapCacheModelPrivate::updateCacheCount(int lastCacheSizeEvent,
|
int PixmapCacheModel::PixmapCacheModelPrivate::updateCacheCount(int lastCacheSizeEvent,
|
||||||
|
@@ -56,7 +56,6 @@ public:
|
|||||||
PixmapCacheModel(QObject *parent = 0);
|
PixmapCacheModel(QObject *parent = 0);
|
||||||
quint64 features() const;
|
quint64 features() const;
|
||||||
|
|
||||||
int rowCount() const;
|
|
||||||
int rowMaxValue(int rowNumber) const;
|
int rowMaxValue(int rowNumber) const;
|
||||||
|
|
||||||
int row(int index) const;
|
int row(int index) const;
|
||||||
|
@@ -101,8 +101,6 @@ class SceneGraphTimelineModel::SceneGraphTimelineModelPrivate :
|
|||||||
public AbstractTimelineModel::AbstractTimelineModelPrivate
|
public AbstractTimelineModel::AbstractTimelineModelPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SceneGraphTimelineModelPrivate();
|
|
||||||
int collapsedRowCount;
|
|
||||||
void flattenLoads();
|
void flattenLoads();
|
||||||
|
|
||||||
QVector<SceneGraphEvent> data;
|
QVector<SceneGraphEvent> data;
|
||||||
@@ -110,11 +108,6 @@ private:
|
|||||||
Q_DECLARE_PUBLIC(SceneGraphTimelineModel)
|
Q_DECLARE_PUBLIC(SceneGraphTimelineModel)
|
||||||
};
|
};
|
||||||
|
|
||||||
SceneGraphTimelineModel::SceneGraphTimelineModelPrivate::SceneGraphTimelineModelPrivate() :
|
|
||||||
collapsedRowCount(1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
SceneGraphTimelineModel::SceneGraphTimelineModel(QObject *parent)
|
SceneGraphTimelineModel::SceneGraphTimelineModel(QObject *parent)
|
||||||
: AbstractTimelineModel(new SceneGraphTimelineModelPrivate,
|
: AbstractTimelineModel(new SceneGraphTimelineModelPrivate,
|
||||||
tr(QmlProfilerModelManager::featureName(QmlDebug::ProfileSceneGraph)),
|
tr(QmlProfilerModelManager::featureName(QmlDebug::ProfileSceneGraph)),
|
||||||
@@ -127,14 +120,6 @@ quint64 SceneGraphTimelineModel::features() const
|
|||||||
return 1 << QmlDebug::ProfileSceneGraph;
|
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
|
int SceneGraphTimelineModel::row(int index) const
|
||||||
{
|
{
|
||||||
Q_D(const SceneGraphTimelineModel);
|
Q_D(const SceneGraphTimelineModel);
|
||||||
@@ -329,6 +314,7 @@ void SceneGraphTimelineModel::SceneGraphTimelineModelPrivate::flattenLoads()
|
|||||||
|
|
||||||
// Starting from 0, count is maxIndex+1
|
// Starting from 0, count is maxIndex+1
|
||||||
collapsedRowCount++;
|
collapsedRowCount++;
|
||||||
|
expandedRowCount = MaximumSceneGraphStage + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneGraphTimelineModel::clear()
|
void SceneGraphTimelineModel::clear()
|
||||||
|
@@ -44,8 +44,6 @@ public:
|
|||||||
SceneGraphTimelineModel(QObject *parent = 0);
|
SceneGraphTimelineModel(QObject *parent = 0);
|
||||||
quint64 features() const;
|
quint64 features() const;
|
||||||
|
|
||||||
int rowCount() const;
|
|
||||||
|
|
||||||
int row(int index) const;
|
int row(int index) const;
|
||||||
int eventId(int index) const;
|
int eventId(int index) const;
|
||||||
QColor color(int index) const;
|
QColor color(int index) const;
|
||||||
|
Reference in New Issue
Block a user