Loading...
Searching...
No Matches
globalshortcut.h
/*
* Copyright (C) 2015 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GLOBALSHORTCUT_H
#define GLOBALSHORTCUT_H
#include <QVariant>
#include <QQuickWindow>
#include <QQuickItem>
class GlobalShortcut: public QQuickItem
{
Q_OBJECT
Q_PROPERTY(QVariant shortcut READ shortcut WRITE setShortcut NOTIFY shortcutChanged)
Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged)
public:
GlobalShortcut(QQuickItem *parent = nullptr);
~GlobalShortcut() = default;
QVariant shortcut() const;
void setShortcut(const QVariant &shortcut);
bool isActive() const;
void setActive(bool active);
protected:
void keyPressEvent(QKeyEvent * event) override;
void keyReleaseEvent(QKeyEvent * event) override;
Q_SIGNALS:
void shortcutChanged(const QVariant &shortcut);
void triggered(const QString &shortcut);
void released(const QString &shortcut);
void activeChanged(bool active);
private:
QVariant m_shortcut;
bool m_active = true;
};
#endif // GLOBALSHORTCUT_H
GlobalShortcut::active
bool active
Definition globalshortcut.h:43
GlobalShortcut::triggered
void triggered(const QString &shortcut)
GlobalShortcut::released
void released(const QString &shortcut)
GlobalShortcut::shortcut
QVariant shortcut
Definition globalshortcut.h:39