summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Iacovitti <aiacovitti@libero.it>2011-09-17 08:12:04 (GMT)
committerAndrea Iacovitti <aiacovitti@libero.it>2011-09-17 08:12:04 (GMT)
commit07d20a558da67fb9f849e2b20c52cf275ea01794 (patch)
treeae5ec589a7816615d2bc1e6b76205f3676be2c65
parent24d7e18682e25fc8657980ac5521d8dea23fd293 (diff)
-Do not set WA_OpaquePaintEvent attribute for line edit clearButton
(should fix the not transparent background bug) -Optimize a bit the code to enable/disable it BUG: 230024 CCBUG: 280226 FIXED-IN: 4.7.2
-rw-r--r--kdeui/widgets/klineedit.cpp1
-rw-r--r--khtml/khtmlview.cpp7
-rw-r--r--khtml/rendering/render_form.cpp15
3 files changed, 14 insertions, 9 deletions
diff --git a/kdeui/widgets/klineedit.cpp b/kdeui/widgets/klineedit.cpp
index 715e182..c919b99 100644
--- a/kdeui/widgets/klineedit.cpp
+++ b/kdeui/widgets/klineedit.cpp
@@ -291,6 +291,7 @@ void KLineEdit::setClearButtonShown(bool show)
}
d->clearButton = new KLineEditButton(this);
+ d->clearButton->setObjectName("KLineEditButton");
d->clearButton->setCursor( Qt::ArrowCursor );
d->clearButton->setToolTip( i18nc( "@action:button Clear current text in the line edit", "Clear text" ) );
diff --git a/khtml/khtmlview.cpp b/khtml/khtmlview.cpp
index 1db9b1a..28dbac3 100644
--- a/khtml/khtmlview.cpp
+++ b/khtml/khtmlview.cpp
@@ -1363,7 +1363,7 @@ void KHTMLView::mouseMoveEvent( QMouseEvent * _mouse )
if (kw && kw->m_kwp->isRedirected())
setCursor = false;
else if (QLineEdit* le = qobject_cast<QLineEdit*>(rw->widget())) {
- QList<QWidget*> wl = qFindChildren<QWidget *>( le, "KHTMLLineEditButton" );
+ QList<QWidget*> wl = qFindChildren<QWidget *>( le, "KLineEditButton" );
// force arrow cursor above lineedit clear button
foreach (QWidget*w, wl) {
if (w->underMouse()) {
@@ -1942,7 +1942,10 @@ static void handleWidget(QWidget* w, KHTMLView* view, bool recurse=true)
w->setAttribute( Qt::WA_NoSystemBackground );
w->setAttribute(Qt::WA_WState_InPaintEvent);
- w->setAttribute(Qt::WA_OpaquePaintEvent);
+
+ if (!(w->objectName() == "KLineEditButton"))
+ w->setAttribute(Qt::WA_OpaquePaintEvent);
+
w->installEventFilter(view);
if (!recurse)
diff --git a/khtml/rendering/render_form.cpp b/khtml/rendering/render_form.cpp
index 845db1a..3302920 100644
--- a/khtml/rendering/render_form.cpp
+++ b/khtml/rendering/render_form.cpp
@@ -1044,20 +1044,21 @@ void RenderLineEdit::setStyle(RenderStyle* _style)
RenderFormElement::setStyle( _style );
widget()->setAlignment(textAlignment());
+
bool showClearButton = (!shouldDisableNativeBorders() && !_style->hasBackgroundImage());
- widget()->setClearButtonShown( showClearButton );
- if (showClearButton) {
+
+ if (!showClearButton && widget()->isClearButtonShown()) {
+ widget()->setClearButtonShown(false);
+ }
+ else if (showClearButton && !widget()->isClearButtonShown()) {
+ widget()->setClearButtonShown(true);
QObjectList children = widget()->children();
foreach (QObject* object, children) {
QWidget *w = qobject_cast<QWidget*>(object);
- if (w && !w->isWindow()) {
+ if (w && !w->isWindow() && (w->objectName() == "KLineEditButton")) {
// this duplicates KHTMLView's handleWidget but this widget
// is created on demand, so it might not be here at ChildPolished time
- w->setObjectName("KHTMLLineEditButton");
w->installEventFilter(view());
- w->setAttribute(Qt::WA_NoSystemBackground);
- w->setAttribute(Qt::WA_WState_InPaintEvent);
- w->setAttribute(Qt::WA_OpaquePaintEvent);
}
}
}