delete m_indicatorLabels
This commit is contained in:
@@ -100,16 +100,6 @@ void MainWindows::loadConfiguration() {
|
||||
}
|
||||
m_buttonLabels.append(label);
|
||||
}
|
||||
|
||||
// Load indicator labels
|
||||
for(int i = 1; i <= m_indicatorCount; ++i) {
|
||||
QString labelKey = QString("indicator_label%1").arg(i);
|
||||
QString label = settings.value(labelKey).toString();
|
||||
if(label.isEmpty()) {
|
||||
label = QString("Indicator %1").arg(i);
|
||||
}
|
||||
m_indicatorLabels.append(label);
|
||||
}
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
@@ -248,16 +238,13 @@ void MainWindows::onReadReady() {
|
||||
m_buttonValues[i] = value;
|
||||
bool bitState = (value >> m_buttonBits[i]) & 1;
|
||||
m_buttons[i]->setChecked(bitState); // Устанавливаем состояние кнопки
|
||||
qDebug() << "mButtonRegisters[" << i << "] = " << m_buttonValues[i];
|
||||
bool hasIndicator = false;
|
||||
// Проверяем, есть ли индикатор для этой кнопки
|
||||
for (int j = 0; j < m_indicatorRegisters.size(); ++j) {
|
||||
if (m_indicatorLabels[j].contains(m_buttonLabels[i], Qt::CaseInsensitive)) {
|
||||
hasIndicator = true;
|
||||
break;
|
||||
}
|
||||
if (m_indicatorRegisters.size() <= i) {
|
||||
hasIndicator = true;
|
||||
}
|
||||
m_buttons[i]->setText(hasIndicator ?
|
||||
QString("%1").arg(bitState ? "Выкл" : "Вкл") :
|
||||
QString("%1").arg(bitState ? "Выключить" : "Включить") :
|
||||
QString("%1").arg(bitState ? "Закрыть" : "Открыть"));
|
||||
}
|
||||
}
|
||||
@@ -298,8 +285,6 @@ void MainWindows::createUIElements() {
|
||||
QString label;
|
||||
if (i < m_buttonCount) {
|
||||
label = m_buttonLabels[i];
|
||||
} else if (i < m_indicatorCount) {
|
||||
label = m_indicatorLabels[i];
|
||||
}
|
||||
m_table->setItem(i, 0, new QTableWidgetItem(label));
|
||||
|
||||
@@ -357,7 +342,7 @@ void MainWindows::createUIElements() {
|
||||
m_table->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Fixed);
|
||||
m_table->horizontalHeader()->setSectionResizeMode(3, QHeaderView::Fixed);
|
||||
m_table->setColumnWidth(0, 180); // Label column
|
||||
m_table->setColumnWidth(1, 100); // Button column
|
||||
m_table->setColumnWidth(1, 170); // Button column
|
||||
m_table->setColumnWidth(2, 50); // Square column
|
||||
m_table->setColumnWidth(3, 100); // Status text column
|
||||
|
||||
|
||||
Reference in New Issue
Block a user