PDA

View Full Version : QLineEdit: with builtin clear button, how to



chezifresh
5th May 2009, 02:32
I'm trying to make a filter widget based off a QLineEdit similar to the GtkEntry or iTunes' search bar that has a builtin clear button to clear the text in the widget.

iTunes:
http://www.qtcentre.org/forum/attachment.php?attachmentid=3214&stc=1&d=1241483459

Gtk:
http://www.qtcentre.org/forum/attachment.php?attachmentid=3215&stc=1&d=1241483485

Whats the best way to go about this? Does anyone have something that already does it so I don't need to re-invent the wheel?

chezifresh
5th May 2009, 02:45
Once again I answer my own question.

For those interested labs.trolltech.com has already implemented this for you:

lineedit with a clear button/ (http://labs.trolltech.com/blogs/2007/06/06/lineedit-with-a-clear-button/)

wysota
5th May 2009, 10:19
You may also take a look at wwWidgets (http://www.wysota.eu.org/wwwidgets) that also contain this kind of widget and also allow you to create your own widgets with buttons in different configurations.

chezifresh
5th May 2009, 21:05
Very cool stuff, I wish I had known before I implemented it.

I implemented something thats very similar to the search line edit in firefox: