mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
实现HTTP服务架构
This commit is contained in:
@@ -20,7 +20,7 @@ PvTable::PvTable(PARAM* p, int parent, int x, int y, int w, int irow, Options& o
|
||||
pvid = PvApp::widget(p, parent, x, y, w, h+1);
|
||||
// 表格的背景色和边框样式
|
||||
|
||||
PvApp::label(p, pvid, 0, 0, w, h+1, "", qss::QSS_TABLE);
|
||||
PvApp::label(p, pvid, 0, 0, w, h+1, "", QSS::QSS_TABLE);
|
||||
|
||||
vecHeads.resize(0);
|
||||
vecRows.resize(nrow);
|
||||
@@ -30,8 +30,8 @@ PvTable::PvTable(PARAM* p, int parent, int x, int y, int w, int irow, Options& o
|
||||
for (int row = 0; row < nrow; row++)
|
||||
{
|
||||
int y = row * option.row_height + (option.show_header ? option.head_height : 0);
|
||||
string qss = (row % 2 != 0) ? qss::QSS_TABLE_ROW_0 : qss::QSS_TABLE_ROW_1;
|
||||
int widgetRow = PvApp::label(p, pvid, 1, y, rect.w-2, option.row_height, "", qss);
|
||||
string QSS = (row % 2 != 0) ? QSS::QSS_TABLE_ROW_0 : QSS::QSS_TABLE_ROW_1;
|
||||
int widgetRow = PvApp::label(p, pvid, 1, y, rect.w-2, option.row_height, "", QSS);
|
||||
pvHide(p, widgetRow);
|
||||
vecRows[row].widget = widgetRow;
|
||||
}
|
||||
@@ -48,13 +48,13 @@ void PvTable::addHead(string id, string text, int width, vector<pair<string, str
|
||||
// 创建表头的标签
|
||||
if (option.show_header)
|
||||
{
|
||||
vecHeads[col].pvid = PvApp::label(p, pvid, posCol, 0, width, option.head_height, text, qss::QSS_TABLE_HEAD);
|
||||
vecHeads[col].pvid = PvApp::label(p, pvid, posCol, 0, width, option.head_height, text, QSS::QSS_TABLE_HEAD);
|
||||
}
|
||||
|
||||
// 创建列的单元格
|
||||
for (int row = 0; row < nrow; ++row)
|
||||
{
|
||||
int cellId = PvApp::label(p, vecRows[row].widget, posCol, 0, width, option.row_height, "", qss::QSS_TABLE_CELL);
|
||||
int cellId = PvApp::label(p, vecRows[row].widget, posCol, 0, width, option.row_height, "", QSS::QSS_TABLE_CELL);
|
||||
vecRows[row].vecCells.push_back(cellId);
|
||||
PvApp::bind(p, MOUSE_OVER_EVENT, cellId, [=](string s) { highlight(row, (s == "1")); });
|
||||
}
|
||||
@@ -97,11 +97,11 @@ void PvTable::setRowVisible(int irow, bool v)
|
||||
|
||||
void PvTable::highlight(int irow, bool v)
|
||||
{
|
||||
string qss = ((irow % 2 != 0) ? qss::QSS_TABLE_ROW_0 : qss::QSS_TABLE_ROW_1);
|
||||
string QSS = ((irow % 2 != 0) ? QSS::QSS_TABLE_ROW_0 : QSS::QSS_TABLE_ROW_1);
|
||||
if (vecRows.size() > 0 && irow <= vecRows.size())
|
||||
{
|
||||
if (v) { qss = "background-color:rgba(14,45,60,200);border:1px solid rgba(255,0,0,100);"; }
|
||||
pvSetStyleSheet(p, vecRows[irow].widget, qss.c_str());
|
||||
if (v) { QSS = "background-color:rgba(14,45,60,200);border:1px solid rgba(255,0,0,100);"; }
|
||||
pvSetStyleSheet(p, vecRows[irow].widget, QSS.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,11 +110,11 @@ void PvTable::addOperate(vector<string> vecOpt)
|
||||
// 创建表头的标签
|
||||
if (option.show_header)
|
||||
{
|
||||
PvApp::label(p, pvid, posCol, 0, rect.w - posCol, option.head_height, "操作", qss::QSS_TABLE_HEAD);
|
||||
PvApp::label(p, pvid, posCol, 0, rect.w - posCol, option.head_height, "操作", QSS::QSS_TABLE_HEAD);
|
||||
}
|
||||
for (int row = 0; row < nrow; ++row)
|
||||
{
|
||||
int cellWidget = PvApp::label(p, vecRows[row].widget, posCol, 0, rect.w - posCol, option.row_height, "", qss::QSS_TABLE_CELL);
|
||||
int cellWidget = PvApp::label(p, vecRows[row].widget, posCol, 0, rect.w - posCol, option.row_height, "", QSS::QSS_TABLE_CELL);
|
||||
vecOper.push_back({ cellWidget, vector<int>() });
|
||||
auto& vec_opt_btn_ = vecOper.back().second;
|
||||
int x = 5, w = 60;
|
||||
@@ -122,7 +122,7 @@ void PvTable::addOperate(vector<string> vecOpt)
|
||||
{
|
||||
auto& title = vecOpt[i];
|
||||
w = 20 + 15 * title.size() / 3;
|
||||
int btn = PvApp::button(p, cellWidget, x, 4, w, 24, title, qss::button(14, "", "", "none; border-radius: 0px"));
|
||||
int btn = PvApp::button(p, cellWidget, x, 4, w, 24, title, QSS::button(14, "", "", "none; border-radius: 0px"));
|
||||
PvApp::bind(p, PvEvent::BUTTON_EVENT, btn, [=](std::string) {
|
||||
if (callbackOper) { callbackOper(row, 0, title); }
|
||||
});
|
||||
@@ -239,7 +239,7 @@ PvPagination::PvPagination(PARAM* p, int parent, int x, int y, int n)
|
||||
PvApp::bind(p, PvEvent::BUTTON_EVENT, btn, [=](string) { this->activePage(i, true); });
|
||||
}
|
||||
btnNext = PvApp::button(p, pvid, 32, 0, 30, 30, ">", STYLE_NORMAL);
|
||||
labelInfo = PvApp::label(p, pvid, 2*32, 0, 80, 30, " 共0页", qss::label(14, "rgb(27, 220, 224)"));
|
||||
labelInfo = PvApp::label(p, pvid, 2*32, 0, 80, 30, " 共0页", QSS::label(14, "rgb(27, 220, 224)"));
|
||||
|
||||
pvSetEnabled(p, btnPrev, 0);
|
||||
pvSetEnabled(p, btnNext, 0);
|
||||
|
||||
Reference in New Issue
Block a user