HwangKC 2024-10-17 20:25:43 +08:00
parent 6f2170559d
commit f656098ad2
13 changed files with 1442 additions and 10 deletions

View File

@ -76,6 +76,7 @@ win32:LIBS += Ws2_32.lib
SOURCES += \
datafetcher.cpp \
devicepropertypage.cpp \
formserialportsettingdialog.cpp \
globalparameters.cpp \
kutilities.cpp \
main.cpp \
@ -88,6 +89,7 @@ SOURCES += \
HEADERS += \
datafetcher.h \
devicepropertypage.h \
formserialportsettingdialog.h \
globalparameters.h \
kutilities.h \
maindialog.h \
@ -98,6 +100,7 @@ HEADERS += \
ziputils.h
FORMS += \
formserialportsettingdialog.ui \
maindialog.ui \
mainwindow.ui
@ -107,7 +110,8 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
RESOURCES += \
emscfgres.qrc
emscfgres.qrc \
qdarkstyle/bingle/img.qrc
RESOURCES += qdarkstyle/dark/darkstyle.qrc
RESOURCES += qdarkstyle/light/lightstyle.qrc

View File

@ -0,0 +1,155 @@
#include "formserialportsettingdialog.h"
#include "ui_formserialportsettingdialog.h"
#include <QListView>
#include <QStandardItemModel>
#include "globalparameters.h"
FormSerialPortSettingDialog::FormSerialPortSettingDialog(QWidget *parent)
: QDialog(parent)
, ui(new Ui::FormSerialPortSettingDialog)
{
ui->setupUi(this);
InitializeUi();
}
FormSerialPortSettingDialog::~FormSerialPortSettingDialog()
{
delete ui;
}
void FormSerialPortSettingDialog::InitializeUi()
{
ui->delay_timeout->setText("1000");
ui->loop_time->setText("5000");
ui->slave_id->setText("1");
//设置奇偶校验
ui->cb_parity->setView(new QListView(this));
QStandardItemModel* model_parity = new QStandardItemModel(this);
vecParityItemData vparity;
vparity.push_back(std::make_pair(EMS_PARITY_NONE,tr("None")));
vparity.push_back(std::make_pair(EMS_PARITY_ODD,tr("Odd")));
vparity.push_back(std::make_pair(EMS_PARITY_EVEN,tr("Even")));
for (auto it = vparity.begin(); it != vparity.end(); it++)
{
int id = it->first;
QString name = it->second;
QStandardItem* item = new QStandardItem(name);
//QVariant var = QVariant::fromValue(data);
item->setData(id);
model_parity->appendRow(item);
}
ui->cb_parity->setModel(model_parity);
//设置数据位
ui->cb_data->setView(new QListView(this));
QStandardItemModel* model_databits = new QStandardItemModel(this);
vecDataBitsItemData vdatabits;
vdatabits.push_back(std::make_pair(EMS_DATA_8_BITS,tr("8 Data bits")));
vdatabits.push_back(std::make_pair(EMS_DATA_7_BITS,tr("7 Data bits")));
for (auto it = vdatabits.begin(); it != vdatabits.end(); it++)
{
int id = it->first;
QString name = it->second;
QStandardItem* item = new QStandardItem(name);
item->setData(id);
model_databits->appendRow(item);
}
ui->cb_data->setModel(model_databits);
//设置数据位
ui->cb_stop->setView(new QListView(this));
QStandardItemModel* model_stopbits = new QStandardItemModel(this);
vecDataBitsItemData vstopbits;
vstopbits.push_back(std::make_pair(EMS_1_STOP_BITS,tr("1 Stop bit")));
vstopbits.push_back(std::make_pair(EMS_2_STOP_BITS,tr("2 Stop bits")));
for (auto it = vstopbits.begin(); it != vstopbits.end(); it++)
{
int id = it->first;
QString name = it->second;
QStandardItem* item = new QStandardItem(name);
item->setData(id);
model_stopbits->appendRow(item);
}
ui->cb_stop->setModel(model_stopbits);
//设置串口模式
ui->cb_mode->setView(new QListView(this));
QStandardItemModel* model_mode = new QStandardItemModel(this);
vecDataBitsItemData vportmode;
vportmode.push_back(std::make_pair(EMS_RTU_MODE,tr("RTU")));
vportmode.push_back(std::make_pair(EMS_ASCII_MODE,tr("ASCII")));
for (auto it = vportmode.begin(); it != vportmode.end(); it++)
{
int id = it->first;
QString name = it->second;
QStandardItem* item = new QStandardItem(name);
item->setData(id);
model_mode->appendRow(item);
}
ui->cb_mode->setModel(model_mode);
//设置串口模式
ui->cb_baund->setView(new QListView(this));
QStandardItemModel* model_baund = new QStandardItemModel(this);
vecBaundItemData vbaund;
vbaund.push_back(std::make_pair(EMS_BAUND_2400,tr("2400")));
vbaund.push_back(std::make_pair(EMS_BAUND_2400,tr("4800")));
vbaund.push_back(std::make_pair(EMS_BAUND_2400,tr("9600")));
vbaund.push_back(std::make_pair(EMS_BAUND_2400,tr("19200")));
vbaund.push_back(std::make_pair(EMS_BAUND_2400,tr("38400")));
vbaund.push_back(std::make_pair(EMS_BAUND_2400,tr("57600")));
vbaund.push_back(std::make_pair(EMS_BAUND_2400,tr("115200")));
vbaund.push_back(std::make_pair(EMS_BAUND_2400,tr("128000")));
vbaund.push_back(std::make_pair(EMS_BAUND_2400,tr("153600")));
vbaund.push_back(std::make_pair(EMS_BAUND_2400,tr("230400")));
vbaund.push_back(std::make_pair(EMS_BAUND_2400,tr("460800")));
vbaund.push_back(std::make_pair(EMS_BAUND_2400,tr("921600")));
for (auto it = vbaund.begin(); it != vbaund.end(); it++)
{
int id = it->first;
QString name = it->second;
QStandardItem* item = new QStandardItem(name);
item->setData(id);
model_baund->appendRow(item);
}
ui->cb_baund->setModel(model_baund);
ui->cb_baund->setCurrentIndex(2);
//设置串口类型
ui->cb_type->setView(new QListView(this));
QStandardItemModel* model_type = new QStandardItemModel(this);
vecPortTypeItemData vporttype;
vporttype.push_back(std::make_pair(EMS_SERIALPORT_TYPE,tr("Serial Port")));
for (auto it = vporttype.begin(); it != vporttype.end(); it++)
{
int id = it->first;
QString name = it->second;
QStandardItem* item = new QStandardItem(name);
item->setData(id);
model_type->appendRow(item);
}
ui->cb_type->setModel(model_type);
}

