KApplication::cut()....

Scott Wheeler wheeler at kde.org
Fri Sep 23 19:36:23 BST 2005


On Friday 23 September 2005 18:26, David Faure wrote:
>
> But then I need a "void reallyClear() { KListView::clear(); }" method if I
> want to programmatically clear the listview?
>
> I don't think this action makes much sense at all. Do we really have apps
> with e.g. only lineedits and Edit/Clear to clear the selected lineedit? If
> we do have one or two like that, isn't it simpler to just qobject_cast
> focusWidget() to a qlineedit and call clear()?
> I can't think of a good use case for "clear any widget" when there are
> multiple kinds of widgets in use.

I'm naturally biased since I wrote this code, but I use it for lineedits, 
comboboxes, textboxes, and yes, listviews.

Semantically it works out pretty well because you can say, "If you provide a 
clear() implementation then it will be called."  The primary ambiguity comes 
in where clear() actually isn't what you would expect in the GUI -- but 
really I don't think that's true for anything but the list-ish classes.

In my case for my listview classes I override clear to clear the selected 
items and it works quite well.

-Scott

-- 
I mean, if 10 years from now, when you are doing something quick and dirty, 
you suddenly visualize that I am looking over your shoulders and say to 
yourself, "Dijkstra would not have liked this", well that would be enough 
immortality for me.
-E. W. Dijkstra




More information about the kde-core-devel mailing list