forked from qt-creator/qt-creator
Add scale to memory usage and pixmap cache models
Change-Id: I69cb67a97b0bb3407f509db01ec2d4b9acd177db Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -54,6 +54,13 @@ int MemoryUsageModel::rowCount() const
|
||||
return isEmpty() ? 1 : 3;
|
||||
}
|
||||
|
||||
int MemoryUsageModel::rowMaxValue(int rowNumber) const
|
||||
{
|
||||
Q_D(const MemoryUsageModel);
|
||||
Q_UNUSED(rowNumber);
|
||||
return d->maxSize;
|
||||
}
|
||||
|
||||
int MemoryUsageModel::getEventRow(int index) const
|
||||
{
|
||||
Q_D(const MemoryUsageModel);
|
||||
@@ -78,7 +85,7 @@ QColor MemoryUsageModel::getColor(int index) const
|
||||
float MemoryUsageModel::getHeight(int index) const
|
||||
{
|
||||
Q_D(const MemoryUsageModel);
|
||||
return qMin(1.0f, (float)d->range(index).size / (float)d->maxSize * 0.85f + 0.15f);
|
||||
return qMin(1.0f, (float)d->range(index).size / (float)d->maxSize);
|
||||
}
|
||||
|
||||
const QVariantList MemoryUsageModel::getLabels() const
|
||||
|
@@ -43,6 +43,7 @@ public:
|
||||
MemoryUsageModel(QObject *parent = 0);
|
||||
|
||||
int rowCount() const;
|
||||
int rowMaxValue(int rowNumber) const;
|
||||
|
||||
int getEventRow(int index) const;
|
||||
int getEventId(int index) const;
|
||||
|
@@ -103,6 +103,16 @@ int PixmapCacheModel::rowCount() const
|
||||
return d->collapsedRowCount;
|
||||
}
|
||||
|
||||
int PixmapCacheModel::rowMaxValue(int rowNumber) const
|
||||
{
|
||||
Q_D(const PixmapCacheModel);
|
||||
if (rowNumber == 1) {
|
||||
return d->maxCacheSize;
|
||||
} else {
|
||||
return AbstractTimelineModel::rowMaxValue(rowNumber);
|
||||
}
|
||||
}
|
||||
|
||||
int PixmapCacheModel::getEventRow(int index) const
|
||||
{
|
||||
Q_D(const PixmapCacheModel);
|
||||
@@ -131,7 +141,7 @@ float PixmapCacheModel::getHeight(int index) const
|
||||
{
|
||||
Q_D(const PixmapCacheModel);
|
||||
if (d->range(index).pixmapEventType == PixmapCacheCountChanged)
|
||||
return 0.15 + (float)d->range(index).cacheSize * 0.85 / (float)d->maxCacheSize;
|
||||
return (float)d->range(index).cacheSize / (float)d->maxCacheSize;
|
||||
else
|
||||
return 1.0f;
|
||||
}
|
||||
|
@@ -56,6 +56,7 @@ public:
|
||||
PixmapCacheModel(QObject *parent = 0);
|
||||
|
||||
int rowCount() const;
|
||||
int rowMaxValue(int rowNumber) const;
|
||||
|
||||
int getEventRow(int index) const;
|
||||
Q_INVOKABLE int getEventId(int index) const;
|
||||
|
Reference in New Issue
Block a user