Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
IBackend.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include <QKeySequence>
7#include <QObject>
8#include <QString>
9
10#include "phosphorshortcuts_export.h"
11
12namespace Phosphor::Shortcuts {
13
28class PHOSPHORSHORTCUTS_EXPORT IBackend : public QObject
29{
30 Q_OBJECT
31public:
32 explicit IBackend(QObject* parent = nullptr)
33 : QObject(parent)
34 {
35 }
36 ~IBackend() override = default;
37
73 virtual void registerShortcut(const QString& id, const QKeySequence& defaultSeq, const QKeySequence& currentSeq,
74 const QString& description, bool persistent = true) = 0;
75
92 virtual void updateShortcut(const QString& id, const QKeySequence& defaultSeq, const QKeySequence& newTrigger) = 0;
93
106 virtual void unregisterShortcut(const QString& id) = 0;
107
114 virtual void flush() = 0;
115
116Q_SIGNALS:
121 void activated(QString id);
122
128 void ready();
129};
130
131} // namespace Phosphor::Shortcuts
Pluggable global shortcut backend.
Definition IBackend.h:29
~IBackend() override=default
IBackend(QObject *parent=nullptr)
Definition IBackend.h:32
virtual void updateShortcut(const QString &id, const QKeySequence &defaultSeq, const QKeySequence &newTrigger)=0
Change the active binding for an already-registered id.
virtual void unregisterShortcut(const QString &id)=0
Release the key grab for an id.
void ready()
Emitted after flush() completes.
virtual void flush()=0
Commit any queued register/update ops.
void activated(QString id)
Emitted when the backend observes the user triggering a registered shortcut.
virtual void registerShortcut(const QString &id, const QKeySequence &defaultSeq, const QKeySequence &currentSeq, const QString &description, bool persistent=true)=0
Register a new shortcut id.
Definition Factory.h:12