41 , m_editable(editable)
42 , m_semiSelected(semiSelected)
45 QHBoxLayout *layout =
new QHBoxLayout(
this);
46 layout->setContentsMargins(4, 0, 1, 0);
47 layout->setSpacing(2);
51 m_textLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
59 m_closeIconLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
69 layout->setContentsMargins(4, 2, 4, 2);
81 QPainter painter(
this);
83 QColor backGroundColor = qApp->palette().light().color();
84 QColor foregroundColor = qApp->palette().windowText().color();
87 QColor outlineColor = QColor::fromRgb(256*(
r1*backGroundColor.redF() +
r2*foregroundColor.redF()),
88 256*(
r1*backGroundColor.greenF() +
r2*foregroundColor.greenF()),
89 256*(
r1*backGroundColor.blueF() +
r2*foregroundColor.blueF()));
92 QBrush windowB = qApp->palette().window();
93 QBrush windowTextB = qApp->palette().windowText();
95 QWidget::paintEvent(event);
96 painter.setRenderHint(QPainter::Antialiasing);
98 path.addRoundedRect(this->
rect(), 6, 6);
101 painter.fillPath(path, qApp->palette().light());
105 QPen penwt = QPen(outlineColor, 1);
106 penwt.setStyle(Qt::DashLine);
108 QPainterPath outlinePath;
109 outlinePath.addRoundedRect(this->
rect().adjusted(1, 1, -1, -1), 4, 4);
111 painter.setPen(penwt);
112 painter.drawPath(outlinePath);
118 : QToolButton(parent),
119 m_createNew(createNew)
121 setPopupMode(QToolButton::InstantPopup);
123 setToolTip(i18n(
"Assign to tag"));
124 setContentsMargins(0, 0, 0, 0);
125 QSize defaultSize = QSize(1, 1)*
m_size;
126 setMinimumSize(defaultSize);
127 setMaximumSize(defaultSize);
129 connect(
this, SIGNAL(triggered(QAction*)), SLOT(
slotAddNewTag(QAction*)));
135 connect(newTag, SIGNAL(triggered(QString)),
this, SLOT(
slotCreateNewTag(QString)), Qt::UniqueConnection);
138 m_noTags =
new QAction(
"No tags present");
140 font.setItalic(
true);
225 QPainter painter(
this);
226 painter.setRenderHint(QPainter::Antialiasing);
228 path.addRoundedRect(this->
rect(), 6, 6);
229 painter.fillPath(path, qApp->palette().light());
232 painter.setPen(QPen(qApp->palette().windowText(), painter.pen().widthF()));
233 QIcon icon = this->icon();
234 QSize size = this->
rect().size()*0.65;
236 QSize
iconSize = icon.actualSize(size);
237 QPixmap pix = icon.pixmap(
iconSize);
239 QPointF
p = this->
rect().topLeft() + QPointF(this->
rect().width() - realSize.width(), this->rect().height() - realSize.height()) / 2;
241 painter.setOpacity(!isEnabled() ? 0.3 : 1.0);
242 painter.drawPixmap(
p, pix);
243 painter.setOpacity(1.0);