Add ImageView titleBar message
This commit is contained in:
@@ -97,8 +97,11 @@ void DICOMDirectoryHelper::getFileProperty(const std::string &path, DICOMFileMap
|
||||
ReadTAGToProperty(PatientName, 0x0010, 0x0010)
|
||||
ReadTAGToProperty(PatientBirthDate, 0x0010, 0x0030)
|
||||
ReadTAGToProperty(PatientSex, 0x0010, 0x0040)
|
||||
ReadTAGToProperty(PatientAge, 0x0010, 0x1010)
|
||||
ReadTAGToProperty(StudyDate, 0x0008, 0x0020)
|
||||
ReadTAGToProperty(AcquisitionDate, 0x0008, 0x0022)
|
||||
ReadTAGToProperty(StudyTime, 0x0008, 0x0030)
|
||||
ReadTAGToProperty(AcquisitionTime, 0x0008, 0x0032)
|
||||
ReadTAGToProperty(Modality, 0x0008, 0x0060)
|
||||
ReadTAGToProperty(InstitutionName, 0x0008, 0x0080)
|
||||
ReadTAGToProperty(StudyDescription, 0x0008, 0x1030)
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
#define BUTTON_WIDTH 15 // Button width;
|
||||
#define TITLE_HEIGHT 15 // Title bar height;
|
||||
|
||||
static QString unpick_style = "*{background-color:#2d2d2d;border: 0px;}";
|
||||
static QString pick_style = "*{background-color:#463232;border: 0px;color:ebebc8;}";
|
||||
//title字体用申布伦黄
|
||||
static QString unpick_style = "*{background-color:#2d2d2d;border: 0px;} QLabel#titleContent{color:#FBD26A;font-weight:20}";
|
||||
static QString pick_style = "*{background-color:#463232;border: 0px;color:ebebc8;} QLabel#titleContent{color:#FBD26A;font-weight:20}";
|
||||
|
||||
|
||||
MyTitleBar::MyTitleBar(QWidget *parent)
|
||||
@@ -48,7 +49,7 @@ void MyTitleBar::initControl()
|
||||
m_pButtonMax->setFixedSize(QSize(BUTTON_WIDTH, BUTTON_HEIGHT));
|
||||
m_pButtonClose->setFixedSize(QSize(BUTTON_WIDTH, BUTTON_HEIGHT));
|
||||
|
||||
m_pTitleContent->setObjectName("TitleContent");
|
||||
m_pTitleContent->setObjectName("titleContent");
|
||||
// m_pButtonMin->setObjectName("ButtonMin");
|
||||
//m_pButtonRestore->setObjectName("ButtonRestore");
|
||||
m_pButtonMax->setObjectName("ButtonMax");
|
||||
@@ -69,7 +70,7 @@ void MyTitleBar::initControl()
|
||||
QHBoxLayout* mylayout = new QHBoxLayout(this);
|
||||
mylayout->addWidget(m_pIcon);
|
||||
mylayout->addWidget(m_pTitleContent);
|
||||
|
||||
mylayout->addSpacerItem(new QSpacerItem(BUTTON_WIDTH,BUTTON_WIDTH, QSizePolicy::Expanding));
|
||||
//mylayout->addWidget(m_pButtonMin);
|
||||
// mylayout->addWidget(m_pButtonRestore);
|
||||
mylayout->addWidget(m_pButtonMax);
|
||||
@@ -112,13 +113,8 @@ void MyTitleBar::setTitleIcon(QString filePath, QSize IconSize)
|
||||
}
|
||||
|
||||
// Set the title content;
|
||||
void MyTitleBar::setTitleContent(QString titleContent, int titleFontSize)
|
||||
void MyTitleBar::setTitleContent(QString titleContent)
|
||||
{
|
||||
// Set the title font size;
|
||||
//QFont font = m_pTitleContent->font();
|
||||
//font.setPointSize(titleFontSize);
|
||||
//m_pTitleContent->setFont(font);
|
||||
// Set the title content;
|
||||
m_pTitleContent->setText(titleContent);
|
||||
m_titleContent = titleContent;
|
||||
}
|
||||
|
||||
@@ -10,73 +10,70 @@
|
||||
// ONLY_CLOSE_BUTTON // Only close button;
|
||||
//};
|
||||
|
||||
class MyTitleBar : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
class MyTitleBar : public QFrame {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MyTitleBar(QWidget *parent);
|
||||
//Here parent does not give the default value of NULL, to ensure that the parent pointer must be assigned when the MyTitleBar object is created; and the assignment is not NULL;
|
||||
|
||||
~MyTitleBar();
|
||||
|
||||
void SetHighlight(bool yes);
|
||||
// Set the background color of the title bar and whether to set the background color of the title bar to be transparent;
|
||||
//protected:
|
||||
// void paintEvent(QPaintEvent *event);
|
||||
|
||||
// Set the button type on the title bar;
|
||||
//void setButtonType(ButtonType buttonType);
|
||||
// Set whether the title in the title bar will scroll; you can see the effect for details;
|
||||
//void setTitleRoll();
|
||||
// Set the width of the window border;
|
||||
//void setWindowBorderWidth(int borderWidth);
|
||||
|
||||
// Save/Get the position and size of the window before maximizing;
|
||||
//void saveRestoreInfo(const QPoint point, const QSize size);
|
||||
//void getRestoreInfo(QPoint& point, QSize& size);
|
||||
void setTitleContent(QString titleContent);
|
||||
|
||||
private:
|
||||
// Set the title bar icon;
|
||||
void setTitleIcon(QString filePath, QSize IconSize = QSize(25, 25));
|
||||
|
||||
// Set the title content;
|
||||
void setTitleContent(QString titleContent, int titleFontSize = 9);
|
||||
// Set the length of the title bar;
|
||||
void setTitleWidth(int width);
|
||||
|
||||
void setBackgroundColor(QColor pickColor);
|
||||
|
||||
|
||||
void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
|
||||
// void mouseMoveEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
|
||||
// Initialize the control;
|
||||
void initControl();
|
||||
|
||||
// Binding of signal slots;
|
||||
void initConnections();
|
||||
|
||||
// Load the style file;
|
||||
void loadStyleSheet(const QString &sheetName);
|
||||
|
||||
signals:
|
||||
|
||||
// The signal triggered by the button;
|
||||
//void signalViewClicked();
|
||||
void signalButtonMaxClicked();
|
||||
|
||||
void signalButtonCloseClicked();
|
||||
|
||||
private slots:
|
||||
|
||||
// The slot triggered by the button;
|
||||
// void onButtonMinClicked();
|
||||
//void onButtonRestoreClicked();
|
||||
void onButtonMaxClicked();
|
||||
|
||||
void onButtonCloseClicked();
|
||||
//void onRollTitle();
|
||||
|
||||
private:
|
||||
QLabel* m_pIcon; // title bar icon;
|
||||
QLabel* m_pTitleContent; // Title bar content;
|
||||
QLabel *m_pIcon; // title bar icon;
|
||||
QLabel *m_pTitleContent; // Title bar content;
|
||||
//QPushButton* m_pButtonMin; // Minimize button;
|
||||
//QPushButton* m_pButtonRestore; // Maximize restore button;
|
||||
QPushButton* m_pButtonMax; // Maximize button;
|
||||
QPushButton* m_pButtonClose; // Close button;
|
||||
QPushButton *m_pButtonMax; // Maximize button;
|
||||
QPushButton *m_pButtonClose; // Close button;
|
||||
|
||||
//QColor m_color;
|
||||
// The background color of the title bar;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "dicomimageview.h"
|
||||
#include "dicomimageview.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QDebug>
|
||||
@@ -140,6 +140,19 @@ void DicomImageView::loadSeries(SeriesImageSet *series) {
|
||||
if (!series) return;
|
||||
initImageViewer();
|
||||
mSeries = series;
|
||||
QString age = series->GetProperty()->GetPatientAge();
|
||||
age = age.isEmpty()?"":QString("%1%2").arg(age.left(age.length()-1).toInt()).arg(age.back());
|
||||
QString date = series->GetProperty()->GetAcquisitionDate();
|
||||
date = date.length()<8?"":
|
||||
QString("%1/%2/%3").arg(date.left(4), date.mid(4,2), date.right(2));
|
||||
QString time = series->GetProperty()->GetAcquisitionTime();
|
||||
time = time.length()<6?"": QString("%1:%2:%3").arg(time.left(2), time.mid(2,2), time.mid(4,2));
|
||||
mTitleBar->setTitleContent(QString("%1 (%2) - %3 %4 - %5")
|
||||
.arg(series->GetProperty()->GetPatientName())
|
||||
.arg(age)
|
||||
.arg(date)
|
||||
.arg(time)
|
||||
.arg(series->GetProperty()->GetSeriesDescription()));
|
||||
mImageViewer->SetInputData(mSeries->GetData());
|
||||
mImageViewer->InitCornerInfo(series->GetProperty());
|
||||
mImageViewer->SetupImageViewer();
|
||||
|
||||
Reference in New Issue
Block a user