Fix event filter on windows
This commit is contained in:
parent
1e11740a17
commit
b2996e7e3f
@ -55,10 +55,6 @@ win32 {
|
||||
QT += webview
|
||||
}
|
||||
|
||||
linux:!android: {
|
||||
PKGCONFIG += ply-boot-client
|
||||
}
|
||||
|
||||
android {
|
||||
include(../3rdParty/android/android_openssl/openssl.pri)
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -17,7 +17,6 @@ Build-Depends: debhelper (>= 9.0.0),
|
||||
qtconnectivity5-dev,
|
||||
qtdeclarative5-dev,
|
||||
qtquickcontrols2-5-dev,
|
||||
libplymouth-dev,
|
||||
|
||||
Package: nymea-app
|
||||
Architecture: any
|
||||
|
||||
Reference in New Issue
Block a user