diff --git a/components/mobileshell/shellutil.cpp b/components/mobileshell/shellutil.cpp index 877f6921..7bb281b9 100644 --- a/components/mobileshell/shellutil.cpp +++ b/components/mobileshell/shellutil.cpp @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -29,6 +28,7 @@ ShellUtil::ShellUtil(QObject *parent) : QObject{parent} , m_localeConfig{KSharedConfig::openConfig(QStringLiteral("kdeglobals"), KConfig::SimpleConfig)} , m_launchingApp{nullptr} + , m_hapticsEffect{std::make_unique()} { m_localeConfigWatcher = KConfigWatcher::create(m_localeConfig); @@ -137,9 +137,8 @@ void ShellUtil::clearLaunchingApp() void ShellUtil::buttonVibrate() { if (MobileShellSettings::self()->vibrationsEnabled()) { - QFeedbackHapticsEffect rumble; - rumble.setDuration(MobileShellSettings::self()->vibrationDuration()); - rumble.setIntensity(MobileShellSettings::self()->vibrationIntensity()); - rumble.start(); + m_hapticsEffect->setDuration(MobileShellSettings::self()->vibrationDuration()); + m_hapticsEffect->setIntensity(MobileShellSettings::self()->vibrationIntensity()); + m_hapticsEffect->start(); } } diff --git a/components/mobileshell/shellutil.h b/components/mobileshell/shellutil.h index 909c0340..48700fe0 100644 --- a/components/mobileshell/shellutil.h +++ b/components/mobileshell/shellutil.h @@ -7,6 +7,7 @@ #pragma once +#include #include #include @@ -98,4 +99,6 @@ private: KIO::ApplicationLauncherJob *m_launchingApp; QVector m_launchingAppPids; + + std::unique_ptr m_hapticsEffect; };