View File

@ -0,0 +1,26 @@
#ifndef FORMSERIALPORTSETTINGDIALOG_H
#define FORMSERIALPORTSETTINGDIALOG_H
#include <QDialog>
namespace Ui
{
class FormSerialPortSettingDialog;
}
class FormSerialPortSettingDialog : public QDialog
{
Q_OBJECT
public:
explicit FormSerialPortSettingDialog(QWidget *parent = nullptr);
~FormSerialPortSettingDialog();
private:
Ui::FormSerialPortSettingDialog *ui;
protected:
void InitializeUi();
};
#endif // FORMSERIALPORTSETTINGDIALOG_H

View File

@ -0,0 +1,549 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FormSerialPortSettingDialog</class>
<widget class="QDialog" name="FormSerialPortSettingDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>706</width>
<height>526</height>
</rect>
</property>
<property name="windowTitle">
<string>设备串口设置</string>
</property>
<property name="windowIcon">
<iconset resource="emscfgres.qrc">
<normaloff>:/images/icon.png</normaloff>:/images/icon.png</iconset>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>320</x>
<y>450</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<widget class="QLineEdit" name="device_name">
<property name="geometry">
<rect>
<x>440</x>
<y>36</y>
<width>201</width>
<height>30</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>350</x>
<y>40</y>
<width>69</width>
<height>19</height>
</rect>
</property>
<property name="text">
<string>设备名称</string>
</property>
<property name="buddy">
<cstring>device_name</cstring>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>50</x>
<y>40</y>
<width>69</width>
<height>19</height>
</rect>
</property>
<property name="text">
<string>设备序号</string>
</property>
<property name="buddy">
<cstring>device_id</cstring>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>50</x>
<y>120</y>
<width>69</width>
<height>19</height>
</rect>
</property>
<property name="text">
<string>串口类型</string>
</property>
<property name="buddy">
<cstring>cb_type</cstring>
</property>
</widget>
<widget class="QComboBox" name="cb_type">
<property name="geometry">
<rect>
<x>130</x>
<y>120</y>
<width>181</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="device_id">
<property name="geometry">
<rect>
<x>130</x>
<y>36</y>
<width>181</width>
<height>30</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="slave_id">
<property name="geometry">
<rect>
<x>440</x>
<y>120</y>
<width>201</width>
<height>30</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>360</x>
<y>120</y>
<width>69</width>
<height>19</height>
</rect>
</property>
<property name="text">
<string>从机地址</string>
</property>
<property name="buddy">
<cstring>slave_id</cstring>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>50</x>
<y>160</y>
<width>69</width>
<height>19</height>
</rect>
</property>
<property name="text">
<string>串口号</string>
</property>
<property name="buddy">
<cstring>port</cstring>
</property>
</widget>
<widget class="QLineEdit" name="port">
<property name="geometry">
<rect>
<x>130</x>
<y>160</y>
<width>181</width>
<height>30</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>360</x>
<y>160</y>
<width>69</width>
<height>19</height>
</rect>
</property>
<property name="text">
<string>波特率</string>
</property>
<property name="buddy">
<cstring>cb_baund</cstring>
</property>
</widget>
<widget class="QComboBox" name="cb_baund">
<property name="geometry">
<rect>
<x>440</x>
<y>160</y>
<width>201</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>50</x>
<y>200</y>
<width>69</width>
<height>19</height>
</rect>
</property>
<property name="text">
<string>数据位</string>
</property>
<property name="buddy">
<cstring>cb_data</cstring>
</property>
</widget>
<widget class="QComboBox" name="cb_data">
<property name="geometry">
<rect>
<x>130</x>
<y>200</y>
<width>181</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>360</x>
<y>200</y>
<width>69</width>
<height>19</height>
</rect>
</property>
<property name="text">
<string>校验位</string>
</property>
<property name="buddy">
<cstring>cb_parity</cstring>
</property>
</widget>
<widget class="QComboBox" name="cb_parity">
<property name="geometry">
<rect>
<x>440</x>
<y>200</y>
<width>201</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_9">
<property name="geometry">
<rect>
<x>50</x>
<y>240</y>
<width>69</width>
<height>19</height>
</rect>
</property>
<property name="text">
<string>停止位</string>
</property>
<property name="buddy">
<cstring>cb_stop</cstring>
</property>
</widget>
<widget class="QComboBox" name="cb_stop">
<property name="geometry">
<rect>
<x>130</x>
<y>240</y>
<width>181</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QComboBox" name="cb_mode">
<property name="geometry">
<rect>
<x>440</x>
<y>240</y>
<width>201</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_10">
<property name="geometry">
<rect>
<x>360</x>
<y>240</y>
<width>69</width>
<height>19</height>
</rect>
</property>
<property name="text">
<string>模式</string>
</property>
<property name="buddy">
<cstring>cb_mode</cstring>
</property>
</widget>
<widget class="QLabel" name="label_11">
<property name="geometry">
<rect>
<x>50</x>
<y>280</y>
<width>91</width>
<height>19</height>
</rect>
</property>
<property name="text">
<string>响应超时</string>
</property>
<property name="buddy">
<cstring>delay_timeout</cstring>
</property>
</widget>
<widget class="QLineEdit" name="delay_timeout">
<property name="geometry">
<rect>
<x>130</x>
<y>280</y>
<width>113</width>
<height>30</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_12">
<property name="geometry">
<rect>
<x>360</x>
<y>280</y>
<width>91</width>
<height>19</height>
</rect>
</property>
<property name="text">
<string>轮询间隔</string>
</property>
<property name="buddy">
<cstring>loop_time</cstring>
</property>
</widget>
<widget class="QLineEdit" name="loop_time">
<property name="geometry">
<rect>
<x>440</x>
<y>280</y>
<width>113</width>
<height>30</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_13">
<property name="geometry">
<rect>
<x>560</x>
<y>283</y>
<width>41</width>
<height>19</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>ms</string>
</property>
</widget>
<widget class="QLabel" name="label_14">
<property name="geometry">
<rect>
<x>250</x>
<y>283</y>
<width>41</width>
<height>19</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>ms</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_DTS">
<property name="geometry">
<rect>
<x>50</x>
<y>320</y>
<width>98</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>DSR</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_CTS">
<property name="geometry">
<rect>
<x>170</x>
<y>320</y>
<width>98</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>CTS</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_DTR">
<property name="geometry">
<rect>
<x>310</x>
<y>320</y>
<width>98</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>DTR</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_15">
<property name="geometry">
<rect>
<x>50</x>
<y>360</y>
<width>69</width>
<height>19</height>
</rect>
</property>
<property name="text">
<string>插件绑定</string>
</property>
</widget>
<widget class="QLineEdit" name="so_file">
<property name="geometry">
<rect>
<x>50</x>
<y>390</y>
<width>581</width>
<height>30</height>
</rect>
</property>
</widget>
<widget class="QToolButton" name="toolButton">
<property name="geometry">
<rect>
<x>640</x>
<y>391</y>
<width>41</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>...</string>
</property>
<property name="popupMode">
<enum>QToolButton::DelayedPopup</enum>
</property>
</widget>
<widget class="QLabel" name="label_16">
<property name="geometry">
<rect>
<x>50</x>
<y>80</y>
<width>69</width>
<height>19</height>
</rect>
</property>
<property name="text">
<string>制造商</string>
</property>
<property name="buddy">
<cstring>device_manufature</cstring>
</property>
</widget>
<widget class="QLineEdit" name="device_manufature">
<property name="geometry">
<rect>
<x>130</x>
<y>80</y>
<width>511</width>
<height>30</height>
</rect>
</property>
</widget>
</widget>
<tabstops>
<tabstop>device_id</tabstop>
<tabstop>device_name</tabstop>
<tabstop>device_manufature</tabstop>
<tabstop>cb_type</tabstop>
<tabstop>slave_id</tabstop>
<tabstop>port</tabstop>
<tabstop>cb_baund</tabstop>
<tabstop>cb_data</tabstop>
<tabstop>cb_parity</tabstop>
<tabstop>cb_stop</tabstop>
<tabstop>cb_mode</tabstop>
<tabstop>delay_timeout</tabstop>
<tabstop>loop_time</tabstop>
<tabstop>checkBox_DTS</tabstop>
<tabstop>checkBox_CTS</tabstop>
<tabstop>checkBox_DTR</tabstop>
<tabstop>toolButton</tabstop>
<tabstop>so_file</tabstop>
</tabstops>
<resources>
<include location="emscfgres.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>FormSerialPortSettingDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>FormSerialPortSettingDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -30,6 +30,62 @@ typedef struct _ModelItem
typedef QList<ModelItem> TableData;
//用来处理串口各种参数的ComboBox的Model
//设置奇偶检验
#define EMS_PARITY_NONE 0
#define EMS_PARITY_ODD 1
#define EMS_PARITY_EVEN 2
typedef std::pair<int,QString> ParityItemData;
typedef std::vector<ParityItemData> vecParityItemData;
//设置数据位
#define EMS_DATA_8_BITS 8
#define EMS_DATA_7_BITS 7
typedef std::pair<int,QString> DataBitsItemData;
typedef std::vector<DataBitsItemData> vecDataBitsItemData;
//设置停止位
#define EMS_1_STOP_BITS 1
#define EMS_2_STOP_BITS 2
typedef std::pair<int,QString> StopBitsItemData;
typedef std::vector<StopBitsItemData> vecStopBitsItemData;
//设置串口模式
#define EMS_RTU_MODE 1
#define EMS_ASCII_MODE 2
typedef std::pair<int,QString> PortModeItemData;
typedef std::vector<PortModeItemData> vecPortModeItemData;
//设置串口类型
#define EMS_SERIALPORT_TYPE 1
#define EMS_CANPORT_TYPE 2
typedef std::pair<int,QString> PortTypeItemData;
typedef std::vector<PortTypeItemData> vecPortTypeItemData;
//设置串口类型
#define EMS_BAUND_2400 2400
#define EMS_BAUND_4800 4800
#define EMS_BAUND_9600 9600
#define EMS_BAUND_19200 19200
#define EMS_BAUND_38400 38400
#define EMS_BAUND_57600 57600
#define EMS_BAUND_115200 115200
#define EMS_BAUND_128000 128000
#define EMS_BAUND_153600 153600
#define EMS_BAUND_230400 230400
#define EMS_BAUND_460800 460800
#define EMS_BAUND_921600 921600
typedef std::pair<int,QString> BaundItemData;
typedef std::vector<BaundItemData> vecBaundItemData;
class CWaitorCursor
{
public:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -58,7 +58,7 @@ int main(int argc, char *argv[])
#if 1
//QFile f(":qdarkstyle/light/lightstyle.qss");
QFile f(":bingle/bingle/Ubuntu.qss");
//QFile f(":bingle/bingle/flat.qss");
if (!f.exists())
{
hloge("Unable to set stylesheet, file not found");

View File

@ -15,6 +15,7 @@
#include <QStandardItemModel>
#include "devicepropertypage.h"
#include "formserialportsettingdialog.h"
MainDialog::MainDialog(QWidget *parent) :
QMainWindow (parent),
@ -214,7 +215,12 @@ void MainDialog::loadWindowState()
//增加设备
void MainDialog::onToolButton1Clicked()
{
QMessageBox::information(this, "Button Clicked", "Button 1 was clicked!");
FormSerialPortSettingDialog dlg;
dlg.setModal(true);
if(dlg.exec() == QDialog::Accepted)
QMessageBox::information(this, "OK Clicked", "Button 1 was clicked!");
else
QMessageBox::information(this, "Cancel Clicked", "Cancel was clicked!");
}
//删除设备

View File

@ -19,6 +19,9 @@
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
</widget>
<resources/>
<connections/>

View File

@ -29,7 +29,7 @@ MainWindow::MainWindow(QWidget *parent)
QRegularExpressionValidator* ipValidator = new QRegularExpressionValidator(rx, this);
ui->serverIp->setValidator(ipValidator);
//setIp("127.0.0.1");
setIp("192.168.10.254");
setIp("192.168.0.155");
}
MainWindow::~MainWindow()
@ -49,6 +49,7 @@ void MainWindow::setIp(const QString &ip)
bool MainWindow::testDatabase()
{
CWaitorCursor wait;
QString svr = ui->serverIp->text();
std::string dbserver = svr.toStdString(); //"tcp://192.168.4.254";
int dbport = 3306;

View File

@ -20,7 +20,7 @@
<string>EMS Configurer</string>
</property>
<property name="styleSheet">
<string notr="true">backfround-color:rgb(170,255,127) </string>
<string notr="true"/>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QLabel" name="label_4">
@ -47,8 +47,9 @@
</property>
<property name="font">
<font>
<pointsize>26</pointsize>
<bold>true</bold>
<family>宋体</family>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="text">
@ -82,7 +83,9 @@
</property>
<property name="font">
<font>
<pointsize>16</pointsize>
<family>宋体</family>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="text">

View File

@ -17,5 +17,6 @@
<file>NeonButtons.qss</file>
<file>Ubuntu.qss</file>
<file>material-blue.qss</file>
<file>flat.qss</file>
</qresource>
</RCC>

View File

@ -0,0 +1,628 @@
*{
font:15px "宋体";
color: rgb(230, 230, 230);
selection-background-color: rgb(255, 255, 255);/*选中文本*/
selection-color: rgb(0, 0, 0);
outline:none;/*焦点框*/
}
#centralWidget{
background-color: rgb(80, 80, 80);
border-bottom:5px solid rgb(20, 20, 20);
}
/*其他(控件公共样式在最后)*/
/*tab 1中按钮示例*/
#btnHoverOrange{
border-color:rgb(255, 170, 0);
}
#btnPressOrange{
color:black;
border-color: rgb(128, 128, 128);
background-color: qlineargradient(spread:pad, x1:1, y1:0, x2:1, y2:1, stop:0 rgba(255, 177, 21, 255), stop:0.528409 rgba(236, 157, 0, 255), stop:1 rgba(255, 170, 0, 255));
}
#btnHoverBlue{
border-color:rgb(0, 170, 255);
}
#btnPressBlue{
color:black;
border-color: rgb(128, 128, 128);
background-color: qlineargradient(spread:pad, x1:1, y1:0, x2:1, y2:1, stop:0 rgba(0, 170, 255, 255), stop:0.511364 rgba(0, 151, 227, 255), stop:1 rgba(0, 170, 255, 255));
}
/*tab 1中勾选框示例*/
#checkHoverOrange{
color: rgb(255, 170, 0);
}
#checkHoverOrange::indicator{
border-image: url(:/img/check_orange.png);
}
#checkCheckOrange::indicator{
border-image: url(:/img/checked_orange.png);
}
#checkHoverBlue{
color: rgb(0, 170, 255);
}
#checkHoverBlue::indicator{
border-image: url(:/img/check_blue.png);
}
#checkCheckBlue::indicator{
border-image: url(:/img/checked_blue.png);
}
#checkHoverGreen{
color: rgb(0, 255, 170);
}
#checkHoverGreen::indicator{
border-image: url(:/img/check_green.png);
}
#checkCheckGreen::indicator{
border-image: url(:/img/checked_green.png);
}
/*tab1 下拉框示例*/
#comboHover{
border:1px solid rgb(255, 170, 0);
}
#comboHover::down-arrow{
border-image: url(:/img/down_orange.png);
}
/*tab 1编辑框示例*/
#editHover{
border:1px solid rgb(255, 170, 0);
}
/*tab 1数字框示例*/
#spinHoverOrange{
border:1px solid rgb(255, 170, 0);
}
#spinHoverOrange::up-button{
border-image: url(:/img/up_orange.png);
}
#spinHoverBlue{
border:1px solid rgb(0, 170, 255);
}
#spinHoverBlue::up-button{
border-image: url(:/img/up_blue.png);
}
/*自定义按钮栏*/
#toolBar{
background-color: qlineargradient(spread:pad, x1:1, y1:0, x2:1, y2:1, stop:0 rgba(57, 57, 57, 255), stop:0.534091 rgba(20, 20, 20, 255), stop:1 rgba(73, 73, 73, 255));
border-bottom:2px solid rgb(0, 170, 255);
}
#toolBar QPushButton{
color: rgb(200, 200, 200);
border:0;
border-radius:0;
background-color: transparent;
}
#toolBar QPushButton:hover{
color:rgb(255, 170, 0);
background-color: rgba(255, 255, 255, 50);
}
#toolBar QPushButton:pressed{
background-color: rgba(255, 255, 255, 80);
}
QPushButton#btnSet{
background-image: url(:/img/set_gray.png);
background-repeat:no-repeat;
background-position:center center;
}
QPushButton#btnSet:hover{
background-image: url(:/img/set_orange.png);
}
QPushButton#btnMin{
background-image: url(:/img/min_gray.png);
background-repeat:no-repeat;
background-position:center center;
}
QPushButton#btnMin:hover{
background-image: url(:/img/min_orange.png);
}
QPushButton#btnMax{
background-image: url(:/img/max_gray.png);
background-repeat:no-repeat;
background-position:center center;
}
QPushButton#btnMax:hover{
background-image: url(:/img/max_orange.png);
}
QPushButton#btnMax:checked{
background-image: url(:/img/normal_gray.png);
}
QPushButton#btnMax:checked:hover{
background-image: url(:/img/normal_orange.png);
}
QPushButton#btnClose{
background-image: url(:/img/close_gray.png);
background-repeat:no-repeat;
background-position:center center;
}
QPushButton#btnClose:hover{
background-image: url(:/img/close_red.png);
}
/*分裂器*/
QSplitter::handle{
background-color: rgb(60, 60, 60);
margin:2px;
}
/*滚动区域*/
QScrollArea{
border:0;
background-color: transparent;
}
QScrollArea>QWidget>QWidget{
background-color: rgb(80, 80, 80);
}
/*滚动条 */
QScrollBar:vertical{/*竖向*/
width:20px;
padding:0 3px;
margin:0;
background-color:transparent;
}
QScrollBar::add-page:vertical,QScrollBar::sub-page:vertical{
background-color: transparent;
}
QScrollBar::handle:vertical{
width:10px;
min-height:20px;
margin:20px 0;
border-radius:5px;
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(91, 91, 91, 255), stop:0.545455 rgba(107, 107, 107, 255), stop:1 rgba(85, 85, 85, 255));
}
QScrollBar::handle:vertical:hover{
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(136, 136, 136, 255), stop:0.545455 rgba(157, 157, 157, 255), stop:1 rgba(139, 139, 139, 255));
}
QScrollBar::add-line:vertical{
height:20px;
width:20px;
subcontrol-position:bottom;
border-image: url(:/img/down2_white.png);
}
QScrollBar::sub-line:vertical{
height:20px;
width:20px;
subcontrol-position:top;
border-image: url(:/img/up2_white.png);
}
QScrollBar::sub-line:vertical:hover{
border-image: url(:/img/up2_orange.png);
}
QScrollBar::add-line:vertical:hover{
border-image: url(:/img/down2_orange.png);
}
QScrollBar:horizontal{/*横向*/
height:20px;
padding:3px;
margin:0;
background-color:transparent;
}
QScrollBar::add-page:horizontal,QScrollBar::sub-page:horizontal{
background-color: transparent;
}
QScrollBar::handle:horizontal{
height:10px;
min-width:20px;
margin:0 20px;
border-radius:5px;
background-color: qlineargradient(spread:pad, x1:1, y1:0, x2:1, y2:1, stop:0 rgba(91, 91, 91, 255), stop:0.545455 rgba(107, 107, 107, 255), stop:1 rgba(85, 85, 85, 255));
}
QScrollBar::handle:horizontal:hover{
background-color: qlineargradient(spread:pad, x1:1, y1:0, x2:1, y2:1, stop:0 rgba(136, 136, 136, 255), stop:0.545455 rgba(157, 157, 157, 255), stop:1 rgba(139, 139, 139, 255));
}
QScrollBar::add-line:horizontal{
height:20px;
width:20px;
subcontrol-position:right;
border-image: url(:/img/right2_white.png);
}
QScrollBar::sub-line:horizontal{
height:20px;
width:20px;
subcontrol-position:left;
border-image: url(:/img/left2_white.png);
}
QScrollBar::add-line:horizontal:hover{
border-image: url(:/img/right2_orange.png);
}
QScrollBar::sub-line:horizontal:hover{
border-image: url(:/img/left2_orange.png);
}
/*ToolBox*/
QToolBox{
background-color: rgb(80, 80, 80);/*背景色-空隙颜色*/
border:1px solid rgb(128, 128, 128);
border-top-left-radius:16px 24px;
}
QToolBox>QWidget>QWidget>QWidget{/*tab页*/
background-color: rgb(80, 80, 80);
}
QToolBox>QAbstractButton{/*标题栏*/
min-height:30px;
}
QToolBox::tab{
color: rgb(230, 230, 230);
padding-left:30px;
border-top-left-radius:16px 24px;
border-top:1px solid rgb(128, 128, 128);
border-left:1px solid rgb(128, 128, 128);
background-color: qlineargradient(spread:pad, x1:1, y1:0, x2:1, y2:1, stop:0 rgba(60, 60, 60, 255), stop:0.238636 rgba(40, 40, 40, 255), stop:0.909091 rgba(87, 87, 87, 255));
}
QToolBox::tab:first{
border-top:0;
border-left:0;
}
QToolBox::tab:hover{
color:black;
background-color: qlineargradient(spread:pad, x1:1, y1:0, x2:1, y2:1, stop:0 rgba(255, 177, 21, 255), stop:0.295455 rgba(245, 163, 0, 255), stop:0.909091 rgba(255, 201, 93, 255));
}
QToolBox::tab:selected{
color:rgb(255, 170, 0);
border-bottom:1px solid rgb(0, 170, 255);
}
QToolBox::tab:selected:hover{
color:black;
}
/*TabWidget*/
QTabWidget{
}
QTabWidget>QWidget>QWidget{/*tab页*/
background-color: rgb(80, 80, 80);
}
QTabWidget::tab-bar{
alignment:left;/*tab位置*/
}
QTabWidget::pane { /*内容区域*/
background-color: rgb(80, 80, 80);/*背景色-空隙颜色*/
border:1px solid rgb(128, 128, 128);
}
QTabBar{
color:white;
background-color:transparent;
}
QTabBar::tab{/*页签*/
min-height:28px;
width:120px;
color: rgb(230, 230, 230);
margin-right:1px;
margin-bottom:1px;
border-top-left-radius:16px 24px;
border:1px solid rgb(128, 128, 128);
border-bottom:0;
background-color: qlineargradient(spread:pad, x1:1, y1:0, x2:1, y2:1, stop:0 rgba(60, 60, 60, 255), stop:0.238636 rgba(40, 40, 40, 255), stop:0.909091 rgba(87, 87, 87, 255));
}
QTabBar::tab:hover{
color:black;
background-color: qlineargradient(spread:pad, x1:1, y1:0, x2:1, y2:1, stop:0 rgba(255, 177, 21, 255), stop:0.295455 rgba(245, 163, 0, 255), stop:0.909091 rgba(255, 201, 93, 255));
}
QTabBar::tab:selected{
color:rgb(255, 170, 0);
border-bottom:1px solid rgb(0, 170, 255);
}
QTabBar::tab:selected:hover{
color:black;
}
QTabBar::tear{/*选项过多时的。。。*/
imag:;
}
QTabBar::scroller{
width:60px;
}
/*文本框*/
QTextEdit{
color:white;
border:1px solid rgb(128, 128, 128);
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(90, 90, 90, 255), stop:0.789773 rgba(90, 90, 90, 255), stop:1 rgba(102, 102, 102, 255));
}
/*按钮*/
QPushButton{
color:rgb(240, 240, 240);
border:1px solid rgb(128, 128, 128);
border-radius:3px;
background-color: qlineargradient(spread:pad, x1:1, y1:0, x2:1, y2:1, stop:0 rgba(66, 66, 66, 255), stop:0.517045 rgba(46, 46, 46, 255), stop:1 rgba(69, 69, 69, 255));
}
QPushButton:hover{
border-color:rgb(255, 170, 0);
}
QPushButton:pressed{
border-color: rgb(128, 128, 128);
color:black;
background-color: qlineargradient(spread:pad, x1:1, y1:0, x2:1, y2:1, stop:0 rgba(255, 177, 21, 255), stop:0.528409 rgba(236, 157, 0, 255), stop:1 rgba(255, 170, 0, 255));
}
QPushButton:checked{
color:rgb(0, 255, 170);
border-color: rgba(0, 255, 170, 128);
background-image: url(:/img/right3_green.png);
background-repeat:no-repeat;
background-position:center left;
}
QPushButton:disabled{
color: rgb(230, 230, 230);
background-color: qlineargradient(spread:pad, x1:1, y1:0, x2:1, y2:1, stop:0 rgba(150, 150, 150, 255), stop:0.522727 rgba(134, 134, 134, 255), stop:1 rgba(150, 150, 150, 255));
}
QPushButton:checked:pressed{
color:black;
}
QPushButton:checked:disabled{
color: rgb(230, 230, 230);
border-color: rgb(128, 128, 128);
background-image: url(:/img/right3_white.png);
background-color: qlineargradient(spread:pad, x1:1, y1:0, x2:1, y2:1, stop:0 rgba(150, 150, 150, 255), stop:0.522727 rgba(134, 134, 134, 255), stop:1 rgba(150, 150, 150, 255));
}
/*勾选框*/
QCheckBox{
margin-left:5px;
spacing:3px;/*点击框与文字距离*/
color: rgb(250, 250, 250);
}
QCheckBox:hover{
color: rgb(0, 255, 170);
}
QCheckBox:disabled{
color: rgb(230, 230, 230);
}
QCheckBox::indicator{/*点击框*/
width:20px;
height:20px;
}
QCheckBox::indicator:unchecked{/*可添加未点击时点击区域图片*/
border-image: url(:/img/check_white.png);
}
QCheckBox::indicator:unchecked:hover{
border-image: url(:/img/check_green.png);
}
QCheckBox::indicator:unchecked:disabled{
border-image: url(:/img/check_white.png);
}
QCheckBox::indicator:checked{/*点击时区域样式*/
border-image: url(:/img/checked_green.png);
}
QCheckBox::indicator:checked:hover{
border-image: url(:/img/checked_green.png);
}
QCheckBox::indicator:checked:disabled{
border-image: url(:/img/checked_white.png);
}
QCheckBox::indicator:indeterminate{/*半选中状态*/
}
/*下拉列表*/
QComboBox{
padding-left: 5px;
padding-right: 2px;
color:rgb(250 ,250 ,250);
border:1px solid rgb(128, 128, 128);
background-color: rgb(100 ,100 ,100);
}
QComboBox:hover{
border:1px solid rgb(255, 170, 0);
}
QComboBox:disabled{
color: rgb(230, 230, 230);
background-color:rgb(150, 150, 150);
}
QComboBox:editable{
background-color:rgb(100, 100, 100);
}
QComboBox:editable:disabled{
background-color:rgb(150, 150, 150);
}
QComboBox QAbstractItemView{
background-color:rgb(110, 110, 110);
}
QComboBox QAbstractItemView::item{/*需要代码中-&gt;setView(new QListView(this));*/
height:26px;
font: 15px "宋体";
}
QComboBox QAbstractItemView::item:hover{
color:black;
background-color: rgb(255, 170, 0);
}
QComboBox QAbstractItemView::item:selected{
background-color: rgb(255, 170, 0);
}
QComboBox::drop-down {
width:20px;
height:20px;
subcontrol-position: center right;
right:2px;
border:0;
background-color:transparent;
}
QComboBox::down-arrow {/*替换三角小图标*/
width:20px;
height:20px;
border-image: url(:/img/down_white.png);
}
QComboBox::down-arrow:hover {
border-image: url(:/img/down_orange.png);
}
QComboBox::down-arrow:disabled {
border-image: url(:/img/down2_white.png);
}
/*编辑框*/
QLineEdit{
padding: 0 5px;
color: rgb(250 ,250 ,250);
background-color: rgb(100, 100, 100);
border:1px solid rgb(128, 128, 128);
}
QLineEdit:hover{
border:1px solid rgb(255, 170, 0);
}
QLineEdit[readOnly=true],QLineEdit:disabled{
color: rgb(230, 230, 230);
background-color:rgb(150, 150, 150);
}
/*整数框*/
QSpinBox{
padding:0 5px;
color: rgb(250, 250, 250);
background-color: rgb(100, 100, 100);
border:1px solid rgb(128, 128, 128);
}
QSpinBox:hover{
border:1px solid rgb(255, 170, 0);
}
QSpinBox:disabled{
color: rgb(230, 230, 230);
background-color:rgb(150, 150, 150);
}
QSpinBox[buttonSymbols="0"]::up-button{/*显示按钮=0*/
width:20px;
height:14px;
subcontrol-origin:border;
subcontrol-position:top right;
right:2px;
top:1px;
border-image: url(:/img/up_white.png);
}
QSpinBox[buttonSymbols="0"]::up-button:hover{
border-image: url(:/img/up_orange.png);
}
QSpinBox[buttonSymbols="0"]::up-button:pressed{
}
QSpinBox[buttonSymbols="0"]::up-button:disabled{
border-image: url(:/img/up2_white.png);
}
QSpinBox[buttonSymbols="0"]::down-button{
width:20px;
height:14px;
subcontrol-origin:border;
subcontrol-position:bottom right;
right:2px;
bottom:1px;
border-image: url(:/img/down_white.png);
}
QSpinBox[buttonSymbols="0"]::down-button:hover{
border-image: url(:/img/down_orange.png);
}
QSpinBox[buttonSymbols="0"]::down-button:pressed{
}
QSpinBox[buttonSymbols="0"]::down-button:disabled{
border-image: url(:/img/down2_white.png);
}
/*表头*/
QHeaderView{
font: 15px "宋体";
color:rgb(230, 230, 230);
background-color: rgb(80, 80, 80);
}
QHeaderView::section:horizontal{/*横表头*/
min-height:30px;
border:0;
border-bottom:1px solid rgb(0, 170, 255);
background-color: qlineargradient(spread:pad, x1:1, y1:0, x2:1, y2:1, stop:0 rgba(60, 60, 60, 255), stop:0.301136 rgba(40, 40, 40, 255), stop:0.909091 rgba(68, 68, 68, 255));
}
QHeaderView::section:vertical{/*竖表头*/
min-width:60px;
padding-left:15px;
border:1px solid rgb(128, 128, 128);
border-top:0;
border-left:0;
background-color: qlineargradient(spread:pad, x1:1, y1:0, x2:1, y2:1, stop:0 rgba(60, 60, 60, 255), stop:0.301136 rgba(40, 40, 40, 255), stop:0.909091 rgba(68, 68, 68, 255));
}
QHeaderView::section{
font: 15px "宋体";
}
QHeaderView::section:hover{
color:black;
background-color: qlineargradient(spread:pad, x1:1, y1:0, x2:1, y2:1, stop:0 rgba(255, 177, 21, 255), stop:0.335227 rgba(245, 163, 0, 255), stop:0.909091 rgba(255, 192, 66, 255));
}
QHeaderView::section:checked{/*不取消高亮*/
font: 15px "宋体";
color: rgb(255, 170, 0);
}
QHeaderView::section:selected{
font: 15px "宋体";
color: rgb(255, 170, 0);
}
QHeaderView::section:checked:hover{
color: rgb(230, 230, 230);
}
QHeaderView::section:first{/*表头第一个位置*/
}
QHeaderView::down-arrow{/*图标用来排序的*/
}
QHeaderView::up-arrow{
}
/*表格*/
QTableView{/*对齐方式代码设置*/
border:1px solid rgb(128, 128, 128);
gridline-color: rgb(128, 128, 128);/*网格线颜色*/
background-color: rgb(80, 80, 80);
}
QTableView QTableCornerButton::section{/*表头左上*/
border:0;
border-bottom:1px solid rgb(0, 170, 255);
background-color: qlineargradient(spread:pad, x1:1, y1:0, x2:1, y2:1, stop:0 rgba(60, 60, 60, 255), stop:0.301136 rgba(40, 40, 40, 255), stop:0.909091 rgba(68, 68, 68, 255));
}
QTableView::item{/*表内容*/
font: 15px "宋体";
color: rgb(230, 230, 230);
background-color: rgb(80, 80, 80);
}
QTableView::item:selected{
color:black;
background-color: rgb(255, 170, 0);
}
QTableView::indicator{
width: 20px;
height: 20px;
}
QTableView::indicator:enabled:checked{
image: ;
}
QTableView::indicator:enabled:unchecked{
image: ;
}
/*滑动条*/
QSlider::groove:vertical {
background: red;
position: absolute;
left: 4px; right: 4px;
}
QSlider::handle:vertical {
height: 10px;
background: green;
margin: 0 -4px;
}
QSlider::add-page:vertical {
background: white;
}
QSlider::sub-page:vertical {
background: pink;
}
/*菜单*/
QPushButton::menu-indicator{/*setmenu*/
image:none;
}
QMenu{
border:1px solid rgb(128, 128, 128);
background-color:rgb(70, 70, 70);
margin:0px;
padding:0px;
}
QMenu::item {
margin:0px;
padding:0 20 0 10px;
font:15px "宋体";
min-height:26px;
max-height:28px;
color:rgb(240, 240, 240);
background-color:rgb(70, 70, 70);
}
QSpacerItem{
background-color: rgb(0, 255, 0);
}
QMenu::item:disabled{
color:rgb(240, 240, 240);
background-color:rgb(110, 110, 110);
}
QMenu::item:selected {
color:black;
background-color: rgb(255, 170, 0);
}
QMenu::item:selected:disabled{
color:rgb(240, 240, 240);
background-color:rgb(110, 110, 110);
}
QMenu::separator {/*分割线*/
height: 1px;
background: transparent;
}