KShortcutsEditor Class Reference
from PyKDE4.kdeui import *
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
Enumerations | |
ActionType | { WidgetAction, WindowAction, ApplicationAction, GlobalAction, AllActions } Typesafe wrapper: ActionTypes |
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) | |
exportConfiguration (self, KConfig config) | |
importConfiguration (self, KConfig config) | |
bool | isModified (self) |
keyChange (self) | |
printShortcuts (self) | |
resizeColumns (self) | |
save (self) | |
undoChanges (self) | |
writeConfiguration (self, KConfigGroup config=0) | |
Static Methods | |
bool | checkGlobalShortcutsConflict (KShortcut cut, bool warnUser, QWidget parent) |
bool | checkStandardShortcutsConflict (KShortcut cut, bool warnUser, QWidget parent) |
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
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
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
bool isModified | ( | self ) |
Are the unsaved changes?
keyChange | ( | self ) |
Emitted when an action's shortcut has been changed.
- Signal syntax:
QObject.connect(source, SIGNAL("keyChange()"), target_slot)
printShortcuts | ( | self ) |
Opens a printing dialog to print all the shortcuts
resizeColumns | ( | self ) |
Resize colums to width required
save | ( | self ) |
Save the changes.
Well this function doesn't save actually for global shortcuts. It makes sure the editor doesn't undo all changes when it is deleted.
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 save().
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 |
Actions which are triggered by any keypress in a widget which has the action added to it
- Note:
- It is necessary to wrap members of this enumeration in a
ActionTypes
instance when passing them to a method as group of flags. For example:ActionTypes( WidgetAction | WindowAction)
- Enumerator:
-
WidgetAction = Qt::WidgetShortcut WindowAction = Qt::WindowShortcut ApplicationAction = Qt::ApplicationShortcut GlobalAction = 4 AllActions = 0xffffffff
LetterShortcuts |
Shortcuts without a modifier are not allowed, so 'A' would not be valid, whereas 'Ctrl+A' would be. This only applies to printable characters, however. 'F1', 'Insert' etc. could still be used.
- Enumerator:
-
LetterShortcutsDisallowed = 0 LetterShortcutsAllowed