summaryrefslogtreecommitdiff
blob: c177b28b4c25c020a1893703f4ab400d7f7a342f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
commit 07d20a558da67fb9f849e2b20c52cf275ea01794
Author: Andrea Iacovitti <aiacovitti@libero.it>
Date:   Sat Sep 17 10:12:04 2011 +0200

    -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

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);
             }
         }
     }