Move to cpp20

This commit is contained in:
2026-02-01 19:00:24 +01:00
parent 4fdffb8889
commit 4a0d04527e
6 changed files with 13 additions and 13 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ FetchContent_MakeAvailable(magic_enum)
FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz DOWNLOAD_EXTRACT_TIMESTAMP TRUE)
FetchContent_MakeAvailable(json)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Widgets Svg WebSockets)
+4 -4
View File
@@ -24,7 +24,7 @@ MainWindow::MainWindow(QString host, uint16_t port, QWidget *parent) :
//Default sim
//defaultSim("CVS_I10");
connect(ui->pushButton, &QPushButton::clicked, this, [=]{open_sim(ui->comboBox->currentText());});
connect(ui->pushButton, &QPushButton::clicked, this, [=, this]{open_sim(ui->comboBox->currentText());});
connect(this, &MainWindow::quit, this, &QCoreApplication::quit, Qt::QueuedConnection);
}
@@ -37,9 +37,9 @@ MainWindow::~MainWindow()
void MainWindow::setup_cb(void)
{
connect(m_web_socket, &Web_socket_wrapper::on_command_cb, this, [=](json& j){on_cmd_cb(j);});
connect(m_web_socket, &Web_socket_wrapper::on_connected, this, [=]{m_web_socket->send_command(Web_socket_wrapper::Command::get_simulators);});
connect(m_web_socket, &Web_socket_wrapper::on_closed, this, [=]{m_error_dialog->open(); ui->connection->setText("Could not connect to the server");});
connect(m_web_socket, &Web_socket_wrapper::on_command_cb, this, [=, this](json& j){on_cmd_cb(j);});
connect(m_web_socket, &Web_socket_wrapper::on_connected, this, [=, this]{m_web_socket->send_command(Web_socket_wrapper::Command::get_simulators);});
connect(m_web_socket, &Web_socket_wrapper::on_closed, this, [=, this]{m_error_dialog->open(); ui->connection->setText("Could not connect to the server");});
}
void MainWindow::showEvent( QShowEvent* event )
+1 -1
View File
@@ -4,7 +4,7 @@
NetworkError::NetworkError(QWidget* parent) : QDialog(parent), ui(new Ui::NetworkError) {
ui->setupUi(this);
connect(ui->exit, &QPushButton::clicked, this, &QCoreApplication::quit, Qt::QueuedConnection);
connect(ui->close, &QPushButton::clicked, this, [=]{this->close();});
connect(ui->close, &QPushButton::clicked, this, [=, this]{this->close();});
this->setWindowTitle("Error");
}
+3 -3
View File
@@ -32,9 +32,9 @@ void SimulatorBase::closeEvent(QCloseEvent* event)
void SimulatorBase::setup_cb(void)
{
connect(m_web_socket, &Web_socket_wrapper::on_command_cb, this, [=](json& j){on_cmd_cb(j);});
connect(m_web_socket, &Web_socket_wrapper::on_event_cb, this, [=](json& j){on_event_cb(j);});
connect(m_web_socket, &Web_socket_wrapper::on_closed, this, [=]{m_error_dialog->open();});
connect(m_web_socket, &Web_socket_wrapper::on_command_cb, this, [=, this](json& j){on_cmd_cb(j);});
connect(m_web_socket, &Web_socket_wrapper::on_event_cb, this, [=, this](json& j){on_event_cb(j);});
connect(m_web_socket, &Web_socket_wrapper::on_closed, this, [=, this]{m_error_dialog->open();});
}
void SimulatorBase::on_cmd_cb(json& j)
+3 -3
View File
@@ -48,7 +48,7 @@ void Test_Sim::setup_buttons(void)
switch (lookup)
{
default:
connect(button_lookup[lookup], &QPushButton::clicked, this, [=]{button_update(lookup);});
connect(button_lookup[lookup], &QPushButton::clicked, this, [=, this]{button_update(lookup);});
break;
}
}
@@ -58,7 +58,7 @@ void Test_Sim::setup_sliders(void)
{
for (Iterable<slider_lookup_e> lookup; lookup < slider_lookup_e::end; lookup++)
{
connect(slider_lookup[lookup], &QwtSlider::sliderMoved, this, [=]{
connect(slider_lookup[lookup], &QwtSlider::sliderMoved, this, [=, this]{
//value_lookup_e lookup_v = thermo_to_value_lookup(lookup);
//value_lookup[lookup_v]->setText(format_value(lookup_v, thermo_lookup[lookup]->value()));
slider_update(lookup);
@@ -70,7 +70,7 @@ void Test_Sim::setup_comboboxes(void)
{
for (Iterable<combobox_lookup_e> lookup; lookup < combobox_lookup_e::end; lookup++)
{
connect(combobox_lookup[lookup], &QComboBox::currentIndexChanged, this, [=]{combobox_update(lookup);});
connect(combobox_lookup[lookup], &QComboBox::currentIndexChanged, this, [=, this]{combobox_update(lookup);});
}
}
+1 -1
View File
@@ -10,7 +10,7 @@ Web_socket_wrapper::Web_socket_wrapper(const QUrl &url, QObject *parent) :
connect(m_web_socket, &QWebSocket::connected, this, &Web_socket_wrapper::m_on_connected);
connect(m_web_socket, &QWebSocket::disconnected, this, &Web_socket_wrapper::on_closed);
connect(m_web_socket, &QWebSocket::pong, this, &Web_socket_wrapper::m_on_pong);
connect(m_ping_timer, &QTimer::timeout, this, [=]{
connect(m_ping_timer, &QTimer::timeout, this, [=, this]{
m_web_socket->ping();
m_pong_timer->start(500);
});