[ref]同步711

This commit is contained in:
shi_jq 2025-03-13 14:25:02 +08:00
parent 56b9649be6
commit 7b50cd334d
5 changed files with 41 additions and 27 deletions

View File

@ -13,32 +13,15 @@
#include <QJsonArray> #include <QJsonArray>
CDevGroupLockWidget::CDevGroupLockWidget(QWidget *parent) : CDevGroupLockWidget::CDevGroupLockWidget(QWidget *parent) :
QWidget(parent), CustomUiDialog(parent),
ui(new Ui::CDevGroupLockWidget), ui(new Ui::CDevGroupLockWidget),
m_infoForm(Q_NULLPTR), m_infoForm(Q_NULLPTR),
m_pmodel(Q_NULLPTR) m_pmodel(Q_NULLPTR)
{ {
setWindowTitle(tr("设备组内闭锁配置"));
ui->setupUi(this); ui->setupUi(this);
qRegisterMetaType<LockInfoPtr>("LockInfoPtr"); qRegisterMetaType<LockInfoPtr>("LockInfoPtr");
QString qss = QString();
std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss") ;
QFile qssfile1(QString::fromStdString(strFullPath));
qssfile1.open(QFile::ReadOnly);
if (qssfile1.isOpen())
{
qss += QLatin1String(qssfile1.readAll());
//setStyleSheet(qss);
qssfile1.close();
}
else
{
qDebug() << "public.qss 无法打开!";
}
if(!qss.isEmpty())
{
setStyleSheet(qss);
}
ui->splitter->setSizes(QList<int>()<<300<<300); ui->splitter->setSizes(QList<int>()<<300<<300);
initView(); initView();
@ -46,6 +29,7 @@ CDevGroupLockWidget::CDevGroupLockWidget(QWidget *parent) :
m_pmodel->updateData(loadJson()); m_pmodel->updateData(loadJson());
initConnect(); initConnect();
CustomUiDialog::setAutoLayout(true);
} }
CDevGroupLockWidget::~CDevGroupLockWidget() CDevGroupLockWidget::~CDevGroupLockWidget()

View File

@ -5,12 +5,13 @@
#include "CDevGroupLockInfoForm.h" #include "CDevGroupLockInfoForm.h"
#include "CLockTableModel.h" #include "CLockTableModel.h"
#include "CLockInfo.h" #include "CLockInfo.h"
#include "pub_widget/CustomDialog.h"
namespace Ui { namespace Ui {
class CDevGroupLockWidget; class CDevGroupLockWidget;
} }
class CDevGroupLockWidget : public QWidget class CDevGroupLockWidget : public CustomUiDialog
{ {
Q_OBJECT Q_OBJECT

View File

@ -15,16 +15,16 @@
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>5</number>
</property> </property>
<property name="topMargin"> <property name="topMargin">
<number>0</number> <number>5</number>
</property> </property>
<property name="rightMargin"> <property name="rightMargin">
<number>0</number> <number>5</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>5</number>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QFrame" name="frame"> <widget class="QFrame" name="frame">

View File

@ -10,6 +10,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = DevGroupLock TARGET = DevGroupLock
TEMPLATE = app TEMPLATE = app
#CONFIG += console
@ -49,7 +50,7 @@ FORMS += \
CDevGroupLockWidget.ui \ CDevGroupLockWidget.ui \
CDevGroupLockInfoForm.ui CDevGroupLockInfoForm.ui
LIBS += -llog4cplus -lpub_logger_api -lpub_utility_api -lScriptForm LIBS += -llog4cplus -lpub_logger_api -lpub_utility_api -lScriptForm -lpub_widget
COMMON_PRI =$$PWD/../../common.pri COMMON_PRI =$$PWD/../../common.pri

View File

@ -1,13 +1,41 @@

#include <QApplication> #include <QApplication>
#include "common/QtAppGlobalSet.h" #include "common/QtAppGlobalSet.h"
#include "CDevGroupLockWidget.h" #include "CDevGroupLockWidget.h"
#include "pub_utility_api/FileStyle.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
iot_common::doQtAppGlobalSet(); iot_common::doQtAppGlobalSet();
QApplication a(argc, argv); QApplication a(argc, argv);
QString qss = QString();
std::string strFullPath = iot_public::CFileStyle::getPathOfStyleFile("public.qss","zh","light");
QFile qssfile1(QString::fromStdString(strFullPath));
qssfile1.open(QFile::ReadOnly);
if (qssfile1.isOpen())
{
qss += QLatin1String(qssfile1.readAll());
qssfile1.close();
}
strFullPath = iot_public::CFileStyle::getPathOfStyleFile("DevGroupLock.qss","zh","light");
QFile qssfile2(QString::fromStdString(strFullPath));
qssfile2.open(QFile::ReadOnly);
if (qssfile2.isOpen())
{
qss += QLatin1String(qssfile2.readAll());
qssfile2.close();
}
if (!qss.isEmpty())
{
qApp->setStyleSheet(qss);
}
// qApp->setFont(QFont("Microsoft YaHei",10));
CDevGroupLockWidget w; CDevGroupLockWidget w;
w.show(); w.show();