[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: PATCH:klineedit
From: "Dawit A." <adawit () kde ! org>
Date: 2002-11-14 5:43:22
[Download RAW message or body]
Hi,
The following patch does two things:
- Removed unnecessary variable whose associated code was removed recently.
This is an internal variable and hence is safe from BIC.
- Fix the problem of the line widget not being properly updated when
::setReadOnly is called. To see the effect, compile the unit test and
toggle and untoggle the Read Only button.
Regards,
Dawit A.
["klineedit.diff" (text/x-diff)]
Index: klineedit.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdeui/klineedit.cpp,v
retrieving revision 1.151
diff -u -p -b -B -w -r1.151 klineedit.cpp
--- klineedit.cpp 2002/10/18 12:12:31 1.151
+++ klineedit.cpp 2002/11/14 05:37:09
@@ -49,7 +49,6 @@ public:
{
completionBox = 0L;
handleURLDrops = true;
- smartTextUpdate = false;
grabReturnKeyEvents = false;
}
~KLineEditPrivate()
@@ -60,7 +59,6 @@ public:
int squeezedEnd;
int squeezedStart;
bool handleURLDrops;
- bool smartTextUpdate;
bool grabReturnKeyEvents;
QString squeezedText;
@@ -178,27 +176,33 @@ void KLineEdit::makeCompletion( const QS
void KLineEdit::setReadOnly(bool readOnly)
{
- QPalette p = palette();
+ // Do not do anything if read only does not
+ // require state change...
+ if (readOnly == isReadOnly ())
+ return;
+
+ QLineEdit::setReadOnly (readOnly);
+
if (readOnly)
{
+ setSqueezedText ( text() );
+
+ QPalette p = palette();
QColor color = p.color(QPalette::Disabled, QColorGroup::Background);
p.setColor(QColorGroup::Base, color);
p.setColor(QColorGroup::Background, color);
+ setPalette(p);
}
else
{
- QColor color = p.color(QPalette::Normal, QColorGroup::Base);
- p.setColor(QColorGroup::Base, color);
- p.setColor(QColorGroup::Background, color);
if (!d->squeezedText.isEmpty())
{
setText(d->squeezedText);
d->squeezedText = QString::null;
}
- }
- setPalette(p);
- QLineEdit::setReadOnly (readOnly);
+ unsetPalette ();
+ }
}
void KLineEdit::setSqueezedText( const QString &text)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic