KToggleAction

KDE 4.5 PyKDE API Reference

- KDE's Python API

# KToggleAction Class Reference

`from PyKDE4.kdeui import *`

Inherits: KAction → QWidgetAction → QAction → QObject
Subclasses: KToggleFullScreenAction, KToggleToolBarAction

## Detailed Description

Checkbox like action.

This action provides two states: checked or not.

## Methods
| __init__ (self, QObject parent)
| __init__ (self, QString text, QObject parent)
| __init__ (self, KIcon icon, QString text, QObject parent)
| setCheckedState (self, KGuiItem checkedItem)
| slotToggled (self, bool checked)

## Method Documentation

__init__ | ( | self, |
|  | QObject | parent
| ) |  |  |

Constructs an action with the specified parent.

Parameters:

  | parent | The action's parent object.

__init__ | ( | self, |
|  | QString | text,
|  | QObject | parent
| ) |  |  |

Constructs an action with text; a shortcut may be specified by the ampersand character (e.g. "&amp;Option" creates a shortcut with key O )

This is the most common KAction used when you do not have a corresponding icon (note that it won't appear in the current version of the "Edit ToolBar" dialog, because an action needs an icon to be plugged in a toolbar...).

Parameters:

  | text | The text that will be displayed.
  | parent | The action's parent object.

__init__ | ( | self, |
|  | KIcon | icon,
|  | QString | text,
|  | QObject | parent
| ) |  |  |

Constructs an action with text and an icon; a shortcut may be specified by the ampersand character (e.g. "&amp;Option" creates a shortcut with key O )

This is the other common KAction used. Use it when you do have a corresponding icon.

Parameters:

  | icon | The icon to display.
  | text | The text that will be displayed.
  | parent | The action's parent object.

setCheckedState | ( | self, |
|  | KGuiItem | checkedItem
| ) |  |  |

Defines the text (and icon, tooltip, whatsthis) that should be displayed instead of the normal text, when the action is checked. Note that this does <em>not</em> replace the check box in front of the menu. So you should not use it to replace the text "Show <foo>" with "Hide <foo>", for example.

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

slotToggled | ( | self, |
|  | bool | checked
| ) |  |  |