.h
#ifndef MOVABLE_BASE_DLG_H
#define MOVABLE_BASE_DLG_H
#include <QDialog>
class QPoint;
class QPaintEvent;
class OBSMovableDialog :public QDialog{
public:
OBSMovableDialog(QWidget* parent);
~OBSMovableDialog(){};
protected:
virtual void mouseReleaseEvent(QMouseEvent *event) override;
virtual void mouseMoveEvent(QMouseEvent *event) override;
virtual void mousePressEvent(QMouseEvent *event) override;
virtual void paintEvent(QPaintEvent* event) override;
virtual void setVisible(bool visible) override;
private:
bool m_Drag = false;
QPoint m_DragPosition;
};
#endif
.cpp
#include <QCloseEvent>
#include <QPoint>
#include <QPainter>
#include <QDebug>
#include <qmat
#ifndef MOVABLE_BASE_DLG_H
#define MOVABLE_BASE_DLG_H
#include <QDialog>
class QPoint;
class QPaintEvent;
class OBSMovableDialog :public QDialog{
public:
OBSMovableDialog(QWidget* parent);
~OBSMovableDialog(){};
protected:
virtual void mouseReleaseEvent(QMouseEvent *event) override;
virtual void mouseMoveEvent(QMouseEvent *event) override;
virtual void mousePressEvent(QMouseEvent *event) override;
virtual void paintEvent(QPaintEvent* event) override;
virtual void setVisible(bool visible) override;
private:
bool m_Drag = false;
QPoint m_DragPosition;
};
#endif
.cpp
#include <QCloseEvent>
#include <QPoint>
#include <QPainter>
#include <QDebug>
#include <qmat