diff --git a/mainwindow.cpp b/mainwindow.cpp index f131867..9393c0b 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -23,6 +23,7 @@ #include #include #include +#include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) @@ -183,7 +184,6 @@ void MainWindow::mousePressEvent(QMouseEvent *event) { if (event->buttons() & Qt::LeftButton && !isMaximized()) { m_clickedOnWindow = true; - m_oldMousePos = event->pos(); event->accept(); } @@ -193,7 +193,7 @@ void MainWindow::mousePressEvent(QMouseEvent *event) void MainWindow::mouseMoveEvent(QMouseEvent *event) { if (event->buttons() & Qt::LeftButton && m_clickedOnWindow) { - move(event->globalPos() - m_oldMousePos); + window()->windowHandle()->startSystemMove(); event->accept(); } diff --git a/mainwindow.h b/mainwindow.h index 2998fbc..04e9d97 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -55,7 +55,6 @@ private slots: void on_minimumWindowBtn_clicked(); private: - QPoint m_oldMousePos; bool m_clickedOnWindow = false; bool m_playbackSliderPressed = false; QLinearGradient m_bgLinearGradient;