mirror of
https://gitlab.com/comunic/comunicwatcher
synced 2024-11-22 13:29:25 +00:00
Made window moveable
This commit is contained in:
parent
416e6d44c5
commit
6b76aa3847
@ -20,3 +20,20 @@ void LoginWindow::on_closeButton_clicked()
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void LoginWindow::mousePressEvent(QMouseEvent *evt)
|
||||
{
|
||||
mOldPos = evt->globalPos();
|
||||
}
|
||||
|
||||
void LoginWindow::mouseMoveEvent(QMouseEvent *evt)
|
||||
{
|
||||
const QPoint delta = evt->globalPos() - mOldPos;
|
||||
if (false)
|
||||
// if locked, ignore delta on y axis, stay at the top
|
||||
move(x()+delta.x(), y());
|
||||
else
|
||||
move(x()+delta.x(), y()+delta.y());
|
||||
mOldPos = evt->globalPos();
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMouseEvent>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class LoginWindow; }
|
||||
@ -20,9 +21,14 @@ public:
|
||||
LoginWindow(QWidget *parent = nullptr);
|
||||
~LoginWindow();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *evt);
|
||||
void mouseMoveEvent(QMouseEvent *evt);
|
||||
|
||||
private slots:
|
||||
void on_closeButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::LoginWindow *ui;
|
||||
QPoint mOldPos;
|
||||
};
|
||||
|
@ -9,8 +9,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>337</width>
|
||||
<height>600</height>
|
||||
<width>330</width>
|
||||
<height>501</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
Loading…
Reference in New Issue
Block a user