scripting: Drop registerShortcut() function in QML API
Use ShortcutHandler type instead.
This commit is contained in:
parent
c121253d10
commit
9ed1f28d0f
2 changed files with 0 additions and 22 deletions
|
@ -624,27 +624,6 @@ void KWin::JSEngineGlobalMethodsWrapper::registerWindow(QQuickWindow *window)
|
|||
}
|
||||
}
|
||||
|
||||
bool KWin::JSEngineGlobalMethodsWrapper::registerShortcut(const QString &name, const QString &text, const QKeySequence &keys, QJSValue function)
|
||||
{
|
||||
if (!function.isCallable()) {
|
||||
qCDebug(KWIN_SCRIPTING) << "Fourth and final argument must be a javascript function";
|
||||
return false;
|
||||
}
|
||||
|
||||
QAction *a = new QAction(this);
|
||||
a->setObjectName(name);
|
||||
a->setText(text);
|
||||
const QKeySequence shortcut = QKeySequence(keys);
|
||||
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>{shortcut});
|
||||
|
||||
connect(a, &QAction::triggered, this, [=]() mutable {
|
||||
QJSValueList arguments;
|
||||
arguments << Scripting::self()->qmlEngine()->toScriptValue(a);
|
||||
function.call(arguments);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
KWin::Scripting *KWin::Scripting::s_self = nullptr;
|
||||
|
||||
KWin::Scripting *KWin::Scripting::create(QObject *parent)
|
||||
|
|
|
@ -299,7 +299,6 @@ public:
|
|||
public Q_SLOTS:
|
||||
QVariant readConfig(const QString &key, QVariant defaultValue = QVariant());
|
||||
void registerWindow(QQuickWindow *window);
|
||||
bool registerShortcut(const QString &name, const QString &text, const QKeySequence &keys, QJSValue function);
|
||||
|
||||
private:
|
||||
DeclarativeScript *m_script;
|
||||
|
|
Loading…
Reference in a new issue