diff --git a/Image/bluesun.png b/Image/bluesun.png new file mode 100644 index 0000000..d619c9b Binary files /dev/null and b/Image/bluesun.png differ diff --git a/Image/bunuo.png b/Image/bunuo.png new file mode 100644 index 0000000..3127729 Binary files /dev/null and b/Image/bunuo.png differ diff --git a/dialoglogin.cpp b/dialoglogin.cpp index 20eec55..14829ae 100644 --- a/dialoglogin.cpp +++ b/dialoglogin.cpp @@ -54,9 +54,15 @@ void DialogLogin::init() ini = new QSettings("config.ini", QSettings::IniFormat); connect(ui->btnConnect, &QPushButton::clicked, this, &DialogLogin::slot_btnConnect_clicked); + ui->groupBox->setStyleSheet("QGroupBox { border: none; }"); + + ui->label_bluesunLogo->setStyleSheet("QLabel { background-image: url(:/Image/bluesun.png); " + "background-repeat: no-repeat; background-size: cover; background-position: center center;}"); // //将背景设置为白色 // ui->groupBox->setStyleSheet("background-color: #FFFFFF;"); + m_MainWindow->setStyleSheet("background-color: #FFFFFF;"); + // //传递BCU个数的信号与槽 // BCUNumbers = ui->comboBoxBCUQuantity->currentText().toInt(); // qDebug() << "the number of the BCU: " << BCUNumbers; @@ -101,6 +107,7 @@ void DialogLogin::init() m_ModbusRTU->quit(); }); + // ui->btnConnect->setStyleSheet("QPushButton { background-color: lightgray; color: black; border: none; }"); //主窗口接受语言选择number的信号与槽的连接 connect(this, &DialogLogin::sendLanNumberSignals, m_MainWindow, &MainWindow::getLanNumberSlot); @@ -116,6 +123,9 @@ void DialogLogin::init() connect(m_MainWindow, &MainWindow::row_of_bmus_index, m_ModbusRTU, &ModbusRTU::change_BMUIndex_slot); + // ui->btnConnect->setStyleSheet("QPushButton { background-color: #87CEFA; color: white; }" + // "QPushButton:hover { background-color: #77B5D6; color: white; }"); + // QMetaObject::invokeMethod(m_ModbusRTU,"read_regs_slot",Qt::QueuedConnection); // connect(m_ModbusRTU, &ModbusRTU::sig_readMoveToThread, m_ModbusRTU, &ModbusRTU::read_regs_slot, Qt::QueuedConnection); // thread = new QThread; @@ -161,29 +171,29 @@ void DialogLogin::mainwindowInit() connect(m_MainWindow, &MainWindow::showLogin, this, [=]{ this->show(); }); - connect(this, &DialogLogin::finished, m_MainWindow, [=]{ - m_MainWindow->ui->btnSetup->setStyleSheet("#btnSetup{" - "background-image: url(:/Image/advance-set-line.png);" - "background-repeat: no-repeat;" - "background-position: center;" - "background-color: rgba(255, 255, 255, 0);" - "}" - "#btnSetup::hover{" - "background-image: url(:/Image/advance-set-line1.png);" - "background-repeat: no-repeat;" - "background-position: center;" - "background-color: rgba(255, 255, 255, 0);" - "}"); - }); - connect(m_MainWindow->ui->btnSetup, &QPushButton::pressed, this, [=]{ - qDebug() << __FUNCTION__ << "disconnected"; - m_ModbusRTU->isConnect = false; - m_MainWindow->statusBarConnectedIcon->setPixmap(QPixmap(QIcon(":/Image/connected1.png").pixmap(QSize(24, 24)))); - m_Serial->m_SerialPort->close(); - m_ModbusRTU->modbusRTUDisconnect(); - ui->comboBoxSerialPort->clear(); - ui->comboBoxSerialPort->addItems(m_Serial->getAvailablePort()); - }); + // connect(this, &DialogLogin::finished, m_MainWindow, [=]{ + // m_MainWindow->ui->btnSetup->setStyleSheet("#btnSetup{" + // "background-image: url(:/Image/advance-set-line.png);" + // "background-repeat: no-repeat;" + // "background-position: center;" + // "background-color: rgba(255, 255, 255, 0);" + // "}" + // "#btnSetup::hover{" + // "background-image: url(:/Image/advance-set-line1.png);" + // "background-repeat: no-repeat;" + // "background-position: center;" + // "background-color: rgba(255, 255, 255, 0);" + // "}"); + // }); + // connect(m_MainWindow->ui->btnSetup, &QPushButton::pressed, this, [=]{ + // qDebug() << __FUNCTION__ << "disconnected"; + // m_ModbusRTU->isConnect = false; + // m_MainWindow->statusBarConnectedIcon->setPixmap(QPixmap(QIcon(":/Image/connected1.png").pixmap(QSize(24, 24)))); + // m_Serial->m_SerialPort->close(); + // m_ModbusRTU->modbusRTUDisconnect(); + // ui->comboBoxSerialPort->clear(); + // ui->comboBoxSerialPort->addItems(m_Serial->getAvailablePort()); + // }); } void DialogLogin::slot_comChangeStatus(QString name, bool flag) @@ -196,7 +206,7 @@ void DialogLogin::slot_comChangeStatus(QString name, bool flag) void DialogLogin::slot_btnConnect_clicked() { - BCUNumbers = ui->comboBoxBCUQuantity->currentText().toInt(); + // BCUNumbers = ui->comboBoxBCUQuantity->currentText().toInt(); QString language = ui->comboBoxLanguage->currentText(); if (language == "English") diff --git a/dialoglogin.ui b/dialoglogin.ui index 01bf0d8..3feae8c 100644 --- a/dialoglogin.ui +++ b/dialoglogin.ui @@ -6,8 +6,8 @@ 0 0 - 260 - 320 + 430 + 539 @@ -20,33 +20,7 @@ Dialog - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 黑体 - 10 - - - - Connect - - - - + @@ -55,344 +29,370 @@ - Communication + - - - - - - 黑体 - 10 - - + + + - - 5 - + + + + 0 + 0 + + + + + + - - 6 - + + + + + + 华文中宋 + 10 + + + + Language + + + Qt::AlignCenter + + + + + + + + 华文中宋 + 10 + + + + + Chinese + + + + + English + + + + + + + + + 华文中宋 + 10 + + + + Serial Port + + + Qt::AlignCenter + + + + + + + + 华文中宋 + 10 + + + + + + + + + 华文中宋 + 10 + + + + Baud Rate + + + Qt::AlignCenter + + + + + + + + 华文中宋 + 10 + + + + + 1200 + + + + + 2400 + + + + + 4800 + + + + + 9600 + + + + + 19200 + + + + + 38400 + + + + + 57600 + + + + + 115200 + + + + + + + + + 华文中宋 + 10 + + + + Data Bits + + + Qt::AlignCenter + + + + + + + + 华文中宋 + 10 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + + + + + 华文中宋 + 10 + + + + Stop Bits + + + Qt::AlignCenter + + + + + + + + 华文中宋 + 10 + + + + + 1 + + + + + 2 + + + + + + + + + 华文中宋 + 10 + + + + Parity + + + Qt::AlignCenter + + + + + + + + 华文中宋 + 10 + + + + + None + + + + + Odd + + + + + Even + + + + + - - 7 - + + + Qt::Vertical + + + + 20 + 40 + + + - - 8 - - - - - - - - - 黑体 - 10 - - - - - - - - - 黑体 - 10 - - - - - 1 - + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 40 + 0 + + + + + 黑体 + 10 + + + + Connect + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - 2 - + + + + 0 + 0 + + + + + 幼圆 + 11 + + + + <html><head/><body><p align="center">Copyright © 2016 Bluesun Solar Co.,Ltd </p><p align="center">All Rights Reserved.</p></body></html> + + + Qt::AlignCenter + + - - - - - - - 黑体 - 10 - - - - - 1 - - - - - 2 - - - - - 3 - - - - - 4 - - - - - 5 - - - - - 6 - - - - - 7 - - - - - 8 - - - - - 9 - - - - - 10 - - - - - 11 - - - - - 12 - - - - - 13 - - - - - 14 - - - - - 15 - - - - - 16 - - - - - - - - - 黑体 - 10 - - - - - 1200 - - - - - 2400 - - - - - 4800 - - - - - 9600 - - - - - 19200 - - - - - 38400 - - - - - 57600 - - - - - 115200 - - - - - - - - - 黑体 - 10 - - - - Baud Rate - - - - - - - - 黑体 - 10 - - - - Stop Bits - - - - - - - - 黑体 - 10 - - - - BCU Quantity - - - - - - - - 黑体 - 10 - - - - Serial Port - - - - - - - - 黑体 - 10 - - - - Parity - - - - - - - - 黑体 - 10 - - - - Data Bits - - - - - - - - 黑体 - 10 - - - - - None - - - - - Odd - - - - - Even - - - - - - - - - 黑体 - 10 - - - - Language - - - - - - - - 黑体 - 10 - - - - - Chinese - - - - - English - - - + diff --git a/image.qrc b/image.qrc index 8d7d6a4..af823f6 100644 --- a/image.qrc +++ b/image.qrc @@ -35,5 +35,7 @@ Image/record-out-black.png Image/record-out-gray.png Image/record-out-green.png + Image/bluesun.png + Image/bunuo.png diff --git a/main.cpp b/main.cpp index d978a69..191f0ff 100644 --- a/main.cpp +++ b/main.cpp @@ -17,6 +17,7 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); a.setStyleSheet("QToolTip { font-size: 18px; font-family: 'SimHei'; }"); DialogLogin loginWidget; + loginWidget.setStyleSheet("background-color: #FFFFFF;"); loginWidget.show(); return a.exec(); } diff --git a/mainwindow.cpp b/mainwindow.cpp index bf8e39c..548a476 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -212,6 +212,7 @@ void MainWindow::init() // ui->scrollAreaChart->setFrameShape(QFrame::NoFrame); // ui->scrollAreaChart->setStyleSheet("background-color: #FFFFFF;"); //设置背景颜色为纯白色 + ui->scrollArea_trouble->setStyleSheet("border: none;"); ui->widgetControl->setStyleSheet("background-color: #FFFFFF;"); ui->groupBox->setStyleSheet("background-color: #FFFFFF;"); ui->groupBox_trouble_control->setStyleSheet("background-color: #FFFFFF;"); @@ -239,8 +240,6 @@ void MainWindow::init() ui->btnParaSet->setToolTip("参数设置(Parameter Settings)"); ui->btnDebug->setToolTip("报文信息(Message Information)"); ui->btnFlash->setToolTip("升级调试(Upgrade Debugging)"); - ui->btnSetup->setToolTip("串口信息(Serial Port)"); - ui->btnSetup->setStyleSheet("QToolTip { position: absolute; left: 20px; top: 20px; }"); // ui->btnRecord->setToolTip("记录导出"); @@ -698,18 +697,18 @@ void MainWindow::setMenuStyle() "background-color: rgba(255, 255, 255, 0);" "}"); - ui->btnSetup->setStyleSheet("#btnSetup{" - "background-image: url(:/Image/advance-set-line.png);" - "background-repeat: no-repeat;" - "background-position: center;" - "background-color: rgba(255, 255, 255, 0);" - "}" - "#btnSetup::hover{" - "background-image: url(:/Image/advance-set-line1.png);" - "background-repeat: no-repeat;" - "background-position: center;" - "background-color: rgba(255, 255, 255, 0);" - "}"); + // ui->btnSetup->setStyleSheet("#btnSetup{" + // "background-image: url(:/Image/advance-set-line.png);" + // "background-repeat: no-repeat;" + // "background-position: center;" + // "background-color: rgba(255, 255, 255, 0);" + // "}" + // "#btnSetup::hover{" + // "background-image: url(:/Image/advance-set-line1.png);" + // "background-repeat: no-repeat;" + // "background-position: center;" + // "background-color: rgba(255, 255, 255, 0);" + // "}"); // ui->btnRecord->setStyleSheet("#btnRecord{" // "background-image: url(:/Image/record-out-black.png);" @@ -786,18 +785,18 @@ void MainWindow::setMenuStyle() "background-color: rgba(255, 255, 255, 0);" "}"); - ui->btnSetup->setStyleSheet("#btnSetup{" - "background-image: url(:/Image/advance-set-line.png);" - "background-repeat: no-repeat;" - "background-position: center;" - "background-color: rgba(255, 255, 255, 0);" - "}" - "#btnSetup::hover{" - "background-image: url(:/Image/advance-set-line1.png);" - "background-repeat: no-repeat;" - "background-position: center;" - "background-color: rgba(255, 255, 255, 0);" - "}"); + // ui->btnSetup->setStyleSheet("#btnSetup{" + // "background-image: url(:/Image/advance-set-line.png);" + // "background-repeat: no-repeat;" + // "background-position: center;" + // "background-color: rgba(255, 255, 255, 0);" + // "}" + // "#btnSetup::hover{" + // "background-image: url(:/Image/advance-set-line1.png);" + // "background-repeat: no-repeat;" + // "background-position: center;" + // "background-color: rgba(255, 255, 255, 0);" + // "}"); // ui->btnRecord->setStyleSheet("#btnRecord{" // "background-image: url(:/Image/record-out-black.png);" @@ -874,18 +873,18 @@ void MainWindow::setMenuStyle() "background-color: rgba(255, 255, 255, 0);" "}"); - ui->btnSetup->setStyleSheet("#btnSetup{" - "background-image: url(:/Image/advance-set-line.png);" - "background-repeat: no-repeat;" - "background-position: center;" - "background-color: rgba(255, 255, 255, 0);" - "}" - "#btnSetup::hover{" - "background-image: url(:/Image/advance-set-line1.png);" - "background-repeat: no-repeat;" - "background-position: center;" - "background-color: rgba(255, 255, 255, 0);" - "}"); + // ui->btnSetup->setStyleSheet("#btnSetup{" + // "background-image: url(:/Image/advance-set-line.png);" + // "background-repeat: no-repeat;" + // "background-position: center;" + // "background-color: rgba(255, 255, 255, 0);" + // "}" + // "#btnSetup::hover{" + // "background-image: url(:/Image/advance-set-line1.png);" + // "background-repeat: no-repeat;" + // "background-position: center;" + // "background-color: rgba(255, 255, 255, 0);" + // "}"); // ui->btnRecord->setStyleSheet("#btnRecord{" // "background-image: url(:/Image/record-out-black.png);" @@ -962,18 +961,18 @@ void MainWindow::setMenuStyle() "background-color: rgba(255, 255, 255, 0);" "}"); - ui->btnSetup->setStyleSheet("#btnSetup{" - "background-image: url(:/Image/advance-set-line.png);" - "background-repeat: no-repeat;" - "background-position: center;" - "background-color: rgba(255, 255, 255, 0);" - "}" - "#btnSetup::hover{" - "background-image: url(:/Image/advance-set-line1.png);" - "background-repeat: no-repeat;" - "background-position: center;" - "background-color: rgba(255, 255, 255, 0);" - "}"); + // ui->btnSetup->setStyleSheet("#btnSetup{" + // "background-image: url(:/Image/advance-set-line.png);" + // "background-repeat: no-repeat;" + // "background-position: center;" + // "background-color: rgba(255, 255, 255, 0);" + // "}" + // "#btnSetup::hover{" + // "background-image: url(:/Image/advance-set-line1.png);" + // "background-repeat: no-repeat;" + // "background-position: center;" + // "background-color: rgba(255, 255, 255, 0);" + // "}"); // ui->btnRecord->setStyleSheet("#btnRecord{" // "background-image: url(:/Image/record-out-black.png);" @@ -1050,29 +1049,29 @@ void MainWindow::setMenuStyle() "background-color: rgba(255, 255, 255, 0);" "}"); - ui->btnSetup->setStyleSheet("#btnSetup{" - "background-image: url(:/Image/advance-set-line.png);" - "background-repeat: no-repeat;" - "background-position: center;" - "background-color: rgba(255, 255, 255, 0);" - "}" - "#btnSetup::hover{" - "background-image: url(:/Image/advance-set-line1.png);" - "background-repeat: no-repeat;" - "background-position: center;" - "background-color: rgba(255, 255, 255, 0);" - "}"); + // ui->btnSetup->setStyleSheet("#btnSetup{" + // "background-image: url(:/Image/advance-set-line.png);" + // "background-repeat: no-repeat;" + // "background-position: center;" + // "background-color: rgba(255, 255, 255, 0);" + // "}" + // "#btnSetup::hover{" + // "background-image: url(:/Image/advance-set-line1.png);" + // "background-repeat: no-repeat;" + // "background-position: center;" + // "background-color: rgba(255, 255, 255, 0);" + // "}"); }); - connect(ui->btnSetup, &QPushButton::pressed, this, [=]{ - emit showLogin(); - ui->btnSetup->setStyleSheet("#btnSetup{" - "background-image: url(:/Image/advance-set-line2.png);" - "background-repeat: no-repeat;" - "background-position: center;" - "background-color: rgba(255, 255, 255, 0);" - "}"); - }); + // connect(ui->btnSetup, &QPushButton::pressed, this, [=]{ + // emit showLogin(); + // ui->btnSetup->setStyleSheet("#btnSetup{" + // "background-image: url(:/Image/advance-set-line2.png);" + // "background-repeat: no-repeat;" + // "background-position: center;" + // "background-color: rgba(255, 255, 255, 0);" + // "}"); + // }); ui->btn_close_neg->setStyleSheet("QPushButton { background-color: #87CEFA; color: white; }" "QPushButton:hover { background-color: #77B5D6; color: white; }"); @@ -1086,6 +1085,21 @@ void MainWindow::setMenuStyle() "QPushButton:hover { background-color: #77B5D6; color: white; }"); ui->btn_open_pos->setStyleSheet("QPushButton { background-color: #87CEFA; color: white; }" "QPushButton:hover { background-color: #77B5D6; color: white; }"); + + ui->pageParaSetRead->setStyleSheet("QPushButton { background-color: #87CEFA; color: white; }" + "QPushButton:hover { background-color: #77B5D6; color: white; }"); + ui->pageParaSetWrite->setStyleSheet("QPushButton { background-color: #87CEFA; color: white; }" + "QPushButton:hover { background-color: #77B5D6; color: white; }"); + ui->btnGetVersion->setStyleSheet("QPushButton { background-color: #87CEFA; color: white; }" + "QPushButton:hover { background-color: #77B5D6; color: white; }"); + ui->btnStartUpgrade->setStyleSheet("QPushButton { background-color: #87CEFA; color: white; }" + "QPushButton:hover { background-color: #77B5D6; color: white; }"); + ui->btnImport->setStyleSheet("QPushButton { background-color: #87CEFA; color: white; }" + "QPushButton:hover { background-color: #77B5D6; color: white; }"); + ui->btnSendData->setStyleSheet("QPushButton { background-color: #87CEFA; color: white; }" + "QPushButton:hover { background-color: #77B5D6; color: white; }"); + ui->pageDebugBtnClear->setStyleSheet("QPushButton { background-color: #87CEFA; color: white; }" + "QPushButton:hover { background-color: #77B5D6; color: white; }"); } void MainWindow::slot_pageDebugDisplayMessage(QByteArray byteArray, int dataType, uint16_t *data) @@ -4215,6 +4229,7 @@ void MainWindow::on_pageParaSetWrite_clicked() for (int i=0; i #widget{ - background-color: rgb(161, 161, 161); + background-color: rgb(245, 245, 220); max-width:60px; } - + 0 @@ -233,39 +233,6 @@ background-color: rgba(255, 255, 255, 0); - - - - - 0 - 0 - - - - - 62 - 62 - - - - <html><head/><body><p><span style=" font-size:12pt;">串口信息</span></p></body></html> - - - -1 - - - #btnSetup{ -background-image: url(:/Image/advance-set-line2.png); -background-repeat: no-repeat; -background-position: center; -background-color: rgba(255, 255, 255, 0); -} - - - - - - @@ -758,7 +725,7 @@ background-color: rgba(255, 255, 255, 0); - + true @@ -768,7 +735,7 @@ background-color: rgba(255, 255, 255, 0); 0 0 1041 - 448 + 450 @@ -2290,8 +2257,8 @@ background-color: rgba(255, 255, 255, 0); - 黑体 - 10 + 华文中宋 + 11 @@ -2386,8 +2353,8 @@ background-color: rgba(255, 255, 255, 0); - 黑体 - 10 + 华文中宋 + 11 @@ -2461,6 +2428,12 @@ background-color: rgba(255, 255, 255, 0); + + + 华文中宋 + 12 + + 1 @@ -7813,11 +7786,23 @@ background-color: rgba(255, 255, 255, 0); + + + 华文中宋 + 12 + + + + + 黑体 + 12 + + - 0 + 1 @@ -10492,7 +10477,7 @@ background-color: rgba(255, 255, 255, 0); - + @@ -10508,6 +10493,18 @@ background-color: rgba(255, 255, 255, 0); + + + 0 + 0 + + + + + 华文中宋 + 11 + + 全部勾选 @@ -10528,6 +10525,18 @@ background-color: rgba(255, 255, 255, 0); + + + 0 + 0 + + + + + 华文中宋 + 11 + + 读取 @@ -10535,6 +10544,18 @@ background-color: rgba(255, 255, 255, 0); + + + 0 + 0 + + + + + 华文中宋 + 11 + + 写入 @@ -10709,6 +10730,12 @@ li.checked::marker { content: "\2612"; } + + + 华文中宋 + 10 + + 显示 @@ -10729,6 +10756,12 @@ li.checked::marker { content: "\2612"; } + + + 华文中宋 + 10 + + 时间戳 @@ -10736,6 +10769,12 @@ li.checked::marker { content: "\2612"; } + + + 华文中宋 + 10 + + 发送数据 @@ -10743,6 +10782,12 @@ li.checked::marker { content: "\2612"; } + + + 华文中宋 + 10 + + 清除 diff --git a/modbusrtu.cpp b/modbusrtu.cpp index 690aca1..784f714 100644 --- a/modbusrtu.cpp +++ b/modbusrtu.cpp @@ -207,7 +207,7 @@ void ModbusRTU::write_regs_slot(int addr,const uint16_t data) // qDebug() << "write:进入线程:" << QThread::currentThread(); int rc = write_single_register(addr, data); if(MODBUS_ERR == rc) { - qDebug() << "######modbus no message"; + qDebug() << "write######modbus no message"; return; } } @@ -217,7 +217,7 @@ void ModbusRTU::read_regs_slot(int addr, int nb, uint16_t *data, int row) // qDebug() << "read:进入线程:" << QThread::currentThread(); int rc = read_holding_register(addr, nb, data); if(MODBUS_ERR == rc) { - // qDebug() << "modbus no message"; + qDebug() << "read modbus no message"; return; } else {