[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Clearing a QLineEdit
From:       Steven Sroka <sroka.steven () gmail ! com>
Date:       2011-06-20 21:44:41
Message-ID: BANLkTinmwosvH=hfa5MsGfWep2GObbbkSg () mail ! gmail ! com
[Download RAW message or body]

>On 20 June 2011 01:41, Parker Coates <parker.coates@kdemail.net> wrote:
> On Mon, Jun 20, 2011 at 00:14, Steven Sroka wrote:
>> Hi everyone,
>>
>> Does anyone know how to clear the contents of a QLineEdit when a user
>> sets focus to it (ie. clicks it, presses the tab key repeatedly,
>> etc.)?
>
> Subclass KLineEdit (which you`re using instead of QLineWidget, right?)
> and reimplement focusInEvent() to call clear().
>
> But why are you trying to do this? In general it seems like a bad
> idea. If it`s to implement some kind of instructional message, see
> QLineEdit::setPlaceholderText() or KLineEdit::setClickMessage().

This is exactly what I need. Thank you.

Do you know how to centre the ClickMessage text? If I set the
alignment of the text, only the text that the user types in is aligned
and not the ClickMessage text.

>
> Parker
>
>>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
>
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic