54 lines
1.2 KiB
C
54 lines
1.2 KiB
C
|
#ifndef LOQMAINWINDOW_H
|
||
|
#define LOQMAINWINDOW_H
|
||
|
|
||
|
#include <QMainWindow>
|
||
|
#include <QMouseEvent>
|
||
|
#include <QPainter>
|
||
|
#include <QPaintEvent>
|
||
|
#include <QStyleOption>
|
||
|
|
||
|
class LoQMainWindow : public QMainWindow
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
public:
|
||
|
explicit LoQMainWindow(QWidget *parent = nullptr);
|
||
|
|
||
|
public:
|
||
|
virtual void mousePressEvent(QMouseEvent *event);
|
||
|
virtual void mouseMoveEvent(QMouseEvent *event);
|
||
|
virtual void mouseReleaseEvent(QMouseEvent *event);
|
||
|
virtual void paintEvent(QPaintEvent *);
|
||
|
|
||
|
private:
|
||
|
bool m_winMove=false;
|
||
|
QPoint m_winOrgPoint;
|
||
|
QPoint m_winWorldPoint;
|
||
|
|
||
|
|
||
|
enum {
|
||
|
TOPLEFT = 11,
|
||
|
TOP = 12,
|
||
|
TOPRIGHT = 13,
|
||
|
LEFT = 21,
|
||
|
CENTER = 22,
|
||
|
RIGHT = 23,
|
||
|
BUTTOMLEFT = 31,
|
||
|
BUTTOM = 32,
|
||
|
BUTTOMRIGHT = 33
|
||
|
};
|
||
|
|
||
|
#define FRAMESHAPE 10
|
||
|
|
||
|
int CalCursorCol(QPoint pt); //计算鼠标X的位置
|
||
|
int CalCursorPos(QPoint pt, int colPos); //计算鼠标的位置
|
||
|
void setCursorShape(int CalPos); //设置鼠标对应位置的形状
|
||
|
|
||
|
private:
|
||
|
int m_iCalCursorPos;
|
||
|
bool m_bLeftPress;
|
||
|
QRect m_rtPreGeometry;
|
||
|
QPoint m_ptViewMousePos;
|
||
|
};
|
||
|
|
||
|
#endif // LOQMAINWINDOW_H
|