diff --git a/Libs/DICOM/Widgets/ctkDICOMServerNodeWidget2.cpp b/Libs/DICOM/Widgets/ctkDICOMServerNodeWidget2.cpp index fe9764ab09..3d4ae4b3dd 100644 --- a/Libs/DICOM/Widgets/ctkDICOMServerNodeWidget2.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMServerNodeWidget2.cpp @@ -205,7 +205,8 @@ class ctkDICOMServerNodeWidget2Private : public Ui_ctkDICOMServerNodeWidget2 int addServerNode(const QMap& parameters); int addServerNode(ctkDICOMServer* server); QSharedPointer createServerFromServerNode(const QMap& node); - void updateProxyComboBoxes(const QString& connectionName, int rowCount) const; + void updateProxyComboBoxes() const; + QStringList getAllServerNames(); bool SettingsModified; QSharedPointer Scheduler; @@ -555,8 +556,6 @@ int ctkDICOMServerNodeWidget2Private::addServerNode(const QMaponSettingsModified(); - this->updateProxyComboBoxes(serverName, rowCount); - return rowCount; } @@ -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()); @@ -701,25 +698,25 @@ QSharedPointer 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(this->NodeTable->cellWidget(row, ctkDICOMServerNodeWidget2::ProxyColumn)); if (proxyComboBox) { - QStringListModel* cbModel = qobject_cast(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); } - } + } } //---------------------------------------------------------------------------- @@ -911,6 +908,8 @@ void ctkDICOMServerNodeWidget2::updateGUIState() { d->StorageStatusValueLabel->setText(QObject::tr("Inactive")); } + + d->updateProxyComboBoxes(); } //----------------------------------------------------------------------------