diff --git a/Libs/DICOM/Widgets/Resources/UI/ctkDICOMPatientItemWidget.ui b/Libs/DICOM/Widgets/Resources/UI/ctkDICOMPatientItemWidget.ui index f822c23042..27d61abb6d 100644 --- a/Libs/DICOM/Widgets/Resources/UI/ctkDICOMPatientItemWidget.ui +++ b/Libs/DICOM/Widgets/Resources/UI/ctkDICOMPatientItemWidget.ui @@ -104,6 +104,12 @@ + + + 0 + 0 + + 100 @@ -120,12 +126,6 @@ - - - - - 3 - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse @@ -171,15 +171,6 @@ - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - 3 - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse @@ -187,6 +178,12 @@ + + + 0 + 0 + + 100 @@ -218,15 +215,6 @@ 0 - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - 3 - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse @@ -234,15 +222,6 @@ - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - 3 - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse @@ -298,7 +277,7 @@ 0 0 996 - 257 + 254 diff --git a/Libs/DICOM/Widgets/Resources/UI/ctkDICOMStudyItemWidget.ui b/Libs/DICOM/Widgets/Resources/UI/ctkDICOMStudyItemWidget.ui index 3b4e71398a..59b7d6e297 100644 --- a/Libs/DICOM/Widgets/Resources/UI/ctkDICOMStudyItemWidget.ui +++ b/Libs/DICOM/Widgets/Resources/UI/ctkDICOMStudyItemWidget.ui @@ -6,8 +6,8 @@ 0 0 - 464 - 547 + 787 + 612 @@ -30,83 +30,74 @@ 0 - - - - - - 0 - 0 - - - - - 24 - 24 - - - - - :/Icons/pending.svg:/Icons/pending.svg - - - - 24 - 24 - - - - true - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 24 - 24 - - - - - :/Icons/select_all.svg - :/Icons/select_none.svg:/Icons/select_all.svg - - - - 24 - 24 - - - - + - - - Qt::Vertical - - - - 20 - 40 - - - + + + + + + 0 + 0 + + + + + 24 + 24 + + + + + :/Icons/pending.svg:/Icons/pending.svg + + + + 24 + 24 + + + + true + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + :/Icons/select_all.svg + :/Icons/select_none.svg:/Icons/select_all.svg + + + + 24 + 24 + + + + + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + + - - - - @@ -115,21 +106,12 @@ 0 - - - 0 - 0 - - - Study ID 1234 --- Date + Series Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - false - true @@ -165,17 +147,6 @@ - - - - <!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 Sans'; font-size:11pt; 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; font-family:'Ubuntu'; font-size:12pt;"><br /></p></body></html> - - - @@ -234,9 +205,6 @@ p, li { white-space: pre-wrap; } - - - diff --git a/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMStudyItemWidgetTest1.cpp b/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMStudyItemWidgetTest1.cpp index 157d431c55..221551a0e1 100644 --- a/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMStudyItemWidgetTest1.cpp +++ b/Libs/DICOM/Widgets/Testing/Cpp/ctkDICOMStudyItemWidgetTest1.cpp @@ -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) diff --git a/Libs/DICOM/Widgets/ctkDICOMPatientItemWidget.cpp b/Libs/DICOM/Widgets/ctkDICOMPatientItemWidget.cpp index 810ce15808..4cc33d6c64 100644 --- a/Libs/DICOM/Widgets/ctkDICOMPatientItemWidget.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMPatientItemWidget.cpp @@ -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); diff --git a/Libs/DICOM/Widgets/ctkDICOMSeriesItemWidget.cpp b/Libs/DICOM/Widgets/ctkDICOMSeriesItemWidget.cpp index f6a5cf685a..310a98ab6a 100644 --- a/Libs/DICOM/Widgets/ctkDICOMSeriesItemWidget.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMSeriesItemWidget.cpp @@ -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))); } //---------------------------------------------------------------------------- @@ -758,7 +758,7 @@ ctkDICOMSeriesItemWidget::~ctkDICOMSeriesItemWidget() Q_D(ctkDICOMSeriesItemWidget); QObject::disconnect(d->SeriesThumbnail, SIGNAL(statusPushButtonClicked(bool)), - this, SLOT(onStatusPushButtonClicked(bool))); + this, SLOT(onOperationStatusButtonClicked(bool))); } //------------------------------------------------------------------------------ @@ -1091,7 +1091,7 @@ void ctkDICOMSeriesItemWidget::onJobFinished(const QVariant &data) } //---------------------------------------------------------------------------- -void ctkDICOMSeriesItemWidget::onStatusPushButtonClicked(bool) +void ctkDICOMSeriesItemWidget::onOperationStatusButtonClicked(bool) { Q_D(ctkDICOMSeriesItemWidget); @@ -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"; diff --git a/Libs/DICOM/Widgets/ctkDICOMSeriesItemWidget.h b/Libs/DICOM/Widgets/ctkDICOMSeriesItemWidget.h index f57fe7bbf4..a3b8026a2a 100644 --- a/Libs/DICOM/Widgets/ctkDICOMSeriesItemWidget.h +++ b/Libs/DICOM/Widgets/ctkDICOMSeriesItemWidget.h @@ -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 d_ptr; diff --git a/Libs/DICOM/Widgets/ctkDICOMStudyItemWidget.cpp b/Libs/DICOM/Widgets/ctkDICOMStudyItemWidget.cpp index d5d9e497ab..74f174f5f0 100644 --- a/Libs/DICOM/Widgets/ctkDICOMStudyItemWidget.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMStudyItemWidget.cpp @@ -160,6 +160,7 @@ void ctkDICOMStudyItemWidgetPrivate::init(ctkDICOMPatientItemWidget* top, QWidge this->StudyDescriptionTextBrowser->hide(); this->StudyDescriptionTextBrowser->setReadOnly(true); + this->StudyDescriptionTextBrowser->setDisableMouseScroll(true); this->StudyItemCollapsibleGroupBox->setCollapsed(false); this->OperationStatusPushButton->hide(); @@ -167,7 +168,7 @@ void ctkDICOMStudyItemWidgetPrivate::init(ctkDICOMPatientItemWidget* top, QWidge QObject::connect(this->StudySelectionCheckBox, SIGNAL(clicked(bool)), q, SLOT(onStudySelectionClicked(bool))); QObject::connect(this->OperationStatusPushButton, SIGNAL(clicked(bool)), - q, SLOT(onOperationStatusClicked(bool))); + q, SLOT(onOperationStatusButtonClicked(bool))); } //------------------------------------------------------------------------------ @@ -509,7 +510,29 @@ void ctkDICOMStudyItemWidget::setDescription(const QString& description) } else { - d->StudyDescriptionTextBrowser->setText(description); + QFontMetrics metrics(d->StudyDescriptionTextBrowser->font()); + int textWidth = metrics.horizontalAdvance(description); + int widgetWidth = this->width(); + if (textWidth > widgetWidth) + { + int length = 0; + while (length < description.length() && metrics.horizontalAdvance(description.mid(0, length)) <= widgetWidth) + { + length++; + } + + QString wrappedText = description; + if (length < description.length()) + { + wrappedText.insert(length, "\n"); + } + d->StudyDescriptionTextBrowser->setCollapsibleText(wrappedText); + } + else + { + d->StudyDescriptionTextBrowser->setPlainText(description); + } + d->StudyDescriptionTextBrowser->show(); } } @@ -891,7 +914,7 @@ void ctkDICOMStudyItemWidget::onStudySelectionClicked(bool toggled) } //------------------------------------------------------------------------------ -void ctkDICOMStudyItemWidget::onOperationStatusClicked(bool) +void ctkDICOMStudyItemWidget::onOperationStatusButtonClicked(bool) { Q_D(ctkDICOMStudyItemWidget); @@ -901,7 +924,8 @@ void ctkDICOMStudyItemWidget::onOperationStatusClicked(bool) d->Scheduler->stopJobsByDICOMUIDs(QStringList(), QStringList(d->StudyInstanceUID)); } - else if (status == ctkDICOMStudyItemWidget::Failed) + else if (status == ctkDICOMStudyItemWidget::Failed || + status == ctkDICOMStudyItemWidget::Completed) { ctkDICOMJobDetail queryJobDetail; queryJobDetail.JobClass = "ctkDICOMQueryJob"; diff --git a/Libs/DICOM/Widgets/ctkDICOMStudyItemWidget.h b/Libs/DICOM/Widgets/ctkDICOMStudyItemWidget.h index 86755c8196..a868dbffae 100644 --- a/Libs/DICOM/Widgets/ctkDICOMStudyItemWidget.h +++ b/Libs/DICOM/Widgets/ctkDICOMStudyItemWidget.h @@ -220,7 +220,7 @@ public Q_SLOTS: void onJobFailed(const QVariant&); void onJobFinished(const QVariant&); void onStudySelectionClicked(bool); - void onOperationStatusClicked(bool); + void onOperationStatusButtonClicked(bool); Q_SIGNALS: /// Emitted when the GUI finished to update after a series query. diff --git a/Libs/DICOM/Widgets/ctkDICOMVisualBrowserWidget.cpp b/Libs/DICOM/Widgets/ctkDICOMVisualBrowserWidget.cpp index a10a870770..a094c4bed2 100644 --- a/Libs/DICOM/Widgets/ctkDICOMVisualBrowserWidget.cpp +++ b/Libs/DICOM/Widgets/ctkDICOMVisualBrowserWidget.cpp @@ -3128,7 +3128,8 @@ void ctkDICOMVisualBrowserWidget::onOperationStatusTabBarItemClicked(int index) { d->Scheduler->stopJobsByDICOMUIDs(QStringList(patientItemWidget->patientID())); } - else if (status == ctkDICOMPatientItemWidget::Failed) + else if (status == ctkDICOMPatientItemWidget::Failed || + status == ctkDICOMPatientItemWidget::Completed) { ctkDICOMJobDetail queryJobDetail; queryJobDetail.JobClass = "ctkDICOMQueryJob"; @@ -3137,7 +3138,6 @@ void ctkDICOMVisualBrowserWidget::onOperationStatusTabBarItemClicked(int index) d->Scheduler->runJob(queryJobDetail, patientItemWidget->allowedServers()); } - } //------------------------------------------------------------------------------ diff --git a/Libs/Widgets/ctkFittedTextBrowser.cpp b/Libs/Widgets/ctkFittedTextBrowser.cpp index 1ecb6c165b..cabe3f84e4 100644 --- a/Libs/Widgets/ctkFittedTextBrowser.cpp +++ b/Libs/Widgets/ctkFittedTextBrowser.cpp @@ -36,6 +36,7 @@ ctkFittedTextBrowserPrivate::ctkFittedTextBrowserPrivate(ctkFittedTextBrowser& o :q_ptr(&object) { this->Collapsed = true; + this->DisableMouseScroll = false; this->CollapsibleTextSetter = ctkFittedTextBrowserPrivate::Text; this->ShowDetailsText = ctkFittedTextBrowser::tr("Show details..."); this->HideDetailsText = ctkFittedTextBrowser::tr("Hide details."); @@ -153,7 +154,6 @@ ctkFittedTextBrowser::ctkFittedTextBrowser(QWidget* _parent) //----------------------------------------------------------------------------- ctkFittedTextBrowser::~ctkFittedTextBrowser() { - } //----------------------------------------------------------------------------- @@ -223,6 +223,15 @@ void ctkFittedTextBrowser::resizeEvent(QResizeEvent* e) } } +//----------------------------------------------------------------------------- +void ctkFittedTextBrowser::wheelEvent(QWheelEvent *event) +{ + if (!this->disableMouseScroll()) + { + this->QTextBrowser::wheelEvent(event); + } +} + //----------------------------------------------------------------------------- void ctkFittedTextBrowser::setCollapsibleText(const QString &text) { @@ -294,6 +303,20 @@ bool ctkFittedTextBrowser::collapsed() const return d->Collapsed; } +//----------------------------------------------------------------------------- +void ctkFittedTextBrowser::setDisableMouseScroll(bool disableMouseScroll) +{ + Q_D(ctkFittedTextBrowser); + d->DisableMouseScroll = disableMouseScroll; +} + +//----------------------------------------------------------------------------- +bool ctkFittedTextBrowser::disableMouseScroll() const +{ + Q_D(const ctkFittedTextBrowser); + return d->DisableMouseScroll; +} + //----------------------------------------------------------------------------- void ctkFittedTextBrowser::setShowDetailsText(const QString &text) { diff --git a/Libs/Widgets/ctkFittedTextBrowser.h b/Libs/Widgets/ctkFittedTextBrowser.h index 785eb81f29..9c024d530e 100644 --- a/Libs/Widgets/ctkFittedTextBrowser.h +++ b/Libs/Widgets/ctkFittedTextBrowser.h @@ -42,15 +42,21 @@ class ctkFittedTextBrowserPrivate; class CTK_WIDGETS_EXPORT ctkFittedTextBrowser : public QTextBrowser { Q_OBJECT + Q_PROPERTY(bool disableMouseScroll READ disableMouseScroll WRITE setDisableMouseScroll) Q_PROPERTY(bool collapsed READ collapsed WRITE setCollapsed) Q_PROPERTY(QString showDetailsText READ showDetailsText WRITE setShowDetailsText) Q_PROPERTY(QString hideDetailsText READ hideDetailsText WRITE setHideDetailsText) - public: ctkFittedTextBrowser(QWidget* parent = 0); virtual ~ctkFittedTextBrowser(); + /// Disable mouse scroll is false by default. + /// If set to true, the mouse wheel event is ignored. + void setDisableMouseScroll(bool disableMouseScroll); + /// return if mouse scroll is disabled + bool disableMouseScroll() const; + /// Show only first line/the full text. /// Only has effect if collapsible = true. void setCollapsed(bool collapsed); @@ -73,11 +79,11 @@ class CTK_WIDGETS_EXPORT ctkFittedTextBrowser : public QTextBrowser Q_INVOKABLE QString collapsibleText() const; /// Reimplemented for internal reasons - virtual QSize sizeHint() const; + virtual QSize sizeHint() const override; /// Reimplemented for internal reasons - virtual QSize minimumSizeHint() const; + virtual QSize minimumSizeHint() const override; /// Reimplemented for internal reasons - virtual int heightForWidth(int width) const; + virtual int heightForWidth(int width) const override; public Q_SLOTS: @@ -111,7 +117,8 @@ protected Q_SLOTS: protected: QScopedPointer d_ptr; - virtual void resizeEvent(QResizeEvent* e); + virtual void resizeEvent(QResizeEvent* event) override; + void wheelEvent(QWheelEvent *event) override; private: Q_DECLARE_PRIVATE(ctkFittedTextBrowser); diff --git a/Libs/Widgets/ctkFittedTextBrowser_p.h b/Libs/Widgets/ctkFittedTextBrowser_p.h index e11b7ceccf..c90f3bb7f6 100644 --- a/Libs/Widgets/ctkFittedTextBrowser_p.h +++ b/Libs/Widgets/ctkFittedTextBrowser_p.h @@ -49,6 +49,7 @@ class CTK_WIDGETS_EXPORT ctkFittedTextBrowserPrivate QString collapseLinkText() const; bool Collapsed; + bool DisableMouseScroll; QString ShowDetailsText; QString HideDetailsText;