qt/ledset/moduleunit.h
2023-05-27 17:43:57 +08:00

38 lines
1018 B
C++

#ifndef MODULEUNIT_H
#define MODULEUNIT_H
#include <QWidget>
#include <QVBoxLayout>
#include <QPen>
#define m_handleLen 10
class ExpertBoxLayoutWin;
class ModuleUnit : public QWidget {
Q_OBJECT
public:
explicit ModuleUnit(ExpertBoxLayoutWin *, const QString &name, int x, int y, int w, int h, QWidget *parent = nullptr);
ExpertBoxLayoutWin *expertWin{0};
QString name;
int mX, mY, mW, mH;
protected:
void paintEvent(QPaintEvent *) override;
void mousePressEvent(QMouseEvent *) override;
void mouseReleaseEvent(QMouseEvent *) override;
void mouseMoveEvent(QMouseEvent *) override;
void leaveEvent(QEvent *) override;
void setFrmSec(const QPoint &);
void setFrmSecIfNeed(Qt::WindowFrameSection frmSec, Qt::CursorShape cursor);
void clearSnap();
QPen mSidePen{Qt::white};
QPoint mPressRel{INT_MIN, INT_MIN};
Qt::WindowFrameSection mFrmSec{Qt::NoSection};
char mLRSnap{0}, mTBSnap{0};
QList<ModuleUnit *> mOtherEles;
};
#endif // MODULEUNIT_H