KShortcutsEditor

KDE 4.7 PyKDE API Reference

- KDE's Python API

# KShortcutsEditor Class Reference

`from PyKDE4.kdeui import *`

Inherits: QWidget → QObject

## Detailed Description

Widget for configuration of KAccel and KGlobalAccel.

Configure dictionaries of key/action associations for KActions, including global shortcuts.

The class takes care of all aspects of configuration, including handling key conflicts internally. Connect to the allDefault() slot if you want to set all configurable shortcuts to their default values.

See also:
  KShortcutsDialog

Author:
  Nicolas Hadacek <hadacek@via.ecp.fr>

Author:
  Hamish Rodda <rodda@kde.org> (KDE 4 porting)

Author:
  Michael Jansen <kde@michael-jansen.biz>

## Enumerations
ActionType | { WidgetAction, WindowAction, ApplicationAction, GlobalAction, AllActions }
LetterShortcuts | { LetterShortcutsDisallowed, LetterShortcutsAllowed }
## Signals
| keyChange ()
## Methods
| __init__ (self, KActionCollection collection, QWidget parent, KShortcutsEditor.ActionTypes actionTypes=KShortcutsEditor.AllActions, KShortcutsEditor.LetterShortcuts allowLetterShortcuts=KShortcutsEditor.LetterShortcutsAllowed)
| __init__ (self, QWidget parent, KShortcutsEditor.ActionTypes actionTypes=KShortcutsEditor.AllActions, KShortcutsEditor.LetterShortcuts allowLetterShortcuts=KShortcutsEditor.LetterShortcutsAllowed)
| __init__ (self, KShortcutsEditor a0)
| addCollection (self, KActionCollection a0, QString title=QString())
| allDefault (self)
| clearCollections (self)
| clearConfiguration (self)
| commit (self)
| exportConfiguration (self, KConfig config)
| exportConfiguration (self, KConfigBase config)
| importConfiguration (self, KConfig config)
| importConfiguration (self, KConfigBase config)
bool | isModified (self)
| printShortcuts (self)
| resizeColumns (self)
| save (self)
| undoChanges (self)
| writeConfiguration (self, KConfigGroup config=0)

## Signal Documentation

keyChange | ( |  | ) |

Emitted when an action's shortcut has been changed.

Signal syntax:
  `QObject.connect(source, SIGNAL("keyChange()"), target_slot)`

## Method Documentation

__init__ | ( | self, |
|  | KActionCollection | collection,
|  | QWidget | parent,
|  | KShortcutsEditor.ActionTypes | actionTypes=KShortcutsEditor.AllActions,
|  | KShortcutsEditor.LetterShortcuts | allowLetterShortcuts=KShortcutsEditor.LetterShortcutsAllowed
| ) |  |  |

Constructor.

Parameters:

  | collection | the KActionCollection to configure
  | parent | parent widget
  | actionTypes | types of actions to display in this widget.
  | allowLetterShortcuts | set to LetterShortcutsDisallowed if unmodified alphanumeric keys ('A', '1', etc.) are not permissible shortcuts.

__init__ | ( | self, |
|  | QWidget | parent,
|  | KShortcutsEditor.ActionTypes | actionTypes=KShortcutsEditor.AllActions,
|  | KShortcutsEditor.LetterShortcuts | allowLetterShortcuts=KShortcutsEditor.LetterShortcutsAllowed
| ) |  |  |

Creates a key chooser without a starting action collection.

Parameters:

  | parent | parent widget
  | actionTypes | types of actions to display in this widget.
  | allowLetterShortcuts | set to LetterShortcutsDisallowed if unmodified alphanumeric keys ('A', '1', etc.) are not permissible shortcuts.

__init__ | ( | self, |
|  | KShortcutsEditor | a0
| ) |  |  |

addCollection | ( | self, |
|  | KActionCollection | a0,
|  | QString | title=QString()
| ) |  |  |

Insert an action collection, i.e. add all its actions to the ones already associated with the KShortcutsEditor object.

Parameters:

  | title | subtree title of this collection of shortcut.

allDefault | ( |  | self ) |

Set all shortcuts to their default values (bindings).

clearCollections | ( |  | self ) |

Removes all action collections from the editor

clearConfiguration | ( |  | self ) |

Removes all configured shortcuts.

commit | ( |  | self ) |

Commit the changes without saving.

This commits the changes without saving.

Since:
  4.2

exportConfiguration | ( | self, |
|  | KConfig | config
| ) |  |  |

Export the current setting to configuration config.

This initializes the configuration object. This will export the global configuration too.

Parameters:

  | config | Config object

exportConfiguration | ( | self, |
|  | KConfigBase | config
| ) |  |  |

Export the current setting to configuration config.

This initializes the configuration object. This will export the global configuration too.

Parameters:

  | config | Config object

importConfiguration | ( | self, |
|  | KConfig | config
| ) |  |  |

Import the settings from configuration config.

This will remove all current setting before importing. All shortcuts are set to KShortcut() prior to importing from config!

Parameters:

  | config | Config object

importConfiguration | ( | self, |
|  | KConfigBase | config
| ) |  |  |

Import the settings from configuration config.

This will remove all current setting before importing. All shortcuts are set to KShortcut() prior to importing from config!

Parameters:

  | config | Config object

bool isModified | ( |  | self ) |

Are the unsaved changes?

printShortcuts | ( |  | self ) |

Opens a printing dialog to print all the shortcuts

resizeColumns | ( |  | self ) |

Resize columns to width required

save | ( |  | self ) |

Save the changes.

Before saving the changes are committed. This saves the actions to disk. Any KActionCollection objects with the xmlFile() value set will be written to an XML file. All other will be written to the application's rc file.

undoChanges | ( |  | self ) |

Undo all change made since the last commit().

writeConfiguration | ( | self, |
|  | KConfigGroup | config=0
| ) |  |  |

Write the current settings to the config object.

This does not initialize the config object. It adds the configuration.

Note:
  this will not save the global configuration! globalaccel holds that part of the configuration.

See also:
  writeGlobalConfig()

Parameters:

  | config | Config object to save to or, or null to use the applications config object

## Enumeration Documentation

ActionType

Enumerator:

  WidgetAction = Qt::WidgetShortcut |
  WindowAction = Qt::WindowShortcut |
  ApplicationAction = Qt::ApplicationShortcut |
  GlobalAction = 4 |
  AllActions = 0xffffffff |

LetterShortcuts

Enumerator:

  LetterShortcutsDisallowed = 0 |
  LetterShortcutsAllowed |