Fix event filter on windows

This commit is contained in:
Michael Zanetti 2021-03-24 13:34:03 +01:00
parent 1e11740a17
commit b2996e7e3f
4 changed files with 13 additions and 5 deletions

View File

@ -55,10 +55,6 @@ win32 {
QT += webview
}
linux:!android: {
PKGCONFIG += ply-boot-client
}
android {
include(../3rdParty/android/android_openssl/openssl.pri)

View File

@ -87,8 +87,16 @@ ScreenHelper::ScreenHelper(QObject *parent) : QObject(parent)
foreach (QWindow *w, qApp->topLevelWindows()) {
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;
m_currentBrightness = settings.value("screenBrightness", 80).toInt();
@ -122,6 +130,7 @@ int ScreenHelper::screenTimeout() const
void ScreenHelper::setScreenTimeout(int timeout)
{
qCInfo(dcPlatformIntegration()) << "Set screen timeout to" << timeout << "ms";
m_screenDimTimer.setInterval(timeout);
QSettings settings;
settings.setValue("screenOffTimeout", timeout);

View File

@ -35,6 +35,8 @@
#include <QTimer>
#include <QFile>
class QWindow;
class ScreenHelper : public QObject
{
Q_OBJECT
@ -63,6 +65,8 @@ private:
QFile m_powerFile;
QFile m_brightnessFile;
QList<QWindow*> m_watchedWindows;
bool m_cursorHidden = false;
int m_maxBrightness = -1;

View File

@ -17,7 +17,6 @@ Build-Depends: debhelper (>= 9.0.0),
qtconnectivity5-dev,
qtdeclarative5-dev,
qtquickcontrols2-5-dev,
libplymouth-dev,
Package: nymea-app
Architecture: any