diff options
| author | MageJohn <MageJohn@users.noreply.github.com> | 2019-02-21 00:41:14 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-21 00:41:14 +0000 |
| commit | 8c2557eab38ba0d2222ec03fc6022b189e070f8d (patch) | |
| tree | 917c5708af4c152677fa29a014bae8bfd62c6adc /src/sensor.cpp | |
| parent | 7e9c4e1b9bfa3966cca992256b885f75c8660753 (diff) | |
| parent | 2321c26ccd7d1243f8abfac62fea4790402f301a (diff) | |
| download | lead-8c2557eab38ba0d2222ec03fc6022b189e070f8d.tar lead-8c2557eab38ba0d2222ec03fc6022b189e070f8d.tar.gz lead-8c2557eab38ba0d2222ec03fc6022b189e070f8d.zip | |
Merge pull request #2 from Almamu/master
Merge more improvements from Almamu
Diffstat (limited to 'src/sensor.cpp')
| -rw-r--r-- | src/sensor.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/sensor.cpp b/src/sensor.cpp index 597d4f9..4789175 100644 --- a/src/sensor.cpp +++ b/src/sensor.cpp @@ -34,12 +34,13 @@ SOFTWARE. namespace Lead { -Sensor::Sensor(int x, int y, int w, int h, QString enterAction, QString exitAction, int enterInterval, int exitInterval): +Sensor::Sensor(int x, int y, int w, int h, QString enterAction, QString exitAction, int enterInterval, int exitInterval, bool debugMode): QWidget(), enterAction(enterAction), exitAction(exitAction), enterInterval(enterInterval), - exitInterval(exitInterval) + exitInterval(exitInterval), + debugMode(debugMode) { qDebug() << "lead::Sensor() " << x << "," << y << "," << w << "," << h @@ -61,9 +62,16 @@ Sensor::Sensor(int x, int y, int w, int h, QString enterAction, QString exitActi connect(this->enterTimer, SIGNAL(timeout()), this, SLOT(activateEnter())); connect(this->exitTimer, SIGNAL(timeout()), this, SLOT(activateExit())); - //setStyleSheet("background-color:red;"); - setGeometry(x, y, w, h); - setAttribute(Qt::WA_TranslucentBackground, true); + if (this->debugMode) + { + setStyleSheet ("background-color: red"); + } + else + { + setAttribute(Qt::WA_TranslucentBackground, true); + } + + setGeometry(x, y, w, h); setWindowFlags(windowFlags() | Qt::X11BypassWindowManagerHint | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint ); show(); @@ -87,6 +95,9 @@ Sensor::enterEvent(QEvent * event) this->enterTimer->start(); this->exitTimer->start(); + + if (this->debugMode) + setStyleSheet ("background-color: yellow"); } @@ -103,6 +114,9 @@ Sensor::leaveEvent(QEvent * event) QProcess::startDetached(exitAction); } + if (this->debugMode) + setStyleSheet ("background-color: red"); + this->enterTimer->stop(); this->exitTimer->stop(); this->canTriggerExit = false; @@ -114,6 +128,9 @@ Sensor::activateEnter() { qDebug() << "lead::Sensor::activateEnter() " << this->x() << ":" << this->y() << " action: " << this->enterAction; + if (this->debugMode) + setStyleSheet ("background-color: green"); + QProcess::startDetached(enterAction); } |
