diff --git a/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp b/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp index 344810e1f7..393ea06ec5 100644 --- a/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMBrowser.cpp @@ -1092,10 +1092,22 @@ bool ctkDICOMBrowser::confirmDeleteSelectedUIDs(QStringList uids) ctkMessageBox confirmDeleteDialog; QString message = tr("Do you want to delete the following selected items?"); + // calculate maximum number of rows that fit in the browser widget to have a reasonable limit + // on the items to show in the dialog + int browserHeight = this->geometry().height(); + int patientsTableRowHeight = d->dicomTableManager->patientsTable()->tableView()->rowHeight(0); + int maxNumberOfPatientsToShow = browserHeight / patientsTableRowHeight - 1; // Subtract 1 due to the do not show checkbox + // add the information about the selected UIDs int numUIDs = uids.size(); for (int i = 0; i < numUIDs; ++i) { + if (i >= maxNumberOfPatientsToShow) + { + message += QString("\n(and %1 more)").arg(numUIDs - maxNumberOfPatientsToShow); + break; + } + QString uid = uids.at(i); // try using the given UID to find a descriptive string