feat: show drag cursor
This commit is contained in:
@@ -27,6 +27,9 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
ui = new Ui::MainWindow;
|
||||
ui->setupUi(this);
|
||||
|
||||
QWidget *topBar = ui->widget;
|
||||
topBar->setCursor(Qt::OpenHandCursor);
|
||||
|
||||
// Enable frameless window for edge-to-edge experience
|
||||
setWindowFlags(Qt::FramelessWindowHint | Qt::Window);
|
||||
setAttribute(Qt::WA_TranslucentBackground, false);
|
||||
@@ -373,6 +376,7 @@ void MainWindow::mousePressEvent(QMouseEvent *event)
|
||||
if (topBar && topBar->geometry().contains(event->pos()))
|
||||
{
|
||||
m_isDragging = true;
|
||||
setCursor(Qt::ClosedHandCursor);
|
||||
m_dragPosition = event->globalPosition().toPoint() - frameGeometry().topLeft();
|
||||
event->accept();
|
||||
return;
|
||||
@@ -397,6 +401,7 @@ void MainWindow::mouseReleaseEvent(QMouseEvent *event)
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
m_isDragging = false;
|
||||
unsetCursor();
|
||||
}
|
||||
QMainWindow::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user