qt/LedOK/basewin.h
2024-08-07 18:18:37 +08:00

44 lines
1.2 KiB
C++

#ifndef BASEWIN_H
#define BASEWIN_H
#include <QWidget>
#include <QPen>
class BaseWin : public QWidget {
Q_OBJECT
public:
explicit BaseWin(QWidget *parent = 0);
QWidget *center{0};
QPen borderPenAct{Qt::gray};
QPen borderPenUnact{Qt::lightGray};
qreal roundRadius{6.0};
QPointF titlePos{36, 26};
QPixmap icon;
QRectF iconPos{13, 13, 16, 16};
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;
#ifdef Q_OS_WINDOWS
#if(QT_VERSION_MAJOR > 5)
bool nativeEvent(const QByteArray &eventType, void *message, qintptr *result) override;
#else
bool nativeEvent(const QByteArray &, void *, long *) override;
#endif
#endif
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