mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
hapticsplugin: Use QCoro::QmlTask
This avoids the following error for haptic events when used from QML: ``` QVariant: Provided metatype for 'QCoro::Task<void>' does not support destruction and copy construction ```
This commit is contained in:
parent
67ca0fd6fc
commit
0e09a434ef
3 changed files with 12 additions and 2 deletions
|
|
@ -18,6 +18,7 @@ target_link_libraries(hapticsplugin PRIVATE
|
||||||
KF6::CoreAddons
|
KF6::CoreAddons
|
||||||
KF6::I18n
|
KF6::I18n
|
||||||
QCoro::DBus
|
QCoro::DBus
|
||||||
|
QCoro::Qml
|
||||||
)
|
)
|
||||||
|
|
||||||
ecm_finalize_qml_module(hapticsplugin)
|
ecm_finalize_qml_module(hapticsplugin)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ VibrationManager::VibrationManager(QObject *parent)
|
||||||
qDBusRegisterMetaType<VibrationEventList>();
|
qDBusRegisterMetaType<VibrationEventList>();
|
||||||
}
|
}
|
||||||
|
|
||||||
QCoro::Task<void> VibrationManager::vibrate(int durationMs)
|
QCoro::Task<void> VibrationManager::vibrateTask(int durationMs)
|
||||||
{
|
{
|
||||||
// Only create interface when needed.
|
// Only create interface when needed.
|
||||||
if (!m_interface) {
|
if (!m_interface) {
|
||||||
|
|
@ -27,3 +27,8 @@ QCoro::Task<void> VibrationManager::vibrate(int durationMs)
|
||||||
qWarning() << "feedbackd vibration failed";
|
qWarning() << "feedbackd vibration failed";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QCoro::QmlTask VibrationManager::vibrate(int durationMs)
|
||||||
|
{
|
||||||
|
return vibrateTask(durationMs);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,10 @@
|
||||||
#include "hapticinterface.h"
|
#include "hapticinterface.h"
|
||||||
#include "vibrationevent.h"
|
#include "vibrationevent.h"
|
||||||
|
|
||||||
|
#include <QCoroCore>
|
||||||
#include <QCoroDBusPendingReply>
|
#include <QCoroDBusPendingReply>
|
||||||
|
#include <QCoroQml>
|
||||||
|
#include <QCoroQmlTask>
|
||||||
|
|
||||||
class VibrationManager : public QObject
|
class VibrationManager : public QObject
|
||||||
{
|
{
|
||||||
|
|
@ -21,7 +24,8 @@ class VibrationManager : public QObject
|
||||||
public:
|
public:
|
||||||
VibrationManager(QObject *parent = nullptr);
|
VibrationManager(QObject *parent = nullptr);
|
||||||
|
|
||||||
Q_INVOKABLE QCoro::Task<void> vibrate(int durationMs);
|
QCoro::Task<void> vibrateTask(int durationMs);
|
||||||
|
Q_INVOKABLE QCoro::QmlTask vibrate(int durationMs);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OrgSigxcpuFeedbackHapticInterface *m_interface{nullptr};
|
OrgSigxcpuFeedbackHapticInterface *m_interface{nullptr};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue