2023-04-18 18:21:34 +08:00
|
|
|
#ifndef EXPERTBOXLAYOUTWIN_H
|
|
|
|
#define EXPERTBOXLAYOUTWIN_H
|
|
|
|
|
|
|
|
#include "basewin.h"
|
2023-08-21 11:21:00 +08:00
|
|
|
#include "gutil/qjson.h"
|
2023-04-18 18:21:34 +08:00
|
|
|
#include <QLabel>
|
2023-08-21 11:21:00 +08:00
|
|
|
#include <QButtonGroup>
|
|
|
|
#include <QCheckBox>
|
2023-04-18 18:21:34 +08:00
|
|
|
|
2023-08-21 11:21:00 +08:00
|
|
|
class ExpertWin;
|
|
|
|
class BoxPanel;
|
2023-04-18 18:21:34 +08:00
|
|
|
class ExpertBoxLayoutWin : public BaseWin {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2023-08-21 11:21:00 +08:00
|
|
|
explicit ExpertBoxLayoutWin(ExpertWin *parent = 0);
|
|
|
|
|
|
|
|
QCheckBox *fdHasPos, *fdHasSize, *fdHasConn, *fdHasName, *fdHasOutline;
|
|
|
|
QButtonGroup *grpGrp;
|
|
|
|
BoxPanel *box{0};
|
|
|
|
QLabel *fdModNum, *fdBoxSize;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ModuleUnit;
|
|
|
|
class BoxPanel : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit BoxPanel(ExpertBoxLayoutWin *boxWin) : boxWin(boxWin) {}
|
|
|
|
|
|
|
|
void fitSize() {
|
|
|
|
boxRect = childrenRect();
|
|
|
|
auto www = qMax(1000, boxRect.x()+boxRect.width()+1);
|
|
|
|
auto hhh = qMax(1000, boxRect.y()+boxRect.height()+1);
|
|
|
|
if(www!=width() || hhh!=height()) resize(www, hhh);
|
|
|
|
else update();
|
|
|
|
boxWin->fdBoxSize->setText(QString("%1 x %2").arg(boxRect.width()).arg(boxRect.height()));
|
|
|
|
}
|
|
|
|
|
|
|
|
QRect boxRect, grpRect;
|
|
|
|
ExpertBoxLayoutWin *boxWin;
|
2023-07-28 14:48:41 +08:00
|
|
|
double rate{1};
|
2023-08-21 11:21:00 +08:00
|
|
|
QRectF rect;
|
|
|
|
bool isDrawing{false};
|
|
|
|
protected:
|
|
|
|
void mousePressEvent(QMouseEvent *event) override;
|
|
|
|
void mouseReleaseEvent(QMouseEvent *) override;
|
|
|
|
void mouseMoveEvent(QMouseEvent *event) override;
|
|
|
|
void paintEvent(QPaintEvent *event) override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ModuleUnit : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit ModuleUnit(int, int, int, int, const JObj &module, const QString &name, QWidget *parent = nullptr);
|
|
|
|
|
|
|
|
void drawed();
|
|
|
|
int mX, mY, mW, mH;
|
|
|
|
JObj mModule;
|
|
|
|
QString name;
|
|
|
|
BoxPanel *box;
|
|
|
|
QPoint mPressRel{INT_MIN, INT_MIN};
|
|
|
|
bool isSel{false};
|
|
|
|
protected:
|
|
|
|
void mousePressEvent(QMouseEvent *) override;
|
|
|
|
void mouseReleaseEvent(QMouseEvent *) override;
|
|
|
|
void mouseMoveEvent(QMouseEvent *) override;
|
|
|
|
|
|
|
|
std::vector<ModuleUnit *> mOtherSels;
|
2023-04-18 18:21:34 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // EXPERTBOXLAYOUTWIN_H
|