23 #include "iconlabel.h" 25 IconLabel::IconLabel(QWidget *pParent)
28 lblIcon =
new QLabel(
this);
29 lblIcon->setPixmap(QPixmap(
":/icons/help"));
30 lblIcon->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
32 lblText =
new QLabel(
this);
33 lblText->setText(
"TextLabel");
35 pLayout =
new QHBoxLayout(
this);
36 pLayout->addWidget(lblIcon);
37 pLayout->addWidget(lblText);
38 pLayout->setContentsMargins(0, 0, 0, 0);
40 this->setLayout(pLayout);
41 this->setContentsMargins(0, 0, 0, 0);
44 const QPixmap *IconLabel::pixmap()
const 46 return lblIcon->pixmap();
49 QString IconLabel::text()
const 51 return lblText->text();
54 void IconLabel::setPixmap(
const QPixmap &pixmap)
56 lblIcon->setPixmap(pixmap);
59 void IconLabel::setText(
const QString &str)
61 lblText->setText(str);
64 void IconLabel::setWordWrap(
bool wrap)
66 lblText->setWordWrap(wrap);