Skip to content

Commit

Permalink
ENH: Improve study widget layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Punzo committed Jun 4, 2024
1 parent 04d1f55 commit 7dca0f3
Show file tree
Hide file tree
Showing 12 changed files with 166 additions and 165 deletions.
47 changes: 13 additions & 34 deletions Libs/DICOM/Widgets/Resources/UI/ctkDICOMPatientItemWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@
</item>
<item row="0" column="0">
<widget class="QLabel" name="PatientNameLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
Expand All @@ -120,12 +126,6 @@
</item>
<item row="0" column="1">
<widget class="QLabel" name="PatientNameValueLabel">
<property name="text">
<string/>
</property>
<property name="margin">
<number>3</number>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
Expand Down Expand Up @@ -171,22 +171,19 @@
</item>
<item row="1" column="1">
<widget class="QLabel" name="PatientSexValueLabel">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="margin">
<number>3</number>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="PatientIDLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
Expand Down Expand Up @@ -218,31 +215,13 @@
<property name="midLineWidth">
<number>0</number>
</property>
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="margin">
<number>3</number>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="PatientBirthDateValueLabel">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="margin">
<number>3</number>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
Expand Down Expand Up @@ -298,7 +277,7 @@
<x>0</x>
<y>0</y>
<width>996</width>
<height>257</height>
<height>254</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5"/>
Expand Down
170 changes: 69 additions & 101 deletions Libs/DICOM/Widgets/Resources/UI/ctkDICOMStudyItemWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>464</width>
<height>547</height>
<width>787</width>
<height>612</height>
</rect>
</property>
<property name="windowTitle">
Expand All @@ -30,83 +30,74 @@
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="ctkPushButton" name="OperationStatusPushButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="icon">
<iconset resource="ctkDICOMWidget.qrc">
<normaloff>:/Icons/pending.svg</normaloff>:/Icons/pending.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="iconAlignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="ctkCheckBox" name="StudySelectionCheckBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="indicatorIcon">
<iconset resource="ctkDICOMWidget.qrc">
<normaloff>:/Icons/select_all.svg</normaloff>
<normalon>:/Icons/select_none.svg</normalon>:/Icons/select_all.svg</iconset>
</property>
<property name="indicatorIconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="ctkPushButton" name="OperationStatusPushButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="icon">
<iconset resource="ctkDICOMWidget.qrc">
<normaloff>:/Icons/pending.svg</normaloff>:/Icons/pending.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="iconAlignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="ctkCheckBox" name="StudySelectionCheckBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="indicatorIcon">
<iconset resource="ctkDICOMWidget.qrc">
<normaloff>:/Icons/select_all.svg</normaloff>
<normalon>:/Icons/select_none.svg</normalon>:/Icons/select_all.svg</iconset>
</property>
<property name="indicatorIconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="ctkFittedTextBrowser" name="StudyDescriptionTextBrowser">
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="ctkCollapsibleGroupBox" name="StudyItemCollapsibleGroupBox">
<property name="sizePolicy">
Expand All @@ -115,21 +106,12 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>Study ID 1234 --- Date</string>
<string>Series</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
Expand Down Expand Up @@ -165,17 +147,6 @@
</property>
</spacer>
</item>
<item>
<widget class="ctkFittedTextBrowser" name="StudyDescriptionTextBrowser">
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu Sans'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:12pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QTableWidget" name="SeriesListTableWidget">
<property name="sizePolicy">
Expand Down Expand Up @@ -234,9 +205,6 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget" native="true"/>
</item>
</layout>
</item>
</layout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ int ctkDICOMStudyItemWidgetTest1(int argc, char* argv[])
CHECK_QSTRING(widget.studyItem(), "");
CHECK_QSTRING(widget.patientID(), "");
CHECK_QSTRING(widget.studyInstanceUID(), "");
CHECK_QSTRING(widget.title(), "Study ID 1234 --- Date");
CHECK_QSTRING(widget.title(), "Series");
CHECK_QSTRING(widget.description(), "");
CHECK_QSTRING(widget.filteringSeriesDescription(), "");
CHECK_BOOL(widget.collapsed(), false)
Expand Down
20 changes: 9 additions & 11 deletions Libs/DICOM/Widgets/ctkDICOMPatientItemWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,24 +780,22 @@ void ctkDICOMPatientItemWidget::addStudyItemWidget(const QString& studyItem)
studyItemWidget->setStudyItem(studyItem);
studyItemWidget->setPatientID(d->PatientID);
studyItemWidget->setStudyInstanceUID(studyInstanceUID);
if (formattedStudyDate.isEmpty() && studyID.isEmpty())
{
studyItemWidget->setTitle(tr("Study"));
}
else if (formattedStudyDate.isEmpty())

