[Add] this verison add the BCU select combox and next version I will delete some redundant info

This commit is contained in:
Carl 2024-11-06 10:16:19 +08:00
parent 27f3def00a
commit 8279590f38
5 changed files with 1048 additions and 897 deletions

View File

@ -49,7 +49,7 @@ void AppSerial::setHWND(HWND hwnd)
this->m_hwnd = hwnd;
}
bool AppSerial::nativeEventFilter(const QByteArray &eventType, void *message, long *result)
bool AppSerial::nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result)
{
Q_UNUSED(eventType);
Q_UNUSED(result);

View File

@ -33,7 +33,7 @@ public:
void setHWND(HWND hwnd);
protected:
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result);
bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result);
signals:
/**

View File

@ -40,6 +40,7 @@ MainWindow::MainWindow(QWidget *parent)
m_AppProto = new AppProto;
m_AppProto_English = new Appproto_English;
connect(ui->tabWidget_paraset, SIGNAL(currentChanged(int)), this, SLOT(on_tabChanged(int)));
connect(ui->comboBoxBCUSelect, &QComboBox::currentIndexChanged, this, &MainWindow::on_comBoxBCUSelect);
}
MainWindow::~MainWindow()
@ -111,12 +112,19 @@ void MainWindow::init()
statusBarConnectedIcon = new QLabel();
statusBarConnectedType = new QLabel();
statusBarCompany = new QLabel();
statusBarBcu = new QLabel();
statusBarVersion = new QLabel();
statusBarConnectedIcon->setPixmap(QPixmap(QIcon(":/Image/connected1.png").pixmap(QSize(24, 24))));
statusBarConnectedType->setText("RS485");
statusBarCompany->setText("BLUESUN");
statusBarBcu->setText("Current BCU: BCU01");
statusBarVersion->setText("UpperComputer Version : 1.0.0 ");
ui->statusbar->addWidget(statusBarConnectedIcon);
ui->statusbar->addWidget(statusBarConnectedType);
ui->statusbar->addWidget(statusBarVersion);
ui->statusbar->addWidget(statusBarBcu);
ui->statusbar->addPermanentWidget(statusBarCompany);
/* 菜单栏设置 */
@ -202,6 +210,12 @@ void MainWindow::init()
ui->groupBox_trouble_control->setStyleSheet("background-color: #FFFFFF;");
// ui->groupBox_chart->setStyleSheet("background-color: #FFFFFF;");
ui->groupBox_class_color->setStyleSheet("QGroupBox { border: none; }");
ui->widget_historyAlarm->setStyleSheet("background-color: #FFFFFF;");
// ui->widget_BCUSelect->setStyleSheet("background-color: #FFFFFF;");
ui->pageHome->setStyleSheet("background-color: #FFFFFF;");
ui->comboBoxBCUSelect->setStyleSheet("background-color: #F8F8FF;");
// ui->comboBoxBCUSelect->setStyleSheet("QComboBox QAbstractItemView { background-color: #f0f0f0;}");
ui->BCU_DIDO->setStyleSheet("background-color: #FFFFFF;");
ui->BCU_alarm->setStyleSheet("background-color: #FFFFFF;");
@ -210,6 +224,7 @@ void MainWindow::init()
//设置按钮的提示文本
ui->btnHome->setToolTip("概述信息(Overview Information)");
ui->btnBattery->setToolTip("详细信息(Detailed Information)");
@ -3126,43 +3141,41 @@ void MainWindow::pageParaSetInit_other_setting()
void MainWindow::slot_getBcuNumberFromDialoglogin(int number)
{
Q_UNUSED(number);
// QTreeView treeView;
// 创建模型
QStandardItemModel *model = new QStandardItemModel(ui->treeViewBCUbmu);
modelBCU = new QStandardItemModel(ui->treeViewBCUbmu);
// QMap<QModelIndex, int> indexTopPageMap;
//创建一级目录项数为可变的
QStringList bcuNames;
// QStringList bcuNames;
qDebug() << "number: " << number;
for (int i = 1; i <= number; ++i) {
QString bcuName = QString("BCU%1").arg(i);
bcuNames.append(bcuName);
}
// qDebug() << "number: " << number;
// for (int i = 1; i <= number; ++i) {
// QString bcuName = QString("BCU%1").arg(i);
// bcuNames.append(bcuName);
// }
// qDebug() << "BCUNames" << bcuNames;
qDebug() << "BCUNames" << bcuNames;
// 创建一级目录项
int count = 0;
for (const QString &name : bcuNames)
{
QStandardItem *rootItem = new QStandardItem(name);
// 设置一级目录项的字体为加粗
QFont boldFont = rootItem->font();
boldFont.setBold(true);
rootItem->setFont(boldFont);
count++;
model->appendRow(rootItem);
for (int i = 1; i <= 26; ++i)
{
QString bmuName = QString("BMU%1").arg(i);
QStandardItem *bmuItem = new QStandardItem(bmuName);
rootItem->appendRow(bmuItem);
}
rootItem = new QStandardItem("BCU01");
// 设置一级目录项的字体为加粗
QFont boldFont = rootItem->font();
boldFont.setBold(true);
rootItem->setFont(boldFont);
modelBCU->appendRow(rootItem);
for (int i = 1; i <= 26; ++i)
{
QString bmuName = QString("BMU%1").arg(i);
QStandardItem *bmuItem = new QStandardItem(bmuName);
rootItem->appendRow(bmuItem);
}
ui->tabWidgetBCU->setCurrentIndex(0);
ui->tabWidgetBMU->setCurrentIndex(0);
@ -3183,7 +3196,7 @@ void MainWindow::slot_getBcuNumberFromDialoglogin(int number)
}
});
ui->treeViewBCUbmu->setModel(model);
ui->treeViewBCUbmu->setModel(modelBCU);
ui->treeViewBCUbmu->setHeaderHidden(true);
ui->treeViewBCUbmu->setAnimated(true);
ui->treeViewBCUbmu->expandAll();
@ -4001,3 +4014,16 @@ void MainWindow::on_tabChanged(int index)
tabWidget_paraset_index = index;
ui->pageParaSetCheck->setCheckState(Qt::Unchecked);
}
void MainWindow::on_comBoxBCUSelect()
{
QString BCUText = ui->comboBoxBCUSelect->currentText();
QString statusBarBCULabel = "Current BCU: ";
statusBarBcu->setText(statusBarBCULabel + BCUText);
rootItem->setText(BCUText);
//当改变BCU选择时改变当前BCU读取的地址
}

View File

@ -43,7 +43,13 @@ public:
QLabel *statusBarConnectedIcon;
QLabel *statusBarConnectedType;
QLabel *statusBarCompany;
QLabel *statusBarBcu;
QLabel *statusBarVersion;
ChartPaint *chartPat;
QStandardItemModel *modelBCU; //设置BCU目录
QStandardItem *rootItem;
int BCUNumbers;
// QGridLayout *gridLayout;
// QHBoxLayout *hBoxLayout;
@ -144,6 +150,7 @@ private slots:
void on_pageParaSetRead_clicked();
void on_pageParaSetWrite_clicked();
void on_tabChanged(int index);
void on_comBoxBCUSelect();
// void on_horizontalSlider_valueChanged(int value);
public:

File diff suppressed because it is too large Load Diff