mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
35 lines
1.4 KiB
C++
35 lines
1.4 KiB
C++
|
|
#include "MyQUI.h"
|
||
|
|
|
||
|
|
static const std::string QSS_GROUP =
|
||
|
|
"QGroupBox { border: 1px solid gray; margin-top: 8px; border-radius: 5px;}"
|
||
|
|
"QGroupBox::title { subcontrol-origin: margin; subcontrol-position: top left; left:10px; margin-left: 0px; padding:0 1px; }";
|
||
|
|
|
||
|
|
|
||
|
|
static const std::string QSS_BTN_MENU =
|
||
|
|
"QPushButton {background:rgba(50,128,218,200);color:white;border-radius:5px;border:2px solid rgb(10,120,215);font:bold 18px;}"
|
||
|
|
"QPushButton:hover {background-color:rgb(32,164,128);}"
|
||
|
|
"QPushButton:pressed {border-width:3px 0 0 3px;background-color:rgb(1,32,54);border-style:inset;}"
|
||
|
|
"QPushButton:disabled {color:rgb(150,150,150);}";
|
||
|
|
|
||
|
|
static const std::string QSS_LINE =
|
||
|
|
"QLineEdit { background-color: rgb(14, 49, 66); color: #ffffff; border: 1px solid gray; border-radius: 5px; font: bold 13px; }";
|
||
|
|
|
||
|
|
std::shared_ptr<QGroupBox> MyQUI::GroupBox(QWidget* parent, int x, int y, int w, int h, std::string title)
|
||
|
|
{
|
||
|
|
auto groupBox = std::make_shared<QGroupBox>(title.c_str(), parent);
|
||
|
|
groupBox->setGeometry(x, y, w, h);
|
||
|
|
groupBox->setStyleSheet(QSS_GROUP.c_str());
|
||
|
|
return groupBox;
|
||
|
|
}
|
||
|
|
|
||
|
|
void MyQUI::PairLine(QWidget* parent, int x, int y, string k, string v)
|
||
|
|
{
|
||
|
|
auto key = new QLabel(parent);
|
||
|
|
key->setText(k.c_str());
|
||
|
|
key->setGeometry(x, y, 80, 26);
|
||
|
|
auto value = new QLineEdit(parent);
|
||
|
|
value->setText(v.c_str());
|
||
|
|
value->setGeometry(x+80, y, 260, 26);
|
||
|
|
value->setStyleSheet(QSS_LINE.c_str());
|
||
|
|
value->setReadOnly(true);
|
||
|
|
}
|