Add radioButton in GetWorklistDialog .

This commit is contained in:
sunwen
2023-08-30 17:19:26 +08:00
parent a384950cd6
commit 20b4d1ce36
6 changed files with 63 additions and 10 deletions

View File

@@ -9,6 +9,8 @@
#include <QUuid>
#include <QDateTime>
#include <QSqlRecord>
#include <QRadioButton>
#include <QButtonGroup>
#include "components/ULineEdit.h"
#include "action/GetWorkListAction.h"
@@ -20,15 +22,15 @@ GetWorkListDialog::GetWorkListDialog(QSqlTableModel* aSqlModel, QTableView* aTa
, mPatientId(new ULineEdit(mContentWidget))
, mErrorLabel(new QLabel(mContentWidget))
, mAccessionNumText(new QLabel(mContentWidget))
, mAccessionNumEndLine(new QLabel(mContentWidget))
, mPatientIDText(new QLabel(mContentWidget))
, mPatientIDLine(new QLabel(mContentWidget))
, mEditEndLine(new QLabel(mContentWidget))
, mPatientSelectTable(new QTableView(mContentWidget))
, mMode(PatientSearchMode)
, mPatientSelectModel(new QStandardItemModel(mContentWidget))
, mSqlModel(aSqlModel)
, mTableView(aTableView)
, mSearchedPatients()
, mRadioButtonArea(new QWidget(mContentWidget))
{
initializeContentWidgets();
GetWorkListAction* action = qobject_cast<GetWorkListAction*>(getAction());
@@ -45,19 +47,50 @@ GetWorkListDialog::~GetWorkListDialog()
void GetWorkListDialog::initializeContentWidgets()
{
QVBoxLayout* contentLayout = new QVBoxLayout(mContentWidget);
mRadioButtonArea->setObjectName("RadioButtonArea");
contentLayout->addWidget(mRadioButtonArea);
QHBoxLayout* radioButtonLayout = new QHBoxLayout(mRadioButtonArea);
radioButtonLayout->setSpacing(50);
QRadioButton* radioButton1 = new QRadioButton(tr("Accession Number"), this);
radioButton1->setChecked(true);
QRadioButton* radioButton2 = new QRadioButton(tr("Patient ID"), this);
radioButtonLayout->addWidget(radioButton1);
radioButtonLayout->addWidget(radioButton2);
QButtonGroup* buttonGroup = new QButtonGroup(this);
buttonGroup->addButton(radioButton1, 0);
buttonGroup->addButton(radioButton2, 1);
connect(buttonGroup, QOverload<int>::of(&QButtonGroup::buttonClicked), [this](int aButtonIndex)
{
mAccessionNumber->clear();
mPatientId->clear();
if(aButtonIndex == 0)
{
mPatientIDText->setVisible(false);
mPatientId->setVisible(false);
mAccessionNumText->setVisible(true);
mAccessionNumber->setVisible(true);
}
else
{
mAccessionNumText->setVisible(false);
mAccessionNumber->setVisible(false);
mPatientIDText->setVisible(true);
mPatientId->setVisible(true);
}
});
//Accession Nummber
mAccessionNumText->setText(tr("Accession Nummber"));
contentLayout->addWidget(mAccessionNumText);
contentLayout->addWidget(mAccessionNumber);
mAccessionNumEndLine->setObjectName("endline");
contentLayout->addWidget(mAccessionNumEndLine);
//PatientId
mPatientIDText->setText(tr("Patient ID"));
contentLayout->addWidget(mPatientIDText);
contentLayout->addWidget(mPatientId);
mPatientIDLine->setObjectName("endline");
contentLayout->addWidget(mPatientIDLine);
mEditEndLine->setObjectName("endline");
contentLayout->addWidget(mEditEndLine);
mPatientIDText->setVisible(false);
mPatientId->setVisible(false);
//TableView
contentLayout->addWidget(mPatientSelectTable);
@@ -166,13 +199,13 @@ void GetWorkListDialog::showPatientSelectTable()
QRect re = geometry();
setGeometry(re.x() - 200, re.y(), 900, re.height());
mMode = PatientSelectMode;
mRadioButtonArea->hide();
mAccessionNumber->hide();
mPatientId->hide();
mErrorLabel->hide();
mAccessionNumText->hide();
mAccessionNumEndLine->hide();
mPatientIDText->hide();
mPatientIDLine->hide();
mEditEndLine->hide();
mPatientSelectTable->show();
mContentWidget->show();

View File

@@ -38,15 +38,15 @@ private:
ULineEdit* mPatientId;
QLabel* mErrorLabel;
QLabel* mAccessionNumText;
QLabel* mAccessionNumEndLine;
QLabel* mPatientIDText;
QLabel* mPatientIDLine;
QLabel* mEditEndLine;
QTableView* mPatientSelectTable;
GetWorkListDialogMode mMode;
QStandardItemModel* mPatientSelectModel;
QSqlTableModel* mSqlModel;
QTableView* mTableView;
QList<PatientInformationPointer> mSearchedPatients;
QWidget* mRadioButtonArea;
};

BIN
src/icons/radio_check.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

BIN
src/icons/radio_uncheck.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

@@ -55,5 +55,7 @@
<file>icons/drainage.png</file>
<file>icons/trash.png</file>
<file>icons/query.png</file>
<file>icons/radio_check.png</file>
<file>icons/radio_uncheck.png</file>
</qresource>
</RCC>

View File

@@ -877,3 +877,21 @@ QLabel#MultyMessageDialogSucess {
qproperty-pixmap: url(":/icons/dicom/echo_suc.png");
qproperty-scaledContents: true;
}
QRadioButton{
font-size: 18px;
spacing:20px;
}
QRadioButton::indicator::unchecked{
image: url(":/icons/radio_uncheck.png");
}
QRadioButton::indicator::checked{
image: url(":/icons/radio_check.png");
}
QWidget#RadioButtonArea
{
border-bottom: 1px solid grey;
}