From c257967e0979f901ccd54a26b66f71e57a06c90c Mon Sep 17 00:00:00 2001 From: Davide Punzo Date: Mon, 11 Dec 2023 17:18:46 +0100 Subject: [PATCH] BUG: Fix minor UI issues --- .../Resources/UI/ctkDICOMStudyItemWidget.ui | 276 +++++++++--------- .../Widgets/ctkDICOMPatientItemWidget.cpp | 5 +- .../Widgets/ctkDICOMVisualBrowserWidget.cpp | 19 +- 3 files changed, 159 insertions(+), 141 deletions(-) diff --git a/Libs/DICOM/Widgets/Resources/UI/ctkDICOMStudyItemWidget.ui b/Libs/DICOM/Widgets/Resources/UI/ctkDICOMStudyItemWidget.ui index b8db3456fb..e48a467849 100644 --- a/Libs/DICOM/Widgets/Resources/UI/ctkDICOMStudyItemWidget.ui +++ b/Libs/DICOM/Widgets/Resources/UI/ctkDICOMStudyItemWidget.ui @@ -7,7 +7,7 @@ 0 0 378 - 318 + 534 @@ -61,142 +61,152 @@ - - - - 0 - 0 - - - - - 0 - 0 - - - - - 12 - - - - - - - Study ID 1234 --- Date - - - false - - - true - - - - 7 - - - 2 - - - 2 - - - 2 - - - 2 - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 5 - - - - - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 12 + + + + + + + Study ID 1234 --- Date + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + false + + + true + + + + 7 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 5 + + + + + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Ubuntu'; font-size:12pt; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> - - - - - - - - 0 - 10 - - - - - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAsNeeded - - - QAbstractScrollArea::AdjustToContents - - - QAbstractItemView::ScrollPerPixel - - - QAbstractItemView::ScrollPerPixel - - - false - - - Qt::NoPen - - - 6 - - - false - - - false - - - false - - - false - - - - - - - - - - - + + + + + + + + 0 + 1 + + + + + + + QFrame::NoFrame + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAsNeeded + + + QAbstractScrollArea::AdjustToContents + + + QAbstractItemView::ScrollPerPixel + + + QAbstractItemView::ScrollPerPixel + + + false + + + Qt::NoPen + + + 6 + + + false + + + false + + + false + + + false + + + + + + + + + + + + + + + + diff --git a/Libs/DICOM/Widgets/ctkDICOMPatientItemWidget.cpp b/Libs/DICOM/Widgets/ctkDICOMPatientItemWidget.cpp index b2039ec1ba..b72ae0107a 100644 --- a/Libs/DICOM/Widgets/ctkDICOMPatientItemWidget.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMPatientItemWidget.cpp @@ -305,9 +305,10 @@ void ctkDICOMPatientItemWidgetPrivate::createStudies() foreach (QString studyItem, studiesMap) { q->addStudyItemWidget(studyItem); - QSpacerItem* verticalSpacer = new QSpacerItem(0, 10, QSizePolicy::Fixed, QSizePolicy::Fixed); - studiesListWidgetLayout->addItem(verticalSpacer); } + + QSpacerItem* verticalSpacer = new QSpacerItem(0, 5, QSizePolicy::Fixed, QSizePolicy::Expanding); + studiesListWidgetLayout->addItem(verticalSpacer); } //---------------------------------------------------------------------------- diff --git a/Libs/DICOM/Widgets/ctkDICOMVisualBrowserWidget.cpp b/Libs/DICOM/Widgets/ctkDICOMVisualBrowserWidget.cpp index fcc813debf..ea384486ce 100644 --- a/Libs/DICOM/Widgets/ctkDICOMVisualBrowserWidget.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMVisualBrowserWidget.cpp @@ -328,22 +328,27 @@ void ctkDICOMVisualBrowserWidgetPrivate::init() // setup patients menu on a tool button on the tab bar QTabBar* tabWidget = this->PatientsTabWidget->tabBar(); + tabWidget->setDocumentMode(true); tabWidget->setExpanding(true); - this->patientsTabMenuToolButton = new QToolButton(); + this->patientsTabMenuToolButton = new QToolButton(q); this->patientsTabMenuToolButton->setObjectName("patientsTabMenuToolButton"); this->patientsTabMenuToolButton->setIconSize(iconSize); - this->patientsTabMenuToolButton->setFixedHeight(38); + this->patientsTabMenuToolButton->setFixedHeight(40); this->patientsTabMenuToolButton->setCheckable(false); this->patientsTabMenuToolButton->setChecked(false); this->patientsTabMenuToolButton->setIcon(QIcon(":/Icons/more_vert.svg")); this->patientsTabMenuToolButton->hide(); + this->patientsTabMenuToolButton->setStyleSheet(this->patientsTabMenuToolButton->styleSheet() + + "QToolButton{padding-top: 5px; padding-bottom: 5px}"); + QObject::connect(this->patientsTabMenuToolButton, SIGNAL(clicked()), q, SLOT(onPatientsTabMenuToolButtonClicked())); this->PatientsTabWidget->setCornerWidget(this->patientsTabMenuToolButton, Qt::TopRightCorner); + QObject::connect(this->PatientsTabWidget, SIGNAL(currentChanged(int)), q, SLOT(onPatientItemChanged(int))); @@ -593,6 +598,7 @@ void ctkDICOMVisualBrowserWidgetPrivate::createPatients() { QString patientID = this->DicomDatabase->fieldForPatient("PatientID", patientItem); QString patientName = this->DicomDatabase->fieldForPatient("PatientsName", patientItem); + patientName.replace(R"(^)", R"( )"); if (this->isPatientTabAlreadyAdded(patientItem)) { continue; @@ -1652,7 +1658,8 @@ ctkDICOMPatientItemWidget* ctkDICOMVisualBrowserWidget::getPatientItemWidgetByPa continue; } - QString tempPatientName = d->DicomDatabase->fieldForPatient("PatientsName", patientItemWidget->patientItem()); + QString tempPatientName = d->DicomDatabase->fieldForPatient("PatientsName", patientItemWidget->patientItem()); + tempPatientName.replace(R"(^)", R"( )"); if (tempPatientName != patientName) { continue; @@ -2566,9 +2573,9 @@ void ctkDICOMVisualBrowserWidget::onPatientsTabMenuToolButtonClicked() { Q_D(ctkDICOMVisualBrowserWidget); - QPoint globalPos = d->patientsTabMenuToolButton->geometry().bottomLeft(); - globalPos.setY(globalPos.y() + this->geometry().top() + d->patientsTabMenuToolButton->height() * 3); - globalPos.setX(globalPos.x() + this->geometry().left()); + QPoint globalPos = this->mapToGlobal(d->patientsTabMenuToolButton->geometry().bottomLeft()); + globalPos.setY(globalPos.y() + d->patientsTabMenuToolButton->height() * 3); + globalPos.setX(globalPos.x()); QMenu *patientMenu = new QMenu(); patientMenu->move(globalPos);