kdeui Library API Documentation

KActionCollection Class Reference

A managed set of KAction objects. More...

#include <kactioncollection.h>

Inheritance diagram for KActionCollection:

QObject List of all members.

Public Slots

void clear ()

Signals

void inserted (KAction *)
void removed (KAction *)
void actionHighlighted (KAction *action)
void actionHighlighted (KAction *action, bool highlight)
void actionStatusText (const QString &text)
void clearStatusText ()

Public Methods

 KActionCollection (QWidget *parent, const char *name=0, KInstance *instance=0)
 KActionCollection (QWidget *watch, QObject *parent, const char *name=0, KInstance *instance=0)
 KActionCollection (const KActionCollection &copy)
virtual ~KActionCollection ()
virtual void setWidget (QWidget *widget)
void setAutoConnectShortcuts (bool)
bool isAutoConnectShortcuts ()
bool addDocCollection (KActionCollection *pDoc)
virtual KAccelaccel () KDE_DEPRECATED
virtual const KAccelaccel () const KDE_DEPRECATED
KAccelkaccel ()
const KAccelkaccel () const
KAccelbuilderKAccel () const
virtual uint count () const
bool isEmpty () const
virtual KActionaction (int index) const
virtual KActionaction (const char *name, const char *classname=0) const
virtual QStringList groups () const
virtual KActionPtrList actions (const QString &group) const
virtual KActionPtrList actions () const
bool readShortcutSettings (const QString &sConfigGroup=QString::null, KConfigBase *pConfig=0)
bool writeShortcutSettings (const QString &sConfigGroup=QString::null, KConfigBase *pConfig=0) const
void setInstance (KInstance *instance)
KInstanceinstance () const
void setXMLFile (const QString &)
const QStringxmlFile () const
void setHighlightingEnabled (bool enable)
bool highlightingEnabled () const
void connectHighlight (QWidget *container, KAction *action)
void disconnectHighlight (QWidget *container, KAction *action)
 KActionCollection (QObject *parent, const char *name=0, KInstance *instance=0)
void insert (KAction *action)
void remove (KAction *action)
KActiontake (KAction *action)
KActionCollection operator+ (const KActionCollection &) const
KActionCollection & operator= (const KActionCollection &)
KActionCollection & operator+= (const KActionCollection &)

Protected Methods

virtual void virtual_hook (int id, void *data)

Friends

class KAction
class KXMLGUIClient

Detailed Description

A managed set of KAction objects.

Definition at line 64 of file kactioncollection.h.


Constructor & Destructor Documentation

KActionCollection::KActionCollection QWidget   watch,
QObject   parent,
const char *    name = 0,
KInstance   instance = 0
 

Use this constructor if you want the collection's actions to restrict their accelerator keys to watch rather than the parent.

If you don't require shortcuts, you can pass a null to the watch parameter.

Definition at line 87 of file kactioncollection.cpp.

References instance(), KNotifyClient::instance(), QObject::name(), and setWidget().


Member Function Documentation

void KActionCollection::setWidget QWidget   widget [virtual]
 

This sets the widget to which the keyboard shortcuts should be attached.

You only need to call this if a null pointer was passed in the constructor.

Definition at line 137 of file kactioncollection.cpp.

Referenced by KActionCollection().

void KActionCollection::setAutoConnectShortcuts bool   
 

This indicates whether new actions which are created in this collection should have their keyboard shortcuts automatically connected on construction.

Set to 'false' if you will be loading XML-based settings. This is automatically done by KParts. The default is 'true'.

See also:
isAutoConnectShortcuts()

Definition at line 152 of file kactioncollection.cpp.

bool KActionCollection::isAutoConnectShortcuts  
 

This indicates whether new actions which are created in this collection have their keyboard shortcuts automatically connected on construction.

See also:
setAutoConnectShortcuts()

Definition at line 157 of file kactioncollection.cpp.

bool KActionCollection::addDocCollection KActionCollection *    pDoc
 

Doc/View model.

This lets you add the action collection of a document to a view's action collection.

Definition at line 162 of file kactioncollection.cpp.

KAccel * KActionCollection::accel   [virtual]
 

Deprecated:
Deprecated because of ambiguous name. Use kaccel()

Definition at line 354 of file kactioncollection.cpp.

References kaccel().

const KAccel * KActionCollection::accel   const [virtual]
 

Deprecated:
Deprecated because of ambiguous name. Use kaccel()

Definition at line 355 of file kactioncollection.cpp.

References kaccel().

KAccel * KActionCollection::kaccel  
 

Returns the KAccel object of the most recently set widget.

Definition at line 267 of file kactioncollection.cpp.

Referenced by accel().

const KAccel * KActionCollection::kaccel   const
 

Returns the KAccel object of the most recently set widget.

Const version for convenience.

Definition at line 276 of file kactioncollection.cpp.

uint KActionCollection::count   const [virtual]
 

Returns the number of actions in the collection.

Definition at line 403 of file kactioncollection.cpp.

KAction * KActionCollection::action int    index const [virtual]
 

Return the KAction* at position "index" in the action collection.

See also:
count()

Definition at line 385 of file kactioncollection.cpp.

References QAsciiDictIterator::current().

Referenced by KXMLGUIClient::action(), and KXMLGUIClient::stateChanged().

KAction * KActionCollection::action const char *    name,
const char *    classname = 0
const [virtual]
 

Find an action (optionally, of a given subclass of KAction) in the action collection.

Parameters:
name  Name of the KAction.
classname  Name of the KAction subclass.
Returns:
A pointer to the first KAction in the collection which matches the parameters or null if nothing matches.

Definition at line 358 of file kactioncollection.cpp.

