diff options
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r-- | src/mainwindow.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2a56fbc..95d74de 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -55,6 +55,7 @@ MainWindow::MainWindow(bool primary, int screen, const QRect &screenRect, QWidge int centerX = screenRect.width()/2 + screenRect.x(); int centerY = screenRect.height()/2 + screenRect.y(); QCursor::setPos(centerX, centerY); + connect(m_LoginForm, &LoginForm::resized, this, &MainWindow::reLayout); } // Banner @@ -80,6 +81,11 @@ void MainWindow::resizeEvent(QResizeEvent *event) QWidget::resizeEvent(event); m_ScreenRect = QRect(this->pos(), event->size()); setBackground(); + reLayout(); +} + +void MainWindow::reLayout() +{ /* * Everything is layed out manually here, since I don't know how to represent the size constraints * and interactions of everything using layout classes. You're welcome to improve this, but I double @@ -177,8 +183,11 @@ void MainWindow::paintEvent(QPaintEvent *event) void MainWindow::mouseDoubleClickEvent(QMouseEvent *) { + static int clicks = 0; if (m_Snake == nullptr) { - m_Snake = new GameCore(this); + if (clicks++ > 0) { + m_Snake = new GameCore(this); + } } else { m_Snake->addSnake(); } |