qt/LedOK/basedlg.h
2023-04-19 14:42:06 +08:00

33 lines
853 B
C++

#ifndef BASEDLG_H
#define BASEDLG_H
#include <QDialog>
#include <QPen>
class BaseDlg : public QDialog {
Q_OBJECT
public:
explicit BaseDlg(QWidget *parent = nullptr);
QPen borderPenAct = QPen(Qt::gray);
QPen borderPenUnact = QPen(Qt::lightGray);
qreal roundRadius = 6.0;
QPixmap icon;
QPointF iconPos = QPointF(12, 12);
protected:
void paintEvent(QPaintEvent *) override;
void mousePressEvent(QMouseEvent *) override;
void mouseReleaseEvent(QMouseEvent *) override;
void mouseMoveEvent(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
QPoint pressRel;
bool isActive = false;
};
#endif // BASEDLG_H