diff options
Diffstat (limited to 'statuslabel.cpp')
-rw-r--r-- | statuslabel.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/statuslabel.cpp b/statuslabel.cpp new file mode 100644 index 0000000..8312caa --- /dev/null +++ b/statuslabel.cpp @@ -0,0 +1,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::Maximum); +} +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))); +} |