Skip to content

Commit

Permalink
BUG: Fix items update of the ProxyServer comboboxes in the server set…
Browse files Browse the repository at this point in the history
…tings
  • Loading branch information
Punzo committed Jan 22, 2024
1 parent 3739cde commit f225387
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions Libs/DICOM/Widgets/ctkDICOMServerNodeWidget2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ class ctkDICOMServerNodeWidget2Private : public Ui_ctkDICOMServerNodeWidget2
int addServerNode(const QMap<QString, QVariant>& parameters);
int addServerNode(ctkDICOMServer* server);
QSharedPointer<ctkDICOMServer> createServerFromServerNode(const QMap<QString, QVariant>& node);
void updateProxyComboBoxes(const QString& connectionName, int rowCount) const;
void updateProxyComboBoxes() const;
QStringList getAllServerNames();

bool SettingsModified;
QSharedPointer<ctkDICOMScheduler> Scheduler;
Expand Down Expand Up @@ -555,8 +556,6 @@ int ctkDICOMServerNodeWidget2Private::addServerNode(const QMap<QString, QVariant

q->onSettingsModified();

this->updateProxyComboBoxes(serverName, rowCount);

return rowCount;
}

Expand Down Expand Up @@ -668,8 +667,6 @@ int ctkDICOMServerNodeWidget2Private::addServerNode(ctkDICOMServer* server)
this->NodeTable->setCellWidget(rowCount, ctkDICOMServerNodeWidget2::ProxyColumn, proxyComboBox);
this->NodeTable->setItem(rowCount, ctkDICOMServerNodeWidget2::ProxyColumn, newItem);

this->updateProxyComboBoxes(server->connectionName(), rowCount);

if (server->proxyServer())
{
this->addServerNode(server->proxyServer());
Expand Down Expand Up @@ -701,25 +698,25 @@ QSharedPointer<ctkDICOMServer> ctkDICOMServerNodeWidget2Private::createServerFro
}

//----------------------------------------------------------------------------
void ctkDICOMServerNodeWidget2Private::updateProxyComboBoxes(const QString& connectionName, int rowCount) const
void ctkDICOMServerNodeWidget2Private::updateProxyComboBoxes() const
{
int rowCount = this->NodeTable->rowCount();
QStringList serverNames = this->getAllNodesName();
for (int row = 0; row < rowCount; ++row)
{
QComboBox* proxyComboBox = qobject_cast<QComboBox*>(this->NodeTable->cellWidget(row, ctkDICOMServerNodeWidget2::ProxyColumn));
if (proxyComboBox)
{
QStringListModel* cbModel = qobject_cast<QStringListModel*>(proxyComboBox->model());
if (cbModel)
{
QStringList nodesNames = cbModel->stringList();
if (nodesNames.contains(connectionName))
{
continue;
}
}
proxyComboBox->addItem(connectionName);
bool wasBlocking = proxyComboBox->blockSignals(true);

QString currentServer = proxyComboBox->currentText();
proxyComboBox->clear();
proxyComboBox->addItem("");
proxyComboBox->addItems(serverNames);
proxyComboBox->setCurrentText(currentServer);
proxyComboBox->blockSignals(wasBlocking);
}
}
}
}

//----------------------------------------------------------------------------
Expand Down Expand Up @@ -911,6 +908,8 @@ void ctkDICOMServerNodeWidget2::updateGUIState()
{
d->StorageStatusValueLabel->setText(QObject::tr("Inactive"));
}

d->updateProxyComboBoxes();
}

//----------------------------------------------------------------------------
Expand Down

0 comments on commit f225387

Please sign in to comment.