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 <QPointer>
#include <QVector>
class TerminalStrip;
class QETProject;

View File

@ -20,6 +20,7 @@
#include <QUndoCommand>
#include <QPointer>
#include <QVector>
class TerminalStrip;
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_remove_terminal_strip_pb->setDisabled(true);
buildTree();
#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
setUpUndoConnections();
//Call for update the state of child widgets
selectionChanged();
//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;
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);
//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) {
return true;
@ -468,7 +472,11 @@ void TerminalStripEditor::on_m_reload_pb_clicked()
qDeleteAll(m_item_strip_H.keyBegin(), m_item_strip_H.keyEnd());
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
auto item = m_item_strip_H.key(current_);