qt/LedOK/basewin.h

44 lines
1.2 KiB
C
Raw Normal View History

2022-08-25 18:40:38 +08:00
#ifndef BASEWIN_H
#define BASEWIN_H
#include <QWidget>
#include <QPen>
class BaseWin : public QWidget {
Q_OBJECT
public:
2023-08-01 11:42:41 +08:00
explicit BaseWin(QWidget *parent = 0);
QWidget *center{0};
2022-08-25 18:40:38 +08:00
QPen borderPenAct{Qt::gray};
QPen borderPenUnact{Qt::lightGray};
qreal roundRadius{6.0};
QPointF titlePos{36, 26};
QPixmap icon;
2023-09-19 11:49:20 +08:00
QRectF iconPos{13, 13, 16, 16};
2022-08-25 18:40:38 +08:00
protected:
void paintEvent(QPaintEvent *) override;
void mousePressEvent(QMouseEvent *) override;
void mouseReleaseEvent(QMouseEvent *) override;
void mouseMoveEvent(QMouseEvent *) override;
void leaveEvent(QEvent *) override;
bool eventFilter(QObject *, QEvent *) override;
void changeEvent(QEvent *) override;
void mouseDoubleClickEvent(QMouseEvent *) override;
2023-04-19 14:42:06 +08:00
#ifdef Q_OS_WINDOWS
#if(QT_VERSION_MAJOR > 5)
bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
#else
2022-08-25 18:40:38 +08:00
bool nativeEvent(const QByteArray &, void *, long *) override;
2023-04-19 14:42:06 +08:00
#endif
#endif
2022-08-25 18:40:38 +08:00
void setFrmSec(const QPoint &pos);
void setFrmSecIfNeed(Qt::WindowFrameSection frmSec, Qt::CursorShape cursor);
QPoint mPressRel{INT_MAX, INT_MAX};
2024-08-07 18:18:37 +08:00
Qt::WindowFrameSection mFrmSec = Qt::NoSection;
bool isActive = false;
2022-08-25 18:40:38 +08:00
};
#endif // BASEWIN_H