Skip to content

Commit

Permalink
BUG: Fix minor UI issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Punzo committed Dec 11, 2023
1 parent fe557e8 commit c257967
Show file tree
Hide file tree
Showing 3 changed files with 159 additions and 141 deletions.
276 changes: 143 additions & 133 deletions Libs/DICOM/Widgets/Resources/UI/ctkDICOMStudyItemWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>378</width>
<height>318</height>
<height>534</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -61,142 +61,152 @@
</widget>
</item>
<item>
<widget class="ctkCollapsibleGroupBox" name="StudyItemCollapsibleGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="title">
<string>Study ID 1234 --- Date</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>7</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="ctkFittedTextBrowser" name="StudyDescriptionTextBrowser">
<property name="styleSheet">
<string notr="true"/>
</property>
<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;
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="ctkCollapsibleGroupBox" name="StudyItemCollapsibleGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="title">
<string>Study ID 1234 --- Date</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>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>7</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="ctkFittedTextBrowser" name="StudyDescriptionTextBrowser">
<property name="styleSheet">
<string notr="true"/>
</property>
<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'; font-size:12pt; 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;&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">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>10</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContents</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="showGrid">
<bool>false</bool>
</property>
<property name="gridStyle">
<enum>Qt::NoPen</enum>
</property>
<property name="columnCount">
<number>6</number>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<column/>
<column/>
<column/>
<column/>
<column/>
<column/>
</widget>
</item>
</layout>
</widget>
</property>
</widget>
</item>
<item>
<widget class="QTableWidget" name="SeriesListTableWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContents</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="showGrid">
<bool>false</bool>
</property>
<property name="gridStyle">
<enum>Qt::NoPen</enum>
</property>
<property name="columnCount">
<number>6</number>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<column/>
<column/>
<column/>
<column/>
<column/>
<column/>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget" native="true"/>
</item>
</layout>
</item>
</layout>
</widget>
Expand Down
5 changes: 3 additions & 2 deletions Libs/DICOM/Widgets/ctkDICOMPatientItemWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

//----------------------------------------------------------------------------
Expand Down
19 changes: 13 additions & 6 deletions Libs/DICOM/Widgets/ctkDICOMVisualBrowserWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)));

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit c257967

Please sign in to comment.