diff options
author | Simon Rettberg | 2015-10-09 17:10:30 +0200 |
---|---|---|
committer | Simon Rettberg | 2015-10-09 17:10:30 +0200 |
commit | e9eb8c4a421c2c406e1ada4c866b2ae9268d647d (patch) | |
tree | 45df627da45839c86787aa1c4562ab99cc38db65 /src/maingui/backdrop.cpp | |
parent | Merge branch 'master' of dnbd3:openslx-ng/printergui (diff) | |
download | printergui-e9eb8c4a421c2c406e1ada4c866b2ae9268d647d.tar.gz printergui-e9eb8c4a421c2c406e1ada4c866b2ae9268d647d.tar.xz printergui-e9eb8c4a421c2c406e1ada4c866b2ae9268d647d.zip |
[pwgui] Also use the grayed out fake background
Diffstat (limited to 'src/maingui/backdrop.cpp')
-rw-r--r-- | src/maingui/backdrop.cpp | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/src/maingui/backdrop.cpp b/src/maingui/backdrop.cpp deleted file mode 100644 index 4a907e8..0000000 --- a/src/maingui/backdrop.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include "backdrop.h" - -#include <QApplication> -#include <QDesktopWidget> -#include <QPainter> -#include <QPaintEvent> -#include <QPixmap> -#include <QRgb> - -Backdrop::Backdrop() : - QWidget(NULL), - screenshot(NULL), - mainWindow(NULL) -{ - QPixmap shot = QPixmap::grabWindow(QApplication::desktop()->winId()); - if (!shot.isNull() && shot.height() > 0) { - QImage img = shot.toImage(); - if (img.format() != QImage::Format_RGB32) { - img = img.convertToFormat(QImage::Format_RGB32); - } - for (int i = 0; i < img.height(); ++i) { - uchar *line = img.scanLine(i); - if (line == NULL) - continue; - QRgb *rgb = (QRgb*)line; - for (int x = 0; x < img.width(); ++x) { - const int val = (qRed(*rgb)*11 + qGreen(*rgb)*16 + qBlue(*rgb)*5) / 32; - *rgb = qRgb(val, val, val); - rgb++; - } - } - shot = QPixmap::fromImage(img); - } - screenshot = new QPixmap(shot); - this->resize(screenshot->width(), screenshot->height()); - this->setWindowFlags(Qt::Tool | Qt::CustomizeWindowHint | Qt::FramelessWindowHint); -} - -Backdrop::~Backdrop() -{ - delete screenshot; -} - -void Backdrop::paintEvent(QPaintEvent * event) -{ - QPainter p(this); - p.drawPixmap(event->rect(), *screenshot, event->rect()); -} - -void Backdrop::mouseReleaseEvent(QMouseEvent * event) -{ - if (mainWindow != NULL) { - mainWindow->raise(); - mainWindow->activateWindow(); - } -} |