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

List:       kde-core-devel
Subject:    Re: KApplication::cut()....
From:       David Faure <faure () kde ! org>
Date:       2005-09-23 16:26:12
Message-ID: 200509231826.13320.faure () kde ! org
[Download RAW message or body]

On Friday 23 September 2005 17:32, Benjamin Meyer wrote:
> +    /**
> +     * If the widget with focus provides a clear() slot, call that slot.  

OK...

> +     * Thus for a 
> +     * simple application clear() can be implemented as:
> +     * \code
> +     * new KAction( i18n( "Clear" ), "editclear", 0, this, SLOT( clear() ), \
> actionCollection(), "clear" ); +     * \endcode

Huh? This is not the implementation of clear(), it's the implementation of \
createAutomaticClearAction, isn't it? Isn't it confusing to show the code that the \
user of this method does NOT need to write?

> +     * Note that for some widgets, this may not provide the intended bahavior.  \
> For +     * example if you make use of the code above and a KListView has the \
> focus, clear() +     * will clear all of the items in the list.  

Well, that's why I don't get the point of this action at all....

> If this is not the intened behavior 
> +     * and you want to make use of this slot, you can subclass KListView and \
> reimplement +     * this slot.  For example the following code would implement a \
> KListView without this +     * behavior:
> +     *
> +     * \code
> +     * class MyListView : public KListView {
> +     *   Q_OBJECT
> +     * public:
> +     *   MyListView( QWidget * parent = 0, const char * name = 0, WFlags f = 0 ) : \
> KListView( parent, name, f ) {} +     *   virtual ~MyListView() {}
> +     * public slots:
> +     *   virtual void clear() {}

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.

> +     */
> +    KAction *createAutomaticClearAction(KActionCollection *collection) const;
> +

-- 
David Faure, faure@kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).


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

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