99 lines
3.1 KiB
C++
99 lines
3.1 KiB
C++
|
#include "expertboxlayoutwin.h"
|
||
|
#include "moduleunit.h"
|
||
|
#include "gutil/qgui.h"
|
||
|
#include <QPushButton>
|
||
|
#include <QCheckBox>
|
||
|
#include <QMessageBox>
|
||
|
#include <QScrollArea>
|
||
|
|
||
|
ExpertBoxLayoutWin::ExpertBoxLayoutWin(QWidget *parent) : BaseWin{parent} {
|
||
|
//setWindowModality(Qt::WindowModal);
|
||
|
setAttribute(Qt::WA_DeleteOnClose);
|
||
|
setWindowTitle("箱体高级布局");
|
||
|
resize(1024, 720);
|
||
|
|
||
|
auto vBox = new VBox(center);
|
||
|
vBox->setContentsMargins(0,0,0,0);
|
||
|
vBox->setSpacing(3);
|
||
|
vBox->addLayout(addBtns(new QHBoxLayout()));
|
||
|
|
||
|
auto hBox = new HBox(vBox);
|
||
|
vBox = new VBox(hBox);
|
||
|
|
||
|
vBox->addWidget(new QLabel("模组编辑"));
|
||
|
|
||
|
auto grid = new Grid(vBox);
|
||
|
auto btnAdd = new QPushButton("添加");
|
||
|
grid->addWidget(btnAdd, 0, 0);
|
||
|
auto btnDel = new QPushButton("删除");
|
||
|
grid->addWidget(btnDel, 0, 1);
|
||
|
auto btnMove = new QPushButton("移动");
|
||
|
grid->addWidget(btnMove, 1, 0);
|
||
|
auto btnRotate = new QPushButton("旋转");
|
||
|
grid->addWidget(btnRotate, 1, 1);
|
||
|
|
||
|
vBox->addWidget(new QLabel("HUB口编辑"));
|
||
|
|
||
|
grid = new Grid(vBox);
|
||
|
auto btnPort = new QPushButton("端口");
|
||
|
grid->addWidget(btnPort, 0, 0);
|
||
|
auto btnManual = new QPushButton("手动");
|
||
|
grid->addWidget(btnManual, 0, 1);
|
||
|
auto btnUp = new QPushButton("上移");
|
||
|
grid->addWidget(btnUp, 1, 0);
|
||
|
auto btnDown = new QPushButton("下移");
|
||
|
grid->addWidget(btnDown, 1, 1);
|
||
|
|
||
|
vBox->addWidget(new QLabel("HUB口编辑"));
|
||
|
|
||
|
grid = new Grid(vBox);
|
||
|
auto fdHasPos = new QCheckBox("位置");
|
||
|
grid->addWidget(fdHasPos, 0, 0);
|
||
|
auto fdHasSize = new QCheckBox("大小");
|
||
|
grid->addWidget(fdHasSize, 0, 1);
|
||
|
auto fdHasConn = new QCheckBox("连接");
|
||
|
grid->addWidget(fdHasConn, 1, 0);
|
||
|
auto fdHasName = new QCheckBox("名称");
|
||
|
grid->addWidget(fdHasName, 1, 1);
|
||
|
auto fdHasOutline = new QCheckBox("轮廓");
|
||
|
grid->addWidget(fdHasOutline, 2, 0);
|
||
|
auto fdHasRotate = new QCheckBox("旋转");
|
||
|
grid->addWidget(fdHasRotate, 2, 1);
|
||
|
|
||
|
vBox->addStretch();
|
||
|
|
||
|
vBox = new VBox(hBox);
|
||
|
hBox = new HBox(vBox);
|
||
|
hBox->addStretch();
|
||
|
|
||
|
auto scroll = new QScrollArea;
|
||
|
vBox->addWidget(scroll);
|
||
|
|
||
|
auto screen = new QWidget(scroll);
|
||
|
screen->setGeometry(0, 0, 1024, 1024);
|
||
|
screen->setAutoFillBackground(true);
|
||
|
auto pal = palette();
|
||
|
pal.setColor(QPalette::Window, QColor(0x222222));
|
||
|
screen->setPalette(pal);
|
||
|
|
||
|
int idx = 0;
|
||
|
for(int rr=0; rr<4; rr++) {
|
||
|
QString name = "P"+QString::number(rr+1);
|
||
|
|
||
|
auto unit = new ModuleUnit(this, name, idx, 0, 128, 128, screen);
|
||
|
unit->setAutoFillBackground(true);
|
||
|
pal.setColor(QPalette::Window, colors[rr]);
|
||
|
unit->setPalette(pal);
|
||
|
idx += 128;
|
||
|
}
|
||
|
|
||
|
// connect(canvas, &ResizeEmitedWgt::resized, this, [this, canvas, screen] {
|
||
|
// screen->resize(qRound(screenWidth*rate), qRound(screenHeight*rate));
|
||
|
// auto children = screen->children();
|
||
|
// foreach(auto childObj, children) {
|
||
|
// auto unit = static_cast<ScreenUnit*>(childObj);
|
||
|
// unit->setGeometry(qRound(unit->mX*rate), qRound(unit->mY*rate), qRound(unit->mW*rate), qRound(unit->mH*rate));
|
||
|
// }
|
||
|
// });
|
||
|
}
|