# kdeui Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# KToggleAction Class Reference

Checkbox like action. More...

`#include <kactionclasses.h>`

Inheritance diagram for KToggleAction:

[legend]
Collaboration diagram for KToggleAction:

[legend]
List of all members.

## Public Slots

virtual void | setChecked (bool)

## Signals

void | toggled (bool)

## Public Member Functions

| KToggleAction (const QString &text, const KShortcut &cut=KShortcut(), QObject *parent=0, const char *name=0)
| KToggleAction (const QString &text, const KShortcut &cut, const QObject *receiver, const char *slot, QObject *parent, const char *name=0)
| KToggleAction (const QString &text, const QIconSet &pix, const KShortcut &cut=KShortcut(), QObject *parent=0, const char *name=0)
| KToggleAction (const QString &text, const QString &pix, const KShortcut &cut=KShortcut(), QObject *parent=0, const char *name=0)
| KToggleAction (const QString &text, const QIconSet &pix, const KShortcut &cut, const QObject *receiver, const char *slot, QObject *parent, const char *name=0)
| KToggleAction (const QString &text, const QString &pix, const KShortcut &cut, const QObject *receiver, const char *slot, QObject *parent, const char *name=0)
| KToggleAction (QObject *parent=0, const char *name=0)
virtual | ~KToggleAction ()
virtual int | plug (QWidget *widget, int index=-1)
bool | isChecked () const
QString | exclusiveGroup () const
virtual void | setExclusiveGroup (const QString &name)
void | setCheckedState (const KGuiItem &checkedItem)
virtual QString | toolTip () const

## Protected Slots

virtual void | slotActivated ()

## Protected Member Functions

virtual void | updateChecked (int id)
virtual void | virtual_hook (int id, void *data)

## Properties

bool | checked
QString | exclusiveGroup

## Detailed Description

Checkbox like action.

Checkbox like action.

This action provides two states: checked or not.

Definition at line 68 of file kactionclasses.h.

## Constructor & Destructor Documentation

KToggleAction::KToggleAction | ( | const QString & | text,
|  | const KShortcut & | cut = `KShortcut()`,
|  | QObject * | parent = `0`,
|  | const char * | name = `0`
| ) |

Constructs a toggle action with text and potential keyboard accelerator but nothing else.

Use this only if you really know what you are doing.

Parameters:

  | text | The text that will be displayed.
  | cut | The corresponding keyboard accelerator (shortcut).
  | parent | This action's parent.
  | name | An internal name for this action.

Definition at line 70 of file kactionclasses.cpp.

KToggleAction::KToggleAction | ( | const QString & | text,
|  | const KShortcut & | cut,
|  | const QObject * | receiver,
|  | const char * | slot,
|  | QObject * | parent,
|  | const char * | name = `0`
| ) |

Parameters:

  | text | The text that will be displayed.
  | cut | The corresponding keyboard accelerator (shortcut).
  | receiver | The SLOT's parent.
  | slot | The SLOT to invoke to execute this action.
  | parent | This action's parent.
  | name | An internal name for this action.

Definition at line 78 of file kactionclasses.cpp.

KToggleAction::KToggleAction | ( | const QString & | text,
|  | const QIconSet & | pix,
|  | const KShortcut & | cut = `KShortcut()`,
|  | QObject * | parent = `0`,
|  | const char * | name = `0`
| ) |

Parameters:

  | text | The text that will be displayed.
  | pix | The icons that go with this action.
  | cut | The corresponding keyboard accelerator (shortcut).
  | parent | This action's parent.
  | name | An internal name for this action.

Definition at line 86 of file kactionclasses.cpp.

KToggleAction::KToggleAction | ( | const QString & | text,
|  | const QString & | pix,
|  | const KShortcut & | cut = `KShortcut()`,
|  | QObject * | parent = `0`,
|  | const char * | name = `0`
| ) |

Parameters:

  | text | The text that will be displayed.
  | pix | The dynamically loaded icon that goes with this action.
  | cut | The corresponding keyboard accelerator (shortcut).
  | parent | This action's parent.
  | name | An internal name for this action.

Definition at line 94 of file kactionclasses.cpp.

KToggleAction::KToggleAction | ( | const QString & | text,
|  | const QIconSet & | pix,
|  | const KShortcut & | cut,
|  | const QObject * | receiver,
|  | const char * | slot,
|  | QObject * | parent,
|  | const char * | name = `0`
| ) |

