KShortcutWidget Class
Collection of convenience classes and widgets to manage your own main QtWidgets window. More...
- Header:
#include <KShortcutWidget> - CMake:
find_package(KF6 REQUIRED COMPONENTS XmlGui)
target_link_libraries(mytarget PRIVATE KF6::XmlGui) - Inherits: QWidget
List of all members, including inherited members
Properties
Public Functions
- KShortcutWidget(QWidget *parent = nullptr)
- ~KShortcutWidget()
- bool isModifierlessAllowed()
- void setCheckActionCollections(const QList<KActionCollection *> &actionCollections)
- void setClearButtonsShown(bool show)
- void setModifierlessAllowed(bool allow)
- QList<QKeySequence> shortcut() const
Public Slots
Signals
Detailed Description
Provides a widget that lets the user assign a main shortcut and an alternate shortcut for a certain action.
Property Documentation
modifierlessAllowed : bool
Access functions:
boolisModifierlessAllowed()voidsetModifierlessAllowed(boolallow)
Member Function Documentation
[explicit] KShortcutWidget::KShortcutWidget(QWidget *parent = nullptr)
Creates a new shortcut widget as a child of parent.
[override virtual noexcept] KShortcutWidget::~KShortcutWidget()
Destructs the shortcut widget.
[slot] void KShortcutWidget::applyStealShortcut()
Actually remove the shortcut that the user wanted to steal, from the action that was using it.
To be called before you apply your changes. No shortcuts are stolen until this function is called.
[slot] void KShortcutWidget::clearShortcut()
Unassigns the widget's shortcut.
bool KShortcutWidget::isModifierlessAllowed()
Returns whether the set widget shortcut can be set without including a modifier key.
Note: Getter function for property modifierlessAllowed.
void KShortcutWidget::setCheckActionCollections(const QList<KActionCollection *> &actionCollections)
Sets a list of actionCollections to check against for a conflictuous shortcut.
If there is a conflictuous shortcut with a QAction, and that this shortcut can be configured (that is, KActionCollection::isShortcutConfigurable() returns true) the user will be prompted to eventually steal the shortcut from this action.
Global shortcuts are automatically checked for conflicts.
Don't forget to call applyStealShortcut() to actually steal the shortcut.
void KShortcutWidget::setClearButtonsShown(bool show)
Sets whether to show the clear buttons next to the main and alternate shortcuts of the widget.
void KShortcutWidget::setModifierlessAllowed(bool allow)
Sets whether to allow a shortcut that doesn't include a modifier key.
Note: Setter function for property modifierlessAllowed.
See also isModifierlessAllowed()
[slot] void KShortcutWidget::setShortcut(const QList<QKeySequence> &cut)
Sets the given shortcut cut to the widget.
See also shortcut()
QList<QKeySequence> KShortcutWidget::shortcut() const
Returns the set shortcut.
See also setShortcut()
[signal] void KShortcutWidget::shortcutChanged(const QList<QKeySequence> &cut)
Emitted when the given shortcut cut has changed.