Use time formatting method of base class instead of reimplementing it

Change-Id: I81da4ec2a7830f3a3ddfb85ceeffdaeca20c3c6d
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Ulf Hermann
2014-02-14 17:02:56 +01:00
parent f70e8c6464
commit 86b3da7cd2
2 changed files with 2 additions and 26 deletions

View File

@@ -46,7 +46,6 @@ public:
bool isExpanded;
int expandedRowCount;
int collapsedRowCount;
QString displayTime(double time);
void addVP(QVariantList &l, QString label, qint64 time);
qint64 minCacheSize;
@@ -231,21 +230,11 @@ const QVariantList PixmapCacheModel::getLabelsForCategory(int category) const
return result;
}
QString PixmapCacheModel::PixmapCacheModelPrivate::displayTime(double time)
{
if (time < 1e6)
return QString::number(time/1e3,'f',3) + trUtf8(" \xc2\xb5s");
if (time < 1e9)
return QString::number(time/1e6,'f',3) + tr(" ms");
return QString::number(time/1e9,'f',3) + tr(" s");
}
void PixmapCacheModel::PixmapCacheModelPrivate::addVP(QVariantList &l, QString label, qint64 time)
{
if (time > 0) {
QVariantMap res;
res.insert(label, QVariant(displayTime(time)));
res.insert(label, QVariant(QmlProfilerSimpleModel::formatTime(time)));
l << res;
}
}

View File

@@ -59,7 +59,6 @@ public:
SceneGraphTimelineModel *q;
bool isExpanded;
QString displayTime(double time);
void addVP(QVariantList &l, QString label, qint64 time);
};
@@ -223,23 +222,11 @@ const QVariantList SceneGraphTimelineModel::getLabelsForCategory(int category) c
return result;
}
QString SceneGraphTimelineModel::SceneGraphTimelineModelPrivate::displayTime(double time)
{
if (time < 1e6)
return QString::number(time/1e3,'f',3) + trUtf8(" \xc2\xb5s");
if (time < 1e9)
return QString::number(time/1e6,'f',3) + tr(" ms");
return QString::number(time/1e9,'f',3) + tr(" s");
}
void SceneGraphTimelineModel::SceneGraphTimelineModelPrivate::addVP(QVariantList &l, QString label, qint64 time)
{
if (time > 0) {
QVariantMap res;
res.insert(label, QVariant(displayTime(time)));
res.insert(label, QVariant(QmlProfilerSimpleModel::formatTime(time)));
l << res;
}
}