summaryrefslogtreecommitdiffstats
path: root/statuslabel.cpp
blob: a885be8a34c4d2aaf5591bb5c39c78165baa325f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "statuslabel.h"
#include <QStyle>
#include <QLabel>
#include <QHBoxLayout>

StatusLabel::StatusLabel(const QString &text, QWidget *parent) :
		QWidget(parent)
{
	QHBoxLayout *layout = new QHBoxLayout;
	m_pixmap = new QLabel;
	setCompleted(false);
	layout->addWidget(m_pixmap);
	layout->addWidget(new QLabel(text));
	setLayout(layout);
	setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
}
void StatusLabel::setCompleted(bool complete)
{
	if (complete)
		m_pixmap->setPixmap(style()->standardIcon(QStyle::SP_DialogApplyButton).pixmap(QSize(16, 16)));
	else
		m_pixmap->setPixmap(style()->standardIcon(QStyle::SP_DialogCancelButton).pixmap(QSize(16, 16)));
}