Bug 193045

Summary: KLineEdit clear button isn't shown properly if text was set in constructor
Product: [Frameworks and Libraries] kdelibs Reporter: Danilo Luvizotto <danilo.luvizotto>
Component: kdeuiAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: andresbajotierra, frank78ac
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:

Description Danilo Luvizotto 2009-05-17 21:17:42 UTC
Version:           4.2.3 (using KDE 4.2.3)
OS:                Linux
Installed from:    SuSE RPMs

The clear button isn't show properly with this code:
  KLineEdit* textBox = new KLineEdit( i18n("Some text"), parent );
  textBox->setClearButtonShown(true);
But it is shown properly with this code:
  KLineEdit* textBox = new KLineEdit( parent );
  textBox->setClearButtonShown(true);
  textBox->setText( i18n("Some text") );
Comment 1 Dario Andres 2009-06-16 01:03:40 UTC
Here using:

Qt: 4.5.1 (qt-copy  971295)
KDE: 4.2.91 (KDE 4.2.91 (KDE 4.3 >= 20090609))
kdelibs svn rev. 982117 / kdebase svn rev. 982118
on ArchLinux i686 - Kernel 2.6.29.4

I can confirm this bug
Comment 2 Dario Andres 2009-06-16 01:19:22 UTC
SVN commit 982488 by darioandres:

--
When a KLineEdit is initialized with no text in the constructor, 
the KLineEditButton::animateVisible function is first called with false
(animate to invisible), and the direction is set to Backward

When a text is set by code or by typing, animateVisible is called with true
and the button is properly shown.

However, when text is set on constructor of KLineEdit, the first animateVisible
call with false will not be done, but the one with true will do.
And it will return without showing the clear button because:
m_timeline->direction() == QTimeLine::Forward (as set by constructor)
--

Initialize KLineEditButton::m_timeLine as Backward will fix this issue, avoiding
the need of the animateVisible(false) call for this widget to work.

However, the button should have a better state of "I'm visible" to avoid
calling to "animate to invisible" at first time, when the button isn't even shown.

BUG: 193045



 M  +1 -1      klineedit_p.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=982488
Comment 3 Danilo Luvizotto 2009-06-16 01:41:53 UTC
thank you very much
Comment 4 Frank Reininghaus 2011-03-19 14:18:04 UTC
Unfortunately, it looks like the bug is back: bug 268898.