Pages
API Documentation
On this page

KShortcutsEditor Class

Widget for configuration of KAccel and KGlobalAccel. More...

  • Header: #include <KShortcutsEditor>
  • CMake: find_package(KF6 REQUIRED COMPONENTS XmlGui)
    target_link_libraries(mytarget PRIVATE KF6::XmlGui)
  • Inherits: QWidget

List of all members, including inherited members

Public Types

Properties

Public Functions

Public Slots

Signals

Detailed Description

Configure dictionaries of key/action associations for QActions, 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

Member Type Documentation

enum KShortcutsEditor::ActionType

flags KShortcutsEditor::ActionTypes

Constant Value Description
KShortcutsEditor::WidgetAction Qt::WidgetShortcut Actions which are triggered by any keypress in a widget that has the action added to it.
KShortcutsEditor::WindowAction Qt::WindowShortcut Actions which are triggered by any keypress in a window that has the action added to it or its child widget(s).
KShortcutsEditor::ApplicationAction Qt::ApplicationShortcut Actions that are triggered by any keypress in the application.
KShortcutsEditor::GlobalAction 4 Actions which are triggered by any keypress in the windowing system.
KShortcutsEditor::AllActions 0xffffffff A combination of all available actions. > Note: Since 5.95, GlobalAction is ignored if there are no actual Global shortcuts in any of the action collections that are added.

The ActionTypes type is a typedef for QFlags<ActionType>. It stores an OR combination of ActionType values.

enum KShortcutsEditor::LetterShortcuts

Constant Value Description
KShortcutsEditor::LetterShortcutsDisallowed 0 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.
KShortcutsEditor::LetterShortcutsAllowed 1 Letter shortcuts are allowed.

Property Documentation

actionTypes : ActionTypes

Access functions:

Member Function Documentation

KShortcutsEditor::KShortcutsEditor(KActionCollection *collection, QWidget *parent, KShortcutsEditor::ActionTypes actionTypes = AllActions, KShortcutsEditor::LetterShortcuts allowLetterShortcuts = LetterShortcutsAllowed)

Constructor.

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.

[explicit] KShortcutsEditor::KShortcutsEditor(QWidget *parent, KShortcutsEditor::ActionTypes actionTypes = AllActions, KShortcutsEditor::LetterShortcuts allowLetterShortcuts = LetterShortcutsAllowed)

Creates a key chooser without a starting action collection.

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.

This function overloads KShortcutsEditor::KShortcutsEditor().

[override virtual noexcept] KShortcutsEditor::~KShortcutsEditor()

Destructor

KShortcutsEditor::ActionTypes KShortcutsEditor::actionTypes() const

Returns The types of actions currently displayed in this widget.

Note: Getter function for property actionTypes.

See also setActionTypes()

void KShortcutsEditor::addCollection(KActionCollection *, const QString &title = QString())

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

title Subtree title of this collection of shortcut.

[slot] void KShortcutsEditor::allDefault()

Sets all shortcuts to their default values (bindings).

void KShortcutsEditor::clearCollections()

Removes all action collections from the editor

bool KShortcutsEditor::isModified() const

Returns whether there are unsaved changes.

[signal] void KShortcutsEditor::keyChange()

Emitted when an action's shortcut has been changed.

void KShortcutsEditor::save()

Save the changes.

This saves the actions to disk. Any KActionCollection objects with the xmlFile() value set will be written to an XML file. All others will be written to the application's rc file.

void KShortcutsEditor::setActionTypes(KShortcutsEditor::ActionTypes actionTypes)

Sets the types of actions to display in this widget.

actionTypes New types of actions.

Note: Setter function for property actionTypes.

See also actionTypes()

void KShortcutsEditor::undo()

Undo all changes made since the last save().

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.