From 0d81e20772da770840a9a3b37e1c0f1816b49917 Mon Sep 17 00:00:00 2001 From: Emil Sawicki Date: Mon, 14 Mar 2022 15:49:03 +0100 Subject: [PATCH] Fix changing name using table widget --- limereport/items/lrchartitemeditor.cpp | 13 ++++++++++++- limereport/items/lrchartitemeditor.h | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/limereport/items/lrchartitemeditor.cpp b/limereport/items/lrchartitemeditor.cpp index c609c46..b2f35cb 100644 --- a/limereport/items/lrchartitemeditor.cpp +++ b/limereport/items/lrchartitemeditor.cpp @@ -295,4 +295,15 @@ void ChartItemEditor::on_xAxisFieldComboBox_currentTextChanged(const QString &ar { if (!m_initing) m_charItem->setXAxisField(arg1); -} \ No newline at end of file +} +void ChartItemEditor::on_tableWidget_itemChanged(QTableWidgetItem *item) +{ + if (ui->seriesNameLineEdit->hasFocus()) + return; + + const QString dataStr = item->data(Qt::DisplayRole).toString(); + if (dataStr == ui->seriesNameLineEdit->text()) + return; + + ui->seriesNameLineEdit->setText(dataStr); +} diff --git a/limereport/items/lrchartitemeditor.h b/limereport/items/lrchartitemeditor.h index 64e0549..7c72556 100644 --- a/limereport/items/lrchartitemeditor.h +++ b/limereport/items/lrchartitemeditor.h @@ -40,8 +40,8 @@ private slots: void on_labelsFieldComboBox_currentTextChanged(const QString &arg1); void slotChangeSeriesColor(); void on_seriesTypeComboBox_currentIndexChanged(const QString &arg1); - void on_xAxisFieldComboBox_currentTextChanged(const QString &arg1); + void on_tableWidget_itemChanged(QTableWidgetItem *item); private: void readSetting();