增加qss支持

This commit is contained in:
work-zym\zhangyiming 2024-12-13 14:10:21 +08:00
parent d78da30964
commit e53ad5903c
7 changed files with 104 additions and 3 deletions

Binary file not shown.

View File

@ -62,5 +62,6 @@
<file>image/EGG_icon_newShec_checked.png</file>
<file>image/EGG_icon_newShec_hover.png</file>
<file>image/EGG_icond_DeleteSh.png</file>
<file>qssstyle.qss</file>
</qresource>
</RCC>

View File

@ -18,7 +18,13 @@
#include <QTextCodec>
#include "logger.h"
void LoadStyleFile(QString strStyle)
{
QFile qss(strStyle);
qss.open(QFile::ReadOnly);
qApp->setStyleSheet(qss.readAll());
qss.close();
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
@ -33,7 +39,10 @@ int main(int argc, char *argv[])
QFont globalFont;
globalFont.setFamily("黑体");
QApplication::setFont(globalFont);
//
LoadStyleFile(QApplication::applicationDirPath()+"/defaultstyle.qss");
#if 0
QString qss1=R"(
QLineEdit{
border: 1px solid #ABCDA0; /* 边框宽度为1px颜色为#A0A0A0 */
@ -92,7 +101,7 @@ QTextEdit{ color: black;
a.setStyleSheet(qss1);
#endif
return a.exec();
}

View File

@ -116,6 +116,7 @@ void MedicalRecordWidget::init()
// m_labName.setFixedWidth(iwidth);
// m_labLaterality.setFixedWidth(iwidth);
//m_labDiagnosticRecord.setFixedWidth(iwidth);
#if 1
m_btnOk.setStyleSheet("QPushButton{\
background: white;\
border-radius:10px;padding:7px 10px;\
@ -150,6 +151,7 @@ void MedicalRecordWidget::init()
border-radius:10px;padding:7px 10px;\
}");
#endif
#endif
}
void MedicalRecordWidget::initLay()
{

View File

@ -0,0 +1,86 @@
QLineEdit
{
border: 1px solid #ABCDA0;
border-radius: 3px;
padding-left: 5px;
background-color: #F2F2F2;
color: #A0A0A0;
selection-background-color: #A0A0A0;
selection-color: #F2F2F2;
font-family: "Microsoft YaHei";
font-size: 10pt;
}
QLineEdit:hover
{
border: 1px solid #298DFF;
border-radius: 3px;
background-color: #F2F2F2;
color: #298DFF;
selection-background-color: #298DFF;
selection-color: #F2F2F2;
}
QLineEdit[echoMode="2"]
{
lineedit-password-character: 9679;
lineedit-password-mask-delay: 2000;
}
QLineEdit:disabled
{
border: 1px solid #CDCDCD;
background-color: #CDCDCD;
color: #B4B4B4;
}
QLineEdit:read-only
{
background-color: #CDCDCD;
color: #F2F2F2;
}
QTextEdit
{
color: black;
background-color: white;
border:1px solid black;
}
QPushButton
{border:1px solid black;}
QGroupBox
{
background-color: #4F4F4F;
border: 1px solid #969696;
color: rgb(13,157,219);
border-radius: 5px;
margin-top: 2ex;
}
QDateEdit
{
border: 1px solid rgb(22,63,23);
color: black;
}
QPushButton
{
background: white;
border-radius:10px;
padding:7px 10px;
}
QPushButton:hover
{
background: #0d9ddb;
border-radius:10px;
padding:7px 10px;
}
QPushButton:pressed
{
background: #0d9aab;
border-radius:10px;
padding:7px 10px;
}
QPushButton:checked
{
background: #0d9ddb;
border-radius:10px;
padding:7px 10px;
};

View File

@ -92,3 +92,6 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
RESOURCES += \
egg.qrc
DISTFILES += \
qssstyle.qss

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.9.1, 2024-11-29T16:52:00. -->
<!-- Written by QtCreator 4.9.1, 2024-12-09T09:05:51. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>