32 #include <QPropertyAnimation>
37 setCursor(Qt::ArrowCursor);
41 QPainter painter(
this);
44 QIcon::Mode state = QIcon::Disabled;
46 state = isDown() ? QIcon::Selected : QIcon::Normal;
49 QRect pixmapRect = QRect(0, 0, iconpixmap.width(), iconpixmap.height());
50 pixmapRect.moveCenter(rect().center());
52 painter.drawPixmap(pixmapRect, iconpixmap);
58 QPropertyAnimation *animation =
new QPropertyAnimation(
this,
"fader");
59 animation->setDuration(160);
60 animation->setEndValue(1.0);
61 animation->start(QAbstractAnimation::DeleteWhenStopped);
63 QPropertyAnimation *animation =
new QPropertyAnimation(
this,
"fader");
64 animation->setDuration(160);
65 animation->setEndValue(0.0);
66 animation->start(QAbstractAnimation::DeleteWhenStopped);
79 if (style()->inherits(
"OxygenStyle")) {
80 wsize = wsize.expandedTo(QSize(24, 0));
84 QMargins margins = textMargins();
85 if (layoutDirection() == Qt::LeftToRight)
86 margins.setRight(wsize.width());
88 margins.setLeft(wsize.width());
90 setTextMargins(margins);
95 QIcon icon = QIcon::fromTheme(layoutDirection() == Qt::LeftToRight ?
96 QLatin1String(
"edit-clear-locationbar-rtl") :
97 QLatin1String(
"edit-clear-locationbar-ltr"),
98 QIcon::fromTheme(
"edit-clear",
99 QIcon(
":/icons/edit-clear-filter.png")));
103 connect(
_resetButton, SIGNAL(clicked()),
this, SLOT(clear()));
104 connect(
this, SIGNAL(textChanged(QString)),
this, SLOT(
checkButton(QString)));
109 if (
_oldText.isEmpty() || txt.isEmpty())
116 QRect contentRect = rect();
117 if (layoutDirection() == Qt::LeftToRight) {
118 const int iconoffset = textMargins().right() + 4;
119 _resetButton->setGeometry(contentRect.adjusted(width() - iconoffset, 0, 0, 0));
121 const int iconoffset = textMargins().left() + 4;
122 _resetButton->setGeometry(contentRect.adjusted(0, 0, -width() + iconoffset, 0));