StatusBar in KMainWindow

Andras Mantia amantia at
Thu Mar 13 19:36:51 GMT 2003

Hash: SHA1

On 2003. March 13., Thursday 21:14, Benjamin Meyer wrote:
> On Thursday 13 March 2003 2:05 pm, Andras Mantia wrote:
> > On 2003. March 13., Thursday 20:08, Benjamin Meyer wrote:
> > > What is the difference between take() and remove()?  Again neither one
> > > is documented.
> >
> > In KActionCollection both methods are obsolete.
> oh?  And to think I just documented them.
They are not available when you compile with -DKDE_NO_COMPAT... See the

  KActionCollection( QObject *parent, const char *name = 0, KInstance
*instance = 0 );

  void insert( KAction* );
  void remove( KAction* );
  KAction* take( KAction* );

  KActionCollection operator+ ( const KActionCollection& ) const;
  KActionCollection& operator= ( const KActionCollection& );
  KActionCollection& operator+= ( const KActionCollection& );

public slots:
   * Clears the entire actionCollection, deleting all actions.
   * @see #remove
  void clear();
#endif // !KDE_NO_COMPAT

> What replaces them?
insert(): the KActionCollection *parent attribute in the KAction constructor
take(): no idea, but you can live without it
remove(): delete the KAction...

>> Take()
> actually deletes the KAction, so good thing I didn't call take() before
> delete();
In any case, take() was not designed to delete the KAction. In an old code I
used take() and later insert() and I never noticed that it got deleted. This
is what makes the difference between take() and remove().

> > Ellis told me that it
> > should be enough to use the ctor to add the action to a collection, and
> > delete the action when you wish to remove it.
> Nope as stated above in the thread you have to call unplugAll() before
> delete which is not in the docs.
Ok, but this is another issue. If you wish to remove the KAction from a
KActionCollection, then it's ok to delete it. If you wish to cleanly remove
it from all plugged widgets, then you should call unplugAll() before. This is
recommended anyways, but it's not done in the ~KAction due to performance
reasons (it would make quitting the apps slower).

In Quanta I used extensively insert(), take() and remove(), but now I rewrote
the code, so I don't need them anymore. You can live without them, and your
code may be even cleaner. As I said I haven't saw your patch, but I don't
think it's a good idea to use methods which are not available when you
compile with KDE_NO_COMPAT defined.


> -Benjamin Meyer

- --
Quanta Plus developer -
K Desktop Environment -
Version: GnuPG v1.2.1 (GNU/Linux)


More information about the kde-core-devel mailing list