Fix event filter on windows
This commit is contained in:
parent
1e11740a17
commit
b2996e7e3f
@ -55,10 +55,6 @@ win32 {
|
|||||||
QT += webview
|
QT += webview
|
||||||
}
|
}
|
||||||
|
|
||||||
linux:!android: {
|
|
||||||
PKGCONFIG += ply-boot-client
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
include(../3rdParty/android/android_openssl/openssl.pri)
|
include(../3rdParty/android/android_openssl/openssl.pri)
|
||||||
|
|
||||||
|
|||||||
@ -87,8 +87,16 @@ ScreenHelper::ScreenHelper(QObject *parent) : QObject(parent)
|
|||||||
|
|
||||||
foreach (QWindow *w, qApp->topLevelWindows()) {
|
foreach (QWindow *w, qApp->topLevelWindows()) {
|
||||||
w->installEventFilter(this);
|
w->installEventFilter(this);
|
||||||
|
m_watchedWindows.append(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
connect(qApp, &QGuiApplication::focusWindowChanged, this, [=](QWindow *w){
|
||||||
|
if (!m_watchedWindows.contains(w)) {
|
||||||
|
w->installEventFilter(this);
|
||||||
|
m_watchedWindows.append(w);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
m_currentBrightness = settings.value("screenBrightness", 80).toInt();
|
m_currentBrightness = settings.value("screenBrightness", 80).toInt();
|
||||||
@ -122,6 +130,7 @@ int ScreenHelper::screenTimeout() const
|
|||||||
|
|
||||||
void ScreenHelper::setScreenTimeout(int timeout)
|
void ScreenHelper::setScreenTimeout(int timeout)
|
||||||
{
|
{
|
||||||
|
qCInfo(dcPlatformIntegration()) << "Set screen timeout to" << timeout << "ms";
|
||||||
m_screenDimTimer.setInterval(timeout);
|
m_screenDimTimer.setInterval(timeout);
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
settings.setValue("screenOffTimeout", timeout);
|
settings.setValue("screenOffTimeout", timeout);
|
||||||
|
|||||||
@ -35,6 +35,8 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
|
class QWindow;
|
||||||
|
|
||||||
class ScreenHelper : public QObject
|
class ScreenHelper : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -63,6 +65,8 @@ private:
|
|||||||
QFile m_powerFile;
|
QFile m_powerFile;
|
||||||
QFile m_brightnessFile;
|
QFile m_brightnessFile;
|
||||||
|
|
||||||
|
QList<QWindow*> m_watchedWindows;
|
||||||
|
|
||||||
bool m_cursorHidden = false;
|
bool m_cursorHidden = false;
|
||||||
|
|
||||||
int m_maxBrightness = -1;
|
int m_maxBrightness = -1;
|
||||||
|
|||||||
@ -17,7 +17,6 @@ Build-Depends: debhelper (>= 9.0.0),
|
|||||||
qtconnectivity5-dev,
|
qtconnectivity5-dev,
|
||||||
qtdeclarative5-dev,
|
qtdeclarative5-dev,
|
||||||
qtquickcontrols2-5-dev,
|
qtquickcontrols2-5-dev,
|
||||||
libplymouth-dev,
|
|
||||||
|
|
||||||
Package: nymea-app
|
Package: nymea-app
|
||||||
Architecture: any
|
Architecture: any
|
||||||
|
|||||||
Reference in New Issue
Block a user