Centralize rowCount calculation

Change-Id: I6e159702e533848c9eb9c98551743d5472f2155c
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Ulf Hermann
2014-09-11 11:02:52 +02:00
parent 4f0e720893
commit 2aff8c4ea9
6 changed files with 3 additions and 37 deletions
@@ -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()