KDE 4.5 PyKDE API Reference

- KDE's Python API

# KActionCategory Class Reference

`from PyKDE4.kdeui import *`

Inherits: QObject

## Detailed Description

Categorize actions for KShortcutsEditor.

KActionCategory provides a second level to organize the actions in KShortcutsEditor.

The first possibility is using more than one action collection. Each actions collection becomes a top level node.

+ action collection 1 + first action + second action + third action + action collection 2 + first action + second action + third action

Using KActionCategory it's possible to group the actions of one collection. + action collection 1 + first action + first category + action 1 in category + action 2 in category + second action

Usage

The usage is analog to action collections. Just create a category and use it instead of the collection to create the actions.

The synchronization between KActionCollection and KActionCategory is done internally. There is for example no need to remove actions from a category. It is done implicitely if the action is removed from the associated collection.

     KActionCategory *file = new KActionCategory(i18n("File"), actionCollection());
     file->addAction(
          KStandardAction.New,   //< see KStandardAction
          this,                   //< Receiver
          SLOT(fileNew()));       //< SLOT

     ... more actions added to file ...

     KActionCategory *edit = new KActionCategory(i18n("Edit"), actionCollection());
     edit->addAction(
          KStandardAction.Copy,  //< see KStandardAction
          this,                   //< Receiver
          SLOT(fileNew()));       //< SLOT

     ...

## Methods
| __init__ (self, QString text, KActionCollection parent=NULL)
[QAction] | actions (self)
QAction | addAction (self, QString name, QAction action)
KAction | addAction (self, QString name, KAction action)
KAction | addAction (self, KStandardAction.StandardAction actionType, QObject receiver=NULL, QString member=NULL)
KAction | addAction (self, KStandardAction.StandardAction actionType, QString name, QObject receiver=NULL, QString member=NULL)
KAction | addAction (self, QString name, QObject receiver=NULL, QString member=NULL)
KActionCollection | collection (self)
| setText (self, QString text)
QString | text (self)

## Method Documentation

__init__ | ( | self, |
|  | QString | text,
|  | KActionCollection | parent=NULL
| ) |  |  |

Default constructor

[QAction] actions | ( |  | self ) |

Returns the actions belonging to this category

QAction addAction | ( | self, |
|  | QString | name,
|  | QAction | action
| ) |  |  |

Add action to category

KAction addAction | ( | self, |
|  | QString | name,
|  | KAction | action
| ) |  |  |

Add action to category

KAction addAction | ( | self, |
|  | KStandardAction.StandardAction | actionType,
|  | QObject | receiver=NULL,
|  | QString | member=NULL
| ) |  |  |

Add action to category

KAction addAction | ( | self, |
|  | KStandardAction.StandardAction | actionType,
|  | QString | name,
|  | QObject | receiver=NULL,
|  | QString | member=NULL
| ) |  |  |

Add action to category

KAction addAction | ( | self, |
|  | QString | name,
|  | QObject | receiver=NULL,
|  | QString | member=NULL
| ) |  |  |

Add action to category

KActionCollection collection | ( |  | self ) |

The action collection this category is associated with.

setText | ( | self, |
|  | QString | text
| ) |  |  |

Set the action categorys descriptive text.

QString text | ( |  | self ) |

The action categorys descriptive text