Hide able edit patient panel.
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "log/UserOperationLog.h"
|
#include "log/UserOperationLog.h"
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
#include "src/components/VerticalTextToolButton.h"
|
||||||
|
|
||||||
#define ADD_CENTER_ITEM(row,col,text)\
|
#define ADD_CENTER_ITEM(row,col,text)\
|
||||||
item = new QTableWidgetItem(text);\
|
item = new QTableWidgetItem(text);\
|
||||||
@@ -36,23 +37,7 @@ int queryValue(QSqlTableModel* model, int colID, QVariant var)
|
|||||||
SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
||||||
TabFormWidget(parent)
|
TabFormWidget(parent)
|
||||||
{
|
{
|
||||||
// const char* style="QHeaderView::section{background-color:#595959;"
|
//init command bar
|
||||||
// " min-height:50px;max-height:50px;"
|
|
||||||
// "font-weight:Bold; font-size:16px; border:1px solid #323232;}"
|
|
||||||
// "QHeaderView::section:horizontal{border-bottom: 1px solid rgb(0,170,255);}"
|
|
||||||
// "QHeaderView::section:vertical{min-height:36px;max-height:36px;}"
|
|
||||||
// "QWidget#edit_patient{min-width:300px;max-width:300px;}"
|
|
||||||
// "QTableView{border:none}"
|
|
||||||
// "QTableView{alternate-background-color: #595959;selection-color:white;selection-background-color:#0078d8}"
|
|
||||||
// "QToolButton#sexBtn{min-width:120px;max-width:120px;font-size:20px;padding:2px;}"
|
|
||||||
// "QToolButton#sexBtn:disabled{color:silver}"
|
|
||||||
// "QWidget#sexpanelwidget{border:1px solid silver;}"
|
|
||||||
// "QWidget#sexpanelwidget:enabled{background-color: #515151;}"
|
|
||||||
// "QToolButton#sexBtn:checked{border:2px solid darkorange;padding:0px;}"
|
|
||||||
// ;
|
|
||||||
//
|
|
||||||
// this->setStyleSheet(this->styleSheet().append(style));
|
|
||||||
//init command bar
|
|
||||||
QHBoxLayout* layout = new QHBoxLayout();
|
QHBoxLayout* layout = new QHBoxLayout();
|
||||||
ui->commandWidget->setLayout(layout);
|
ui->commandWidget->setLayout(layout);
|
||||||
ADD_TOOL_BTN(Account, ":/icons/account.png");
|
ADD_TOOL_BTN(Account, ":/icons/account.png");
|
||||||
@@ -76,6 +61,7 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
|||||||
|
|
||||||
//Init content widget
|
//Init content widget
|
||||||
QHBoxLayout* contentLayout = new QHBoxLayout();
|
QHBoxLayout* contentLayout = new QHBoxLayout();
|
||||||
|
contentLayout->setContentsMargins(5,5,0,5);
|
||||||
this->ui->contentWidget->setLayout(contentLayout);
|
this->ui->contentWidget->setLayout(contentLayout);
|
||||||
// TableView for patient
|
// TableView for patient
|
||||||
QTableView* table = new SlideableTableView(this);
|
QTableView* table = new SlideableTableView(this);
|
||||||
@@ -125,8 +111,29 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
|||||||
//edit panel
|
//edit panel
|
||||||
EditPatientForm* edit_patient = new EditPatientForm(this);
|
EditPatientForm* edit_patient = new EditPatientForm(this);
|
||||||
edit_patient->setObjectName("edit_patient");
|
edit_patient->setObjectName("edit_patient");
|
||||||
|
edit_patient->hide();
|
||||||
contentLayout->addWidget(edit_patient);
|
contentLayout->addWidget(edit_patient);
|
||||||
//select default row 0
|
|
||||||
|
auto *btnShowEdit = new VerticalTextToolButton(this);
|
||||||
|
btnShowEdit->setObjectName("showeditBtn");
|
||||||
|
btnShowEdit->setIcon(QIcon(":/icons/edit.png"));
|
||||||
|
btnShowEdit->setIconSize(QSize(30, 30));
|
||||||
|
btnShowEdit->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||||
|
btnShowEdit->setFixedHeight(225);
|
||||||
|
// btnShowEdit->setVerticalText("E\nd\ni\nt\nP\na\nn\ne\nl");
|
||||||
|
btnShowEdit->setVerticalText("Patient Detail");
|
||||||
|
contentLayout->addWidget(btnShowEdit);
|
||||||
|
contentLayout->setAlignment(btnShowEdit, Qt::AlignmentFlag::AlignTop);
|
||||||
|
connect(btnShowEdit,&QToolButton::clicked,[=](){
|
||||||
|
edit_patient->show();
|
||||||
|
btnShowEdit->hide();
|
||||||
|
});
|
||||||
|
connect(edit_patient, &EditPatientForm::hideBtnClicked, [=](){
|
||||||
|
edit_patient->hide();
|
||||||
|
btnShowEdit->show();
|
||||||
|
});
|
||||||
|
|
||||||
|
//select default row 0
|
||||||
if (model->rowCount() > 0)
|
if (model->rowCount() > 0)
|
||||||
{
|
{
|
||||||
table->selectRow(0);
|
table->selectRow(0);
|
||||||
@@ -136,7 +143,7 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
|||||||
pat. val = model->data(model->index(currentRow,PatientInformationEnum:: val)).toString();
|
pat. val = model->data(model->index(currentRow,PatientInformationEnum:: val)).toString();
|
||||||
EDIT_PATIENT()
|
EDIT_PATIENT()
|
||||||
#undef ADD_PATIENT_PROPERTY
|
#undef ADD_PATIENT_PROPERTY
|
||||||
edit_patient->setPatientInformation(&pat);
|
edit_patient->setPatientInformation(&pat);
|
||||||
}
|
}
|
||||||
//events----------------------------------------------------------------------
|
//events----------------------------------------------------------------------
|
||||||
//table current row selection changing event
|
//table current row selection changing event
|
||||||
|
|||||||
26
src/components/VerticalTextToolButton.cpp
Normal file
26
src/components/VerticalTextToolButton.cpp
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
//
|
||||||
|
// Created by Krad on 2022/1/11.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <QtWidgets/qstyleoption.h>
|
||||||
|
#include <QPaintEvent>
|
||||||
|
#include <QStylePainter>
|
||||||
|
#include "VerticalTextToolButton.h"
|
||||||
|
|
||||||
|
VerticalTextToolButton::VerticalTextToolButton(QWidget *parent) : QToolButton(parent) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
VerticalTextToolButton::~VerticalTextToolButton() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void VerticalTextToolButton::paintEvent(QPaintEvent *e) {
|
||||||
|
QToolButton::paintEvent(e);
|
||||||
|
QStylePainter p(this);
|
||||||
|
QStyleOptionToolButton opt;
|
||||||
|
initStyleOption(&opt);
|
||||||
|
p.rotate(90);
|
||||||
|
p.drawText(this->iconSize().height()+10,-this->iconSize().height()/2+1,this->verticalText);
|
||||||
|
// p.drawItemText( r,alignment,opt.palette,true,this->verticalText,QPalette::ButtonText);
|
||||||
|
}
|
||||||
24
src/components/VerticalTextToolButton.h
Normal file
24
src/components/VerticalTextToolButton.h
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
//
|
||||||
|
// Created by Krad on 2022/1/11.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef GUI_VERTICALTEXTTOOLBUTTON_H
|
||||||
|
#define GUI_VERTICALTEXTTOOLBUTTON_H
|
||||||
|
|
||||||
|
#include <QToolButton>
|
||||||
|
class VerticalTextToolButton: public QToolButton {
|
||||||
|
public:
|
||||||
|
explicit VerticalTextToolButton(QWidget* parent = nullptr);
|
||||||
|
virtual ~VerticalTextToolButton();
|
||||||
|
void setVerticalText(const QString text){
|
||||||
|
verticalText = text;
|
||||||
|
}
|
||||||
|
protected:
|
||||||
|
virtual void paintEvent(QPaintEvent* e) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString verticalText;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //GUI_VERTICALTEXTTOOLBUTTON_H
|
||||||
@@ -12,6 +12,7 @@ EditPatientForm::EditPatientForm(QWidget* parent) :
|
|||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::EditPatientForm)
|
ui(new Ui::EditPatientForm)
|
||||||
{
|
{
|
||||||
|
// this->layout()->setContentsMargins(5,5,5,5);
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
//ui->lbl_Sex->setText(tr("Gender"));
|
//ui->lbl_Sex->setText(tr("Gender"));
|
||||||
QHBoxLayout* sexlayout = new QHBoxLayout(ui->sexpanelwidget);
|
QHBoxLayout* sexlayout = new QHBoxLayout(ui->sexpanelwidget);
|
||||||
@@ -21,6 +22,16 @@ EditPatientForm::EditPatientForm(QWidget* parent) :
|
|||||||
btnF->setText(tr("Female"));
|
btnF->setText(tr("Female"));
|
||||||
btnM->setText(tr("Male"));
|
btnM->setText(tr("Male"));
|
||||||
|
|
||||||
|
ui->hideBtn->setSizePolicy(QSizePolicy::Policy::Expanding,QSizePolicy::Policy::Preferred);
|
||||||
|
ui->hideBtn->setObjectName("hideeditBtn");
|
||||||
|
ui->hideBtn->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||||
|
ui->hideBtn->setIcon(QIcon(":/icons/hidearrow.png"));
|
||||||
|
ui->hideBtn->setIconSize({30,30});
|
||||||
|
ui->hideBtn->setText(tr(" Hide Panel"));
|
||||||
|
connect(ui->hideBtn,&QToolButton::clicked,[=](){
|
||||||
|
emit hideBtnClicked();
|
||||||
|
});
|
||||||
|
|
||||||
// btnFemale->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
// btnFemale->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||||
// btnMale->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
// btnMale->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void editAccept(PatientInformation * detail,bool & accept);
|
void editAccept(PatientInformation * detail,bool & accept);
|
||||||
void editCancel();
|
void editCancel();
|
||||||
|
signals:
|
||||||
|
void hideBtnClicked();
|
||||||
private:
|
private:
|
||||||
Ui::EditPatientForm *ui;
|
Ui::EditPatientForm *ui;
|
||||||
QString currentPatientUID;
|
QString currentPatientUID;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>3</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@@ -29,8 +29,27 @@
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="hideBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="lbl_ID">
|
<widget class="QLabel" name="lbl_ID">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|||||||
BIN
src/icons/edit.png
Normal file
BIN
src/icons/edit.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.9 KiB |
BIN
src/icons/hidearrow.png
Normal file
BIN
src/icons/hidearrow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
@@ -213,7 +213,7 @@ void MainWindow::changeEvent(QEvent* event)
|
|||||||
|
|
||||||
void MainWindow::loadStyleSheet(const QString& sheetName)
|
void MainWindow::loadStyleSheet(const QString& sheetName)
|
||||||
{
|
{
|
||||||
QFile file(":/stylesheet/" + sheetName + ".qss");
|
QFile file(":/stylesheet/" + sheetName + ".css");
|
||||||
file.open(QFile::ReadOnly);
|
file.open(QFile::ReadOnly);
|
||||||
if (file.isOpen())
|
if (file.isOpen())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -46,6 +46,6 @@
|
|||||||
<file>stylesheet/Dark.css</file>
|
<file>stylesheet/Dark.css</file>
|
||||||
<file>stylesheet/Dark2.css</file>
|
<file>stylesheet/Dark2.css</file>
|
||||||
<file>icons/edit.png</file>
|
<file>icons/edit.png</file>
|
||||||
<file>icons/left-arrow-from-left.png</file>
|
<file>icons/hidearrow.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user