diff options
author | Simon Rettberg | 2019-05-15 15:00:52 +0200 |
---|---|---|
committer | Simon Rettberg | 2019-05-15 15:00:52 +0200 |
commit | 40174287f39e08fbeebb46c0e2099df4f83136ed (patch) | |
tree | f68c8147a1aeda17c9491b26d3707e2646ece7b0 /src/mainwindow.cpp | |
parent | Use Qt5 QObject::connect(), fix caplock message after failed login (diff) | |
download | slxgreeter-40174287f39e08fbeebb46c0e2099df4f83136ed.tar.gz slxgreeter-40174287f39e08fbeebb46c0e2099df4f83136ed.tar.xz slxgreeter-40174287f39e08fbeebb46c0e2099df4f83136ed.zip |
Improve graphics rendering
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r-- | src/mainwindow.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 15736f0..a9ff11e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -27,13 +27,16 @@ #include "settings.h" #include "global.h" +#include "snake.h" + MainWindow::MainWindow(bool primary, int screen, const QRect &screenRect, QWidget *parent) : QWidget(parent), m_ScreenRect(screenRect), m_Primary(primary), m_LoginForm(nullptr), m_messages(nullptr), - m_Clock(nullptr) + m_Clock(nullptr), + m_Snake(nullptr) { setObjectName(QString("MainWindow_%1").arg(screen)); @@ -109,6 +112,21 @@ MainWindow::~MainWindow() { } +void MainWindow::paintEvent(QPaintEvent *event) +{ + QWidget::paintEvent(event); + if (m_Snake != nullptr) { + m_Snake->paint(event); + } +} + +void MainWindow::mouseDoubleClickEvent(QMouseEvent *) +{ + if (m_Snake == nullptr) { + m_Snake = new Snake(this); + } +} + QSize MainWindow::createLogo(QRect max) { QSize retval(0, 0); |