Fix some FTBS for older version of Qt and std c++

This commit is contained in:
joshua
2021-11-01 11:53:16 +01:00
parent 985988ee53
commit 2252feca16
3 changed files with 13 additions and 3 deletions

View File

@@ -20,6 +20,7 @@
#include <QUndoCommand> #include <QUndoCommand>
#include <QPointer> #include <QPointer>
#include <QVector>
class TerminalStrip; class TerminalStrip;
class QETProject; class QETProject;

View File

@@ -20,6 +20,7 @@
#include <QUndoCommand> #include <QUndoCommand>
#include <QPointer> #include <QPointer>
#include <QVector>
class TerminalStrip; class TerminalStrip;
struct PhysicalTerminalData; struct PhysicalTerminalData;

View File

@@ -51,14 +51,18 @@ TerminalStripEditor::TerminalStripEditor(QETProject *project, QWidget *parent) :
ui->m_table_widget->setItemDelegate(new TerminalStripModelDelegate(ui->m_terminal_strip_tw)); ui->m_table_widget->setItemDelegate(new TerminalStripModelDelegate(ui->m_terminal_strip_tw));
ui->m_remove_terminal_strip_pb->setDisabled(true); ui->m_remove_terminal_strip_pb->setDisabled(true);
buildTree(); buildTree();
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
ui->m_terminal_strip_tw->expandRecursively(ui->m_terminal_strip_tw->rootIndex()); ui->m_terminal_strip_tw->expandRecursively(ui->m_terminal_strip_tw->rootIndex());
#else
ui->m_terminal_strip_tw->expandAll();
#endif
setUpUndoConnections(); setUpUndoConnections();
//Call for update the state of child widgets //Call for update the state of child widgets
selectionChanged(); selectionChanged();
//Go the diagram of double clicked terminal //Go the diagram of double clicked terminal
connect(ui->m_table_widget, &QAbstractItemView::doubleClicked, [this](auto index) connect(ui->m_table_widget, &QAbstractItemView::doubleClicked, [this](const QModelIndex &index)
{ {
Element *elmt = nullptr; Element *elmt = nullptr;
if (this->m_model->isXrefCell(index, &elmt)) if (this->m_model->isXrefCell(index, &elmt))
@@ -380,7 +384,7 @@ void TerminalStripEditor::selectionChanged()
ui->m_group_terminals_pb->setEnabled(terminal_vector.size() > 1 ? true : false); ui->m_group_terminals_pb->setEnabled(terminal_vector.size() > 1 ? true : false);
//Enable/disable ungroup button //Enable/disable ungroup button
auto it_= std::find_if(terminal_vector.constBegin(), terminal_vector.constEnd(), [](auto &data) auto it_= std::find_if(terminal_vector.constBegin(), terminal_vector.constEnd(), [](const PhysicalTerminalData &data)
{ {
if (data.real_terminals_vector.size() >= 2) { if (data.real_terminals_vector.size() >= 2) {
return true; return true;
@@ -468,7 +472,11 @@ void TerminalStripEditor::on_m_reload_pb_clicked()
qDeleteAll(m_item_strip_H.keyBegin(), m_item_strip_H.keyEnd()); qDeleteAll(m_item_strip_H.keyBegin(), m_item_strip_H.keyEnd());
buildTree(); buildTree();
ui->m_terminal_strip_tw->expandRecursively(ui->m_terminal_strip_tw->rootIndex()); #if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
ui->m_terminal_strip_tw->expandRecursively(ui->m_terminal_strip_tw->rootIndex());
#else
ui->m_terminal_strip_tw->expandAll();
#endif
//Reselect the tree widget item of the current edited strip //Reselect the tree widget item of the current edited strip
auto item = m_item_strip_H.key(current_); auto item = m_item_strip_H.key(current_);