Skip to content

Commit

Permalink
feat: try using QWindow::startSystemMove() under Qt 5.15+
Browse files Browse the repository at this point in the history
  • Loading branch information
BLumia committed Oct 15, 2020
1 parent 54c54e2 commit 203274a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <QCollator>
#include <QClipboard>
#include <QMimeData>
#include <QWindow>

#ifdef _WIN32
#include <windows.h>
Expand Down Expand Up @@ -339,7 +340,13 @@ void MainWindow::mousePressEvent(QMouseEvent *event)
void MainWindow::mouseMoveEvent(QMouseEvent *event)
{
if (event->buttons() & Qt::LeftButton && m_clickedOnWindow && !isMaximized()) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
if (!window()->windowHandle()->startSystemMove()) {
move(event->globalPos() - m_oldMousePos);
}
#else
move(event->globalPos() - m_oldMousePos);
#endif // QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
event->accept();
}

Expand Down

0 comments on commit 203274a

Please sign in to comment.