FaceAccess/Linguist/setUi/settingUIProjectSet.cpp

67 lines
2.4 KiB
C++
Raw Normal View History

2024-07-11 11:27:12 +08:00
#include <QTime>
#include <UiTools.h>
#include <QDebug>
#include "settingUIProjectSet.h"
#include "settingUi.h"
const int settingUIProjectSet::BtnQty = settingUi::PAGE_DEV_TEST - settingUi::PAGE_INFO;
const int settingUIProjectSet::FristPageIndex = settingUi::PAGE_INFO;
settingUIProjectSet::settingUIProjectSet(QWidget *parent) : MyWidgetWithSubStyleColor(parent)
{
qDebug() << "settingUIProjectSet()";
//setStyleSheet(" background:rgb(240, 242, 245);");//border-width:0;border-style:outset;
//setFixedWidth(UiConfig::GetInstance()->getUiWidth());
const int btnWidth = ( UiConfig::GetInstance()->getUiWidth() - 4 * nSpace ) / 3;
const QSize btnSize(btnWidth, btnWidth);
const QString btnsName[BtnQty] = {":/res/image/ProjectSetCheckInfo.png",
":/res/image/ProjectSetDevMng.png",
":/res/image/ProjectSetFaceMng.png",
":/res/image/ProjectSetAccMng.png",
":/res/image/ProjectSetReco.png",
":/res/image/ProjectSetSysMng.png",
":/res/image/ProjectSetFastCfg.png",
":/res/image/ProjectSetNetwork.png"
};
QGridLayout* pLayout = new QGridLayout();
m_pPushBtns = new QPushButton[BtnQty];
int col = 0;
for(int i = 0; i < BtnQty; i ++){
m_pPushBtns[i].setParent(this);
settingUi* setUi = dynamic_cast<settingUi*>(parent);
if(setUi){
setPushButton(&m_pPushBtns[i], (*setUi)[static_cast<unsigned>(FristPageIndex + i)], btnsName[i], btnSize);
pLayout->addWidget(&m_pPushBtns[i], i / 3, col++);
if(3 == col){
col = 0;
}
connect(&m_pPushBtns[i], SIGNAL(clicked()), this, SLOT(slotBtnClicked()));
}
else {
qDebug() << "oooop!";
}
}
pLayout->setSpacing(nSpace);
pLayout->setMargin(0);
QLabel *pEmpty = new QLabel(this);
QVBoxLayout* _VLayout = new QVBoxLayout();
_VLayout->addLayout(pLayout,3);
_VLayout->addWidget(pEmpty, 1);
_VLayout->setMargin(nSpace);
setLayout(_VLayout);
}
void settingUIProjectSet::slotBtnClicked()
{
for(int i = 0; i <= BtnQty; i ++){
if(sender() == &m_pPushBtns[i]){
emit pageSetSignal(i + FristPageIndex);
break;
}
}
}