#include "progress.h"
#include "trace.h"
-Progress::Progress(QWidget *parent): QLabel(parent), progress(-1.0), timer(-1)
+Progress::Progress(QWidget *parent):
+ QLabel(parent), progress(-1.0), timer(-1), mThickness(15)
{
hide();
}
void Progress::setProgress(qreal p)
{
- Trace t("Progress::setProgress");
+ TRACE;
qDebug() << p;
if (progress != p) {
progress = p;
painter.setBrush(QBrush(QColor(100, 100, 100, 177)));
painter.setPen(Qt::NoPen);
int w = int(width() * progress);
- int h = height();
- painter.drawRect(0, 0, w, h);
+ painter.drawRect(0, 0, w, mThickness);
painter.setBrush(QBrush(QColor(100, 100, 100, 50)));
- painter.drawRect(w, 0, width(), h);
+ painter.drawRect(w, 0, width() - w, mThickness);
}
void Progress::flash()
{
if (e->timerId() == timer) {
killTimer(timer);
+ timer = -1;
hide();
}
+ QLabel::timerEvent(e);
+}
+
+int Progress::thickness() const
+{
+ return mThickness;
}