Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
facontidavide committed Apr 9, 2024
1 parent b6839d0 commit 9ce4680
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions plotjuggler_plugins/DataStreamUDP/udp_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,25 +106,27 @@ bool UDP_Server::start(QStringList*)

ParserFactoryPlugin::Ptr parser_creator;

auto onComboChanged = [&](const QString& selected_protocol) {
if (parser_creator)
{
if (auto prev_widget = parser_creator->optionsWidget())
{
prev_widget->setVisible(false);
}
}
parser_creator = parserFactories()->at(selected_protocol);

if (auto widget = parser_creator->optionsWidget())
{
widget->setVisible(true);
}
};

connect(dialog.ui->comboBoxProtocol,
qOverload<const QString&>(&QComboBox::currentIndexChanged), this,
[&](const QString& selected_protocol) {
if (parser_creator)
{
if (auto prev_widget = parser_creator->optionsWidget())
{
prev_widget->setVisible(false);
}
}
parser_creator = parserFactories()->at(selected_protocol);

if (auto widget = parser_creator->optionsWidget())
{
widget->setVisible(true);
}
});
qOverload<const QString&>(&QComboBox::currentIndexChanged), this, onComboChanged);

dialog.ui->comboBoxProtocol->setCurrentText(protocol);
onComboChanged(protocol);

int res = dialog.exec();
if (res == QDialog::Rejected)
Expand Down

0 comments on commit 9ce4680

Please sign in to comment.