KShortcutsDialog

KDE 4.7 PyKDE API Reference

- KDE's Python API

# KShortcutsDialog Class Reference

`from PyKDE4.kdeui import *`

Inherits: KDialog → QDialog → QWidget → QObject

## Detailed Description

Dialog for configuration of KActionCollection and KGlobalAccel.

The KShortcutsDialog class is used for configuring dictionaries of key/action associations for KActionCollection and KGlobalAccel. It uses the KShortcutsEditor widget and offers buttons to set all keys to defaults and invoke on-line help.

Several static methods are supplied which provide the most convenient interface to the dialog. The most common and most encouraged use is with KActionCollection.

     KShortcutsDialog.configure( actionCollection() );

Since:
  4.3 By default this dialog is modal. If you don't want that, setModal(false) and then the non-static configure() will show the dialog. If you want to do anything extra when the dialog is done, connect to okClicked() and/or cancelClicked(). However, if your extra stuff depends on the changed settings already being saved, connect to saved() instead to be safe; if you connect to okClicked() your function might be called before the save happens.

example:

     KShortcutsDialog dlg;
     dlg.addCollection(myActions);
     dlg.setModal(false);
     connect(&dlg, SIGNAL(saved()), this, SLOT(doExtraStuff()));
     dlg.configure();

"KDE Shortcuts Dialog"

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

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

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

## Signals
| saved ()
## Methods
| __init__ (self, KShortcutsEditor.ActionTypes types=KShortcutsEditor.AllActions, KShortcutsEditor.LetterShortcuts allowLetterShortcuts=KShortcutsEditor.LetterShortcutsAllowed, QWidget parent=0)
| __init__ (self, KShortcutsDialog a0)
[KActionCollection] | actionCollections (self)
| addCollection (self, KActionCollection a0, QString title=QString())
bool | configure (self, bool saveSettings=1)
QSize | sizeHint (self)
## Static Methods
int | configure (KActionCollection collection, KShortcutsEditor.LetterShortcuts allowLetterShortcuts=KShortcutsEditor.LetterShortcutsAllowed, QWidget parent=0, bool bSaveSettings=1)

## Signal Documentation

saved | ( |  | ) |

emitted after ok is clicked and settings are saved

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

## Method Documentation

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

Constructs a KShortcutsDialog as a child of parent. Set allowLetterShortcuts to false if unmodified alphanumeric keys ('A', '1', etc.) are not permissible shortcuts.

__init__ | ( | self, |
|  | KShortcutsDialog | a0
| ) |  |  |

[KActionCollection] actionCollections | ( |  | self ) |

Returns:
  the list of action collections that are available for configuration in the dialog.

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

Add all actions of the collection to the ones displayed and configured by the dialog.

Parameters:

  | title | the title associated with the collection (if null, the KAboutData.progName() of the collection's componentData is used)

bool configure | ( | self, |
|  | bool | saveSettings=1
| ) |  |  |

Pops up a modal dialog for configuring key settings. The new shortcut settings will become active if the user presses OK.

Parameters:

  | collection | the KActionCollection to configure
  | allowLetterShortcuts | set to KShortcutsEditor.LetterShortcutsDisallowed if unmodified alphanumeric keys ('A', '1', etc.) are not permissible shortcuts.
  | parent | the parent widget to attach to
  | bSaveSettings | if true, the settings will also be saved back by calling writeSettings() on the action collections that were added.

Returns:
  Accept if the dialog was closed with OK, Reject otherwise.

QSize sizeHint | ( |  | self ) |

See also:
  QWidget.sizeHint()

## Static Method Documentation

int configure | ( | KActionCollection | collection,
|  | KShortcutsEditor.LetterShortcuts | allowLetterShortcuts=KShortcutsEditor.LetterShortcutsAllowed,
|  | QWidget | parent=0,
|  | bool | bSaveSettings=1
| ) |  |  |

Pops up a modal dialog for configuring key settings. The new shortcut settings will become active if the user presses OK.

Parameters:

  | collection | the KActionCollection to configure
  | allowLetterShortcuts | set to KShortcutsEditor.LetterShortcutsDisallowed if unmodified alphanumeric keys ('A', '1', etc.) are not permissible shortcuts.
  | parent | the parent widget to attach to
  | bSaveSettings | if true, the settings will also be saved back by calling writeSettings() on the action collections that were added.

Returns:
  Accept if the dialog was closed with OK, Reject otherwise.