References QAsciiDictIterator::current(), and QObject::name().

QStringList KActionCollection::groups   const [virtual]
 

Returns a list of all the groups of all the KActions in this action collection.

See also:
KAction::group() , KAction::setGroup()

Definition at line 408 of file kactioncollection.cpp.

References QAsciiDictIterator::current().

KActionPtrList KActionCollection::actions const QString   group const [virtual]
 

Returns the list of actions in a particular managed by this action collection.

Parameters:
group  The name of the group.

Definition at line 420 of file kactioncollection.cpp.

References QValueList< KAction * >::append(), QAsciiDictIterator::current(), and QString::isEmpty().

KActionPtrList KActionCollection::actions   const [virtual]
 

Returns the list of actions managed by this action collection.

Definition at line 434 of file kactioncollection.cpp.

References QValueList< KAction * >::append(), and QAsciiDictIterator::current().

bool KActionCollection::readShortcutSettings const QString   sConfigGroup = QString::null,
KConfigBase   pConfig = 0
 

Used for reading shortcut configuration from a non-XML rc file.

Definition at line 393 of file kactioncollection.cpp.

bool KActionCollection::writeShortcutSettings const QString   sConfigGroup = QString::null,
KConfigBase   pConfig = 0
const
 

Used for writing shortcut configuration to a non-XML rc file.

Definition at line 398 of file kactioncollection.cpp.

KInstance * KActionCollection::instance   const
 

The instance with which this class is associated.

Definition at line 453 of file kactioncollection.cpp.

Referenced by KKeyChooser::insert(), KActionCollection(), KPasteTextAction::plug(), KToolBarPopupAction::plug(), KActionMenu::plug(), KRecentFilesAction::plug(), and KAction::plug().

void KActionCollection::setXMLFile const QString  
 

Use this to tell the KActionCollection what rc file its configuration is stored in.

Definition at line 458 of file kactioncollection.cpp.

Referenced by KXMLGUIClient::setXMLFile().

const QString & KActionCollection::xmlFile   const
 

The rc file in which the current configuration is stored.

Definition at line 463 of file kactioncollection.cpp.

void KActionCollection::setHighlightingEnabled bool    enable
 

Enable highlighting notification for specific KActions.

See also:
connectHighlight() , disconnectHighlight() , actionHighlighted() , actionHighlighted() , highlightingEnabled()

Definition at line 468 of file kactioncollection.cpp.

bool KActionCollection::highlightingEnabled   const
 

Return whether highlighting notifications are enabled.

See also:
connectHighlight() , disconnectHighlight() , actionHighlighted() , setHighlightingEnabled() , actionHighlighted()

Definition at line 473 of file kactioncollection.cpp.

void KActionCollection::connectHighlight QWidget   container,
KAction   action
 

Call this function if you want to receive a signal whenever a KAction is highlighted in a menu or a toolbar.

Parameters:
container  A container in which the KAction is plugged (must inherit QPopupMenu or KToolBar)
action  The action you are interested in
See also:
disconnectHighlight() , actionHighlighted() , setHighlightingEnabled() , highlightingEnabled() , actionHighlighted()

Definition at line 478 of file kactioncollection.cpp.

References QPtrList::append(), QObject::connect(), and QObject::destroyed().

Referenced by KActionMenu::plug(), and KAction::plug().

void KActionCollection::disconnectHighlight QWidget   container,
KAction   action
 

Disconnect highlight notifications for a particular pair of contianer and action.

Parameters:
container  A container in which the KAction is plugged (must inherit QPopupMenu or KToolBar)
action  The action you are interested in
See also:
connectHighlight() , actionHighlighted() , setHighlightingEnabled() , highlightingEnabled() , actionHighlighted()

Definition at line 511 of file kactioncollection.cpp.

References QPtrList::count(), and QPtrList::removeRef().

Referenced by KAction::unplug().

void KActionCollection::actionHighlighted KAction   action [signal]
 

Emitted when "action" is highlighted.

See also:
connectHighlight() , disconnectHighlight() , actionHighlighted() , setHighlightingEnabled() , highlightingEnabled()

void KActionCollection::actionHighlighted KAction   action,
bool    highlight
[signal]
 

Emitted when "action" is highlighed or loses highlighting.

See also:
connectHighlight() , disconnectHighlight() , actionHighlighted() , setHighlightingEnabled() , highlightingEnabled()

void KActionCollection::insert KAction   action
 

Add an action to the collection.

Generally you don't have to call this. The action inserts itself automatically into its parent collection. This can be useful however for a short-lived collection (e.g. for a popupmenu, where the signals from the collection are needed too). (don't forget that in the simple case, a list of actions should be a simple KActionPtrList). If you manually insert actions into a 2nd collection, don't forget to take them out again before destroying the collection.

Parameters:
action  The KAction to add.

Definition at line 350 of file kactioncollection.cpp.

void KActionCollection::remove KAction   action
 

Removes an action from the collection and deletes it.

Since the KAction destructor removes the action from the collection, you generally don't have to call this.

Parameters:
action  The KAction to remove.

Definition at line 351 of file kactioncollection.cpp.

KAction * KActionCollection::take KAction   action
 

Removes an action from the collection.

Since the KAction destructor removes the action from the collection, you generally don't have to call this.

Returns:
NULL if not found else returns action.
Parameters:
action  the KAction to remove.

Definition at line 352 of file kactioncollection.cpp.

Referenced by KAction::~KAction().

void KActionCollection::clear   [slot]
 

Clears the entire actionCollection, deleting all actions.

See also:
remove

Definition at line 353 of file kactioncollection.cpp.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdeui Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun May 16 22:02:13 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003