Parameters:

  | text | The text that will be displayed.
  | pix | The icons that go with this action.
  | cut | The corresponding keyboard accelerator (shortcut).
  | receiver | The SLOT's parent.
  | slot | The SLOT to invoke to execute this action.
  | parent | This action's parent.
  | name | An internal name for this action.

Definition at line 102 of file kactionclasses.cpp.

KToggleAction::KToggleAction | ( | const QString & | text,
|  | const QString & | pix,
|  | const KShortcut & | cut,
|  | const QObject * | receiver,
|  | const char * | slot,
|  | QObject * | parent,
|  | const char * | name = `0`
| ) |

Parameters:

  | text | The text that will be displayed.
  | pix | The dynamically loaded icon that goes with this action.
  | cut | The corresponding keyboard accelerator (shortcut).
  | receiver | The SLOT's parent.
  | slot | The SLOT to invoke to execute this action.
  | parent | This action's parent.
  | name | An internal name for this action.

Definition at line 112 of file kactionclasses.cpp.

KToggleAction::KToggleAction | ( | QObject * | parent = `0`,
|  | const char * | name = `0`
| ) |

Parameters:

  | parent | This action's parent.
  | name | An internal name for this action.

Definition at line 122 of file kactionclasses.cpp.

KToggleAction::~KToggleAction | ( |  | ) | `[virtual]`

| Destructor. Definition at line 128 of file kactionclasses.cpp.

## Member Function Documentation

int KToggleAction::plug | ( | QWidget * | widget,
|  | int | index = `-1`
| ) | `[virtual]`

"Plug" or insert this action into a given widget.

This will typically be a menu or a toolbar. From this point on, you will never need to directly manipulate the item in the menu or toolbar. You do all enabling/disabling/manipulation directly with your KToggleAction object.

Parameters:

  | widget | The GUI element to display this action.
  | index | The index of the item.

Reimplemented from KAction.

Reimplemented in KToggleToolBarAction.

Definition at line 134 of file kactionclasses.cpp.

References endl(), isChecked(), kdWarning(), KAction::plug(), KToolBar::setButton(), and KToolBar::setToggle().

Referenced by KToggleToolBarAction::plug().

bool KToggleAction::isChecked | ( |  | ) | const

| Returns the actual state of the action. Definition at line 234 of file kactionclasses.cpp. Referenced by plug(), and setChecked().

QString KToggleAction::exclusiveGroup | ( |  | ) | const

Returns:
  which "exclusive group" this action is part of.

See also:
  setExclusiveGroup

Referenced by setChecked().

void KToggleAction::setExclusiveGroup | ( | const QString & | name | ) | `[virtual]`

| Defines which "exclusive group" this action is part of. In a given exclusive group, only one toggle action can be checked at a any moment. Checking an action unchecks the other actions of the group. Definition at line 239 of file kactionclasses.cpp.

void KToggleAction::setCheckedState | ( | const KGuiItem & | checkedItem | ) |

Defines the text (and icon, tooltip, whatsthis) that should be displayed instead of the normal text, when the action is checked.

This feature replaces the checkmark that usually appears in front of the text, in menus. It is useful when the text is mainly a verb: e.g. "Show <foo>" should turn into "Hide <foo>" when activated.

If hasIcon(), the icon is kept for the 'checked state', unless `checkedItem` defines an icon explicitely. Same thing for tooltip and whatsthis.

Since:
  3.3

Definition at line 249 of file kactionclasses.cpp.

Referenced by KStdAction::showMenubar(), and KStdAction::showStatusbar().

QString KToggleAction::toolTip | ( |  | ) | const`[virtual]`

| Reimplemented for internal reasons. Reimplemented from KAction. Definition at line 255 of file kactionclasses.cpp. References KAction::toolTip().

void KToggleAction::setChecked | ( | bool |  | ) | `[virtual, slot]`

Sets the state of the action.

Reimplemented in KToggleToolBarAction, and KToggleFullScreenAction.

Definition at line 161 of file kactionclasses.cpp.

References exclusiveGroup(), isChecked(), QObject::parent(), and toggled().

Referenced by KStdAction::create(), KToggleFullScreenAction::setChecked(), KToggleToolBarAction::setChecked(), KStdAction::showMenubar(), KStdAction::showStatusbar(), and KStdAction::showToolbar().

The documentation for this class was generated from the following files:

- kactionclasses.h
- kactionclasses.cpp

This file is part of the documentation for kdeui Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:22:31 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003