修改为使用QLinedit输入型号,偏基础移量测试
This commit is contained in:
@@ -52,13 +52,16 @@ public:
|
||||
maxValue = getMax(value, maxValue);
|
||||
minValue = getMin(value, minValue);
|
||||
currentValue = value;
|
||||
if((maxValue - minValue) ==0)
|
||||
if ((maxValue - minValue) == 0)
|
||||
setProgress(1);
|
||||
else if (value == 0)
|
||||
setProgress(0);
|
||||
else
|
||||
setProgress( value/(maxValue - minValue));
|
||||
|
||||
else
|
||||
{
|
||||
double v = (double)((double)(value - minValue) / (double)(maxValue - minValue));
|
||||
setProgress(v);
|
||||
}
|
||||
|
||||
}
|
||||
void setProgress(double newProgress)
|
||||
{
|
||||
@@ -94,17 +97,17 @@ protected:
|
||||
painter.drawText(rect.adjusted(10, 10, -10, 10), Qt::AlignHCenter | Qt::AlignTop, QString::number(currentValue) + "ms");
|
||||
if (maxValue == INT_MIN)
|
||||
painter.drawText(rect.adjusted(10, 10, -10, 10), Qt::AlignRight | Qt::AlignTop, "0ms");
|
||||
else
|
||||
else
|
||||
painter.drawText(rect.adjusted(10, 10, -10, 10), Qt::AlignRight | Qt::AlignTop, QString::number(maxValue) + "ms");
|
||||
|
||||
|
||||
painter.drawText(rect.adjusted(10, 30, -10, -10), Qt::AlignLeft | Qt::AlignTop, "min");
|
||||
painter.drawText(rect.adjusted(10, 30, -10, -10), Qt::AlignLeft | Qt::AlignTop, "Min");
|
||||
painter.drawText(rect.adjusted(10, 30, -10, -10), Qt::AlignHCenter | Qt::AlignTop, title);
|
||||
painter.drawText(rect.adjusted(10, 30, -10, -10), Qt::AlignRight | Qt::AlignTop, "Max");
|
||||
|
||||
int barWidth = rect.width() - 20;
|
||||
int barHeight = 5;
|
||||
QRect barRect(10, rect.height() / 2 - barHeight / 2-5, barWidth, barHeight);
|
||||
QRect barRect(10, rect.height() / 2 - barHeight / 2 - 5, barWidth, barHeight);
|
||||
|
||||
// Draw progress in the bar
|
||||
int progressWidth = static_cast<int>(barRect.width() * progress);
|
||||
@@ -130,7 +133,7 @@ private:
|
||||
bool init = false;
|
||||
QString title;
|
||||
int maxValue = INT_MIN, minValue = INT_MAX, currentValue = 0;
|
||||
int frequency =50;
|
||||
int frequency = 50;
|
||||
double progress;
|
||||
};
|
||||
#pragma once
|
||||
|
||||
Reference in New Issue
Block a user