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:
explicit BaseWin(QWidget *parent = nullptr);
QWidget *center{nullptr};
QPen borderPenAct{Qt::gray};
QPen borderPenUnact{Qt::lightGray};
qreal roundRadius{6.0};
QPointF titlePos{36, 26};
QPixmap icon;
QPointF iconPos{13, 13};
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};
Qt::WindowFrameSection mFrmSec{Qt::NoSection};
bool isActive{false};
};
#endif // BASEWIN_H