41 , m_editable(editable)
42 , m_semiSelected(semiSelected)
45 QHBoxLayout *layout =
new QHBoxLayout(
this);
46 layout->setContentsMargins(8, 0, 0, 0);
47 layout->setSpacing(2);
51 m_textLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
53 layout->insertStretch(2, 1);
59 m_closeIconLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
78 QPainter painter(
this);
80 QColor backGroundColor = qApp->palette().light().color();
81 QColor foregroundColor = qApp->palette().windowText().color();
84 QColor outlineColor = QColor::fromRgb(256*(
r1*backGroundColor.redF() +
r2*foregroundColor.redF()),
85 256*(
r1*backGroundColor.greenF() +
r2*foregroundColor.greenF()),
86 256*(
r1*backGroundColor.blueF() +
r2*foregroundColor.blueF()));
89 QBrush windowB = qApp->palette().window();
90 QBrush windowTextB = qApp->palette().windowText();
92 QWidget::paintEvent(event);
93 painter.setRenderHint(QPainter::Antialiasing);
95 path.addRoundedRect(this->
rect(), 6, 6);
98 painter.fillPath(path, qApp->palette().light());
102 QPen penwt = QPen(outlineColor, 1);
103 penwt.setStyle(Qt::DashLine);
105 QPainterPath outlinePath;
106 outlinePath.addRoundedRect(this->
rect().adjusted(1, 1, -1, -1), 4, 4);
108 painter.setPen(penwt);
109 painter.drawPath(outlinePath);
115 : QToolButton(parent),
116 m_createNew(createNew)
118 setPopupMode(QToolButton::InstantPopup);
120 setToolTip(i18n(
"Assign to tag"));
121 setContentsMargins(0, 0, 0, 0);
122 QSize defaultSize = QSize(1, 1)*
m_size;
123 setMinimumSize(defaultSize);
124 setMaximumSize(defaultSize);
135 m_noTags =
new QAction(
"No tags present");
137 font.setItalic(
true);
222 QPainter painter(
this);
223 painter.setRenderHint(QPainter::Antialiasing);
225 path.addRoundedRect(this->
rect(), 6, 6);
226 painter.fillPath(path, qApp->palette().light());
227 painter.setPen(QPen(qApp->palette().windowText(), painter.pen().widthF()));
228 QIcon icon = this->icon();
229 QSize size = this->
rect().size()*0.6;
231 QSize
iconSize = icon.actualSize(size);
232 QPixmap pix = icon.pixmap(
iconSize);
235 QPointF
p = this->
rect().topLeft() + QPointF(this->
rect().width()/2 - realSize.width()/2 - hack, this->rect().height()/2 - realSize.height()/2 - hack);
236 painter.setOpacity(!isEnabled() ? 0.3 : 1.0);
237 painter.drawPixmap(
p, pix);
238 painter.setOpacity(1.0);