QString fullDescription = tr("Study");
if (!studyID.isEmpty())
{
studyItemWidget->setTitle(tr("Study ID %1").arg(studyID));
fullDescription += tr(" ID %1").arg(studyID);
}
else if (studyID.isEmpty())
if (!formattedStudyDate.isEmpty())
{
studyItemWidget->setTitle(tr("Study --- %1").arg(formattedStudyDate));
fullDescription += tr(" - %1").arg(formattedStudyDate);
}
else
if (!studyDescription.isEmpty())
{
studyItemWidget->setTitle(tr("Study ID %1 --- %2").arg(studyID).arg(formattedStudyDate));
fullDescription += tr(" - %1").arg(studyDescription);
}

studyItemWidget->setDescription(studyDescription);
studyItemWidget->setDescription(fullDescription);
studyItemWidget->setThumbnailSize(d->ThumbnailSize);
studyItemWidget->setFilteringSeriesDescription(d->FilteringSeriesDescription);
studyItemWidget->setFilteringModalities(d->FilteringModalities);
Expand Down
9 changes: 5 additions & 4 deletions Libs/DICOM/Widgets/ctkDICOMSeriesItemWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void ctkDICOMSeriesItemWidgetPrivate::init(ctkDICOMStudyItemWidget* top)
this->SeriesThumbnail->setSelectedColor(QColor::Invalid);

QObject::connect(this->SeriesThumbnail, SIGNAL(statusPushButtonClicked(bool)),
q, SLOT(onStatusPushButtonClicked(bool)));
q, SLOT(onOperationStatusButtonClicked(bool)));
}

//----------------------------------------------------------------------------
Expand Down Expand Up @@ -758,7 +758,7 @@ ctkDICOMSeriesItemWidget::~ctkDICOMSeriesItemWidget()
Q_D(ctkDICOMSeriesItemWidget);

QObject::disconnect(d->SeriesThumbnail, SIGNAL(statusPushButtonClicked(bool)),
this, SLOT(onStatusPushButtonClicked(bool)));
this, SLOT(onOperationStatusButtonClicked(bool)));
}

//------------------------------------------------------------------------------
Expand Down Expand Up @@ -1091,7 +1091,7 @@ void ctkDICOMSeriesItemWidget::onJobFinished(const QVariant &data)
}

//----------------------------------------------------------------------------
void ctkDICOMSeriesItemWidget::onStatusPushButtonClicked(bool)
void ctkDICOMSeriesItemWidget::onOperationStatusButtonClicked(bool)
{
Q_D(ctkDICOMSeriesItemWidget);

Expand All @@ -1102,7 +1102,8 @@ void ctkDICOMSeriesItemWidget::onStatusPushButtonClicked(bool)
QStringList(),
QStringList(d->SeriesInstanceUID));
}
else if (status == ctkThumbnailLabel::Failed)
else if (status == ctkThumbnailLabel::Failed ||
status == ctkThumbnailLabel::Completed)
{
ctkDICOMJobDetail queryJobDetail;
queryJobDetail.JobClass = "ctkDICOMQueryJob";
Expand Down
2 changes: 1 addition & 1 deletion Libs/DICOM/Widgets/ctkDICOMSeriesItemWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public Q_SLOTS:
void onJobUserStopped(const QVariant&);
void onJobFailed(const QVariant&);
void onJobFinished(const QVariant&);
void onStatusPushButtonClicked(bool);
void onOperationStatusButtonClicked(bool);

protected:
QScopedPointer<ctkDICOMSeriesItemWidgetPrivate> d_ptr;
Expand Down
Loading

0 comments on commit 7dca0f3

Please sign in to comment.