chore: make use of Qt's startSystemMove()

This commit is contained in:
Gary Wang 2023-07-07 00:23:34 +08:00
parent e58cc703f3
commit 4c438629e7
No known key found for this signature in database
GPG Key ID: 5D30A4F15EA78760
2 changed files with 2 additions and 3 deletions

View File

@ -23,6 +23,7 @@
#include <QListView> #include <QListView>
#include <QCollator> #include <QCollator>
#include <QMimeData> #include <QMimeData>
#include <QWindow>
MainWindow::MainWindow(QWidget *parent) MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent) : QMainWindow(parent)
@ -183,7 +184,6 @@ void MainWindow::mousePressEvent(QMouseEvent *event)
{ {
if (event->buttons() & Qt::LeftButton && !isMaximized()) { if (event->buttons() & Qt::LeftButton && !isMaximized()) {
m_clickedOnWindow = true; m_clickedOnWindow = true;
m_oldMousePos = event->pos();
event->accept(); event->accept();
} }
@ -193,7 +193,7 @@ void MainWindow::mousePressEvent(QMouseEvent *event)
void MainWindow::mouseMoveEvent(QMouseEvent *event) void MainWindow::mouseMoveEvent(QMouseEvent *event)
{ {
if (event->buttons() & Qt::LeftButton && m_clickedOnWindow) { if (event->buttons() & Qt::LeftButton && m_clickedOnWindow) {
move(event->globalPos() - m_oldMousePos); window()->windowHandle()->startSystemMove();
event->accept(); event->accept();
} }

View File

@ -55,7 +55,6 @@ private slots:
void on_minimumWindowBtn_clicked(); void on_minimumWindowBtn_clicked();
private: private:
QPoint m_oldMousePos;
bool m_clickedOnWindow = false; bool m_clickedOnWindow = false;
bool m_playbackSliderPressed = false; bool m_playbackSliderPressed = false;
QLinearGradient m_bgLinearGradient; QLinearGradient m_bgLinearGradient;