diff --git a/src/SelectFormWidget.cpp b/src/SelectFormWidget.cpp index 99a73e3..0d5a2e1 100644 --- a/src/SelectFormWidget.cpp +++ b/src/SelectFormWidget.cpp @@ -18,6 +18,7 @@ #include #include "log/UserOperationLog.h" #include +#include "src/components/VerticalTextToolButton.h" #define ADD_CENTER_ITEM(row,col,text)\ item = new QTableWidgetItem(text);\ @@ -36,23 +37,7 @@ int queryValue(QSqlTableModel* model, int colID, QVariant var) SelectFormWidget::SelectFormWidget(QWidget* parent) : TabFormWidget(parent) { - // const char* style="QHeaderView::section{background-color:#595959;" - // " 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 + //init command bar QHBoxLayout* layout = new QHBoxLayout(); ui->commandWidget->setLayout(layout); ADD_TOOL_BTN(Account, ":/icons/account.png"); @@ -76,6 +61,7 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) : //Init content widget QHBoxLayout* contentLayout = new QHBoxLayout(); + contentLayout->setContentsMargins(5,5,0,5); this->ui->contentWidget->setLayout(contentLayout); // TableView for patient QTableView* table = new SlideableTableView(this); @@ -125,8 +111,29 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) : //edit panel EditPatientForm* edit_patient = new EditPatientForm(this); edit_patient->setObjectName("edit_patient"); + edit_patient->hide(); 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) { table->selectRow(0); @@ -136,7 +143,7 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) : pat. val = model->data(model->index(currentRow,PatientInformationEnum:: val)).toString(); EDIT_PATIENT() #undef ADD_PATIENT_PROPERTY - edit_patient->setPatientInformation(&pat); + edit_patient->setPatientInformation(&pat); } //events---------------------------------------------------------------------- //table current row selection changing event diff --git a/src/components/VerticalTextToolButton.cpp b/src/components/VerticalTextToolButton.cpp new file mode 100644 index 0000000..95acc9d --- /dev/null +++ b/src/components/VerticalTextToolButton.cpp @@ -0,0 +1,26 @@ +// +// Created by Krad on 2022/1/11. +// + +#include +#include +#include +#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); +} diff --git a/src/components/VerticalTextToolButton.h b/src/components/VerticalTextToolButton.h new file mode 100644 index 0000000..8274d9d --- /dev/null +++ b/src/components/VerticalTextToolButton.h @@ -0,0 +1,24 @@ +// +// Created by Krad on 2022/1/11. +// + +#ifndef GUI_VERTICALTEXTTOOLBUTTON_H +#define GUI_VERTICALTEXTTOOLBUTTON_H + +#include +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 diff --git a/src/editpatientform.cpp b/src/editpatientform.cpp index c78a314..4745d5f 100644 --- a/src/editpatientform.cpp +++ b/src/editpatientform.cpp @@ -12,6 +12,7 @@ EditPatientForm::EditPatientForm(QWidget* parent) : QWidget(parent), ui(new Ui::EditPatientForm) { +// this->layout()->setContentsMargins(5,5,5,5); ui->setupUi(this); //ui->lbl_Sex->setText(tr("Gender")); QHBoxLayout* sexlayout = new QHBoxLayout(ui->sexpanelwidget); @@ -21,6 +22,16 @@ EditPatientForm::EditPatientForm(QWidget* parent) : btnF->setText(tr("Female")); 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); // btnMale->setToolButtonStyle(Qt::ToolButtonIconOnly); diff --git a/src/editpatientform.h b/src/editpatientform.h index 3db537e..012155a 100644 --- a/src/editpatientform.h +++ b/src/editpatientform.h @@ -70,6 +70,8 @@ public: signals: void editAccept(PatientInformation * detail,bool & accept); void editCancel(); + signals: + void hideBtnClicked(); private: Ui::EditPatientForm *ui; QString currentPatientUID; diff --git a/src/editpatientform.ui b/src/editpatientform.ui index f769d60..990d93b 100644 --- a/src/editpatientform.ui +++ b/src/editpatientform.ui @@ -15,7 +15,7 @@ - 3 + 0 0 @@ -29,8 +29,27 @@ 0 + + + + ... + + + + + 6 + + + 6 + + + 6 + + + 6 + diff --git a/src/icons/edit.png b/src/icons/edit.png new file mode 100644 index 0000000..cb13682 Binary files /dev/null and b/src/icons/edit.png differ diff --git a/src/icons/hidearrow.png b/src/icons/hidearrow.png new file mode 100644 index 0000000..cd73c50 Binary files /dev/null and b/src/icons/hidearrow.png differ diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7584232..46a5adc 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -213,7 +213,7 @@ void MainWindow::changeEvent(QEvent* event) void MainWindow::loadStyleSheet(const QString& sheetName) { - QFile file(":/stylesheet/" + sheetName + ".qss"); + QFile file(":/stylesheet/" + sheetName + ".css"); file.open(QFile::ReadOnly); if (file.isOpen()) { diff --git a/src/res.qrc b/src/res.qrc index 215b1f8..1933abf 100644 --- a/src/res.qrc +++ b/src/res.qrc @@ -46,6 +46,6 @@ stylesheet/Dark.css stylesheet/Dark2.css icons/edit.png - icons/left-arrow-from-left.png + icons/hidearrow.png diff --git a/src/stylesheet/Dark2.css b/src/stylesheet/Dark2.css index 651f25d..8c5d6df 100644 --- a/src/stylesheet/Dark2.css +++ b/src/stylesheet/Dark2.css @@ -1 +1 @@ - /*------1.silver-->grey--------------------------*/ *{background-color:#3c3c3c; color:#fcfcfc;margin:0;font-size:16px;} QTabBar::tab { height:60px; width:300px; font-size: 25px; background:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #505050, stop: 1.0 #333333); border: 2px solid #505050; border-bottom-left-radius: 50%; border-bottom-right-radius: 50%; min-width: 8ex; padding: 2px; } QTabBar::tab:selected, QTabBar::tab:hover { border-top:5px solid #4a88c7; background: #505050;} QTabWidget::pane{margin:0} QPlainTextEdit{border:0px} QGroupBox{border:0px} QLabel{color:#fcfcfc; font-weight:bold; font-size:16px;} QLineEdit{min-height:36px;max-height:36px; border:1px solid #505050;color:grey;border-radius:3px;} QLineEdit:enabled{background-color: #505050;color:#fcfcfc;} QDateEdit{min-height:36px;max-height:36px; border:1px solid #505050;color:grey;border-radius:3px;} QDateEdit:enabled{background-color: #505050;color:#fcfcfc;} QTextEdit{ border:1px solid #505050;color:grey;border-radius:3px;} QTextEdit:enabled{background-color: #505050;color:#fcfcfc;} QComboBox{text-align:center;min-height:36px;max-height:36px; border:1px solid #505050} QComboBox:enabled{background-color: #505050} QComboBox::drop-down{width:20px} QComboBox QAbstractItemView{min-width:120px;} QComboBox QAbstractItemView::item {min-height:60px;max-height:60px; border:1px solid white;} QWidget QToolButton{border:none;border-radius:10%;font-size:26px; font-weight:Bold;padding:5px;} QWidget QToolButton:disabled{color:#606060;} QWidget QToolButton:hover{background:#505050;} QWidget QToolButton:checked{border:5px solid darkorange;padding:0px;} QPushButton{border:1px solid #505050 ;padding-left:50px;padding-right:50px; border-radius:5px; min-height:28px; max-height:28px; background:qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #505050, stop:1 #606060);} QListView{border:none;margin:5px; font-weight:bold} QListView::item{background:#4d4d4d;min-height:30px; border:1px solid #505050; border-radius:5px} QListView::item:selected{background:#365880;font-weight:bold;color:#fcfcfc;} /*QListView::item:selected{ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ABAFE5, stop: 1 #8588B2); border:1px solid #505050; }*/ QHeaderView::section{background-color:#595959;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;} QTableView{border:none;alternate-background-color: #595959;selection-color:#fcfcfc;selection-background-color:#0078d8} /*-----------Specific---------------*/ QLabel#sliderPickerLabel{color:grey;padding:0;background:#505050;font-weight:normal;font-size:50px;} QWidget#topbarWidget{min-height:36px;max-height:36px;} QWidget#contentWidget{border-top:1px solid #505050;} QWidget#commandWidget{min-height:123px;max-height:123px;border-top:1px solid #505050; border-bottom:1px solid #323232;} QLabel#logo{min-width:30px;max-width:30px} QLabel#company{min-width:150px;max-width:150px; } QLabel#systemMsgBar{min-width:500px;} QLabel#warn{color:#CCCC00;background:transparent;font-size:20px;} QWidget QWidget#statusBarWidget{min-width:300px;} QToolButton#btn_main{border:2px solid #0078d8;border-radius:10%;font-size:26px; font-weight:Bold;padding:5px;} QWidget#editcmdWidget{min-height:83px;max-height:83px;} QWidget#verSpaceLine{ border-right:1px solid #0078d8;} QWidget#topBottomLine{ border-top:2px solid #0078d8;border-bottom:2px solid #0078d8;background:transparent;} /*-----Settings*/ QPushButton#BigBtn{ padding-left:0px; padding-right:0px; min-height:60px; max-height:60px; min-width:140px; max-width:140px; font-size: 20px; font-weight:bold; } /*-----蒙版Dialog-----*/ QDialog QWidget#innerWidget{background:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0.0 darkgray, stop: 0.5 lightgray, stop: 1.0 darkgray);border-radius:20px;border:5px solid #0078d8; } QDialog#MessageDialog QWidget QWidget{ background:transparent;color:#3078d8;} QDialog#MessageDialog QWidget QWidget QLabel{ font-size:30px} #spacer_1, #spacer_2{min-width:2px;max-width:2px;margin-top:6px;margin-bottom:6px;border-right:1px solid #0078d8;} /*-----FormDialog-----*/ QPushButton#btnOK{background:#365880; font-weight:bold} QDialog#formDialog{border:3px solid grey; border-radius:8px} QWidget#slider_one{border:1px solid #505050; border-radius:8px} QWidget#formWidget QLabel#endline{border-bottom:1px solid grey} QWidget#formWidget{font-size:30px;} QLabel#title{font-size:30px; border-bottom:1px solid #3078d8 } QWidget#edit_patient{min-width:300px;max-width:300px;} QToolButton#sexBtn{min-width:120px;max-width:120px;font-size:20px;padding:2px;} QToolButton#sexBtn:disabled{color:grey} QWidget#sexpanelwidget{border:1px solid #505050;} QWidget#sexpanelwidget:enabled{background-color: #505050;} QToolButton#sexBtn:checked{border:2px solid darkorange;padding:0px;} /*---------Abount----------*/ QLabel#normal{color:#fcfcfc; font-weight:normal; font-size:16px;} QDialog#loginform{background-color:#3c3c3c; color:white;margin:0;font-size:16px;} QDialog#loginform QLabel#title{font-Size:98px;color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0.0 darkgray, stop: 0.5 lightgray, stop: 1.0 darkgray);} QLabel#warn{color:#930000;background:transparent;font-size:20px;} QFrame#login_frame_username{min-width:700px;max-width:700px;max-height:500px;min-height:500px; border:1px solid #0078d8;border-radius:20px; background:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0.0 darkgray, stop: 0.5 gray, stop: 1.0 darkgray);} QDialog#loginform QLineEdit{min-height:100px;max-height:100px; border:1px solid silver;border-radius:10px;font-size:26px;} QDialog#loginform QLineEdit:enabled{background-color: #515151} QDialog#loginform QToolButton#btnlogin{min-height:100px;max-height:100px; min-width:border:1px solid #505050; border-radius:10%;font-size:26px; font-weight:Bold;padding:5px;} QDialog#loginform QToolButton#btnlogin:hover{background:#505050;} \ No newline at end of file + /*------1.silver-->grey--------------------------*/ *{background-color:#3c3c3c; color:#fcfcfc;margin:0;font-size:16px;} QTabBar::tab { height:60px; width:300px; font-size: 25px; background:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #505050, stop: 1.0 #333333); border: 2px solid #505050; border-bottom-left-radius: 50%; border-bottom-right-radius: 50%; min-width: 8ex; padding: 2px; } QTabBar::tab:selected, QTabBar::tab:hover { border-top:5px solid #4a88c7; background: #505050;} QTabWidget::pane{margin:0} QPlainTextEdit{border:0px} QGroupBox{border:0px} QLabel{color:#fcfcfc; font-weight:bold; font-size:16px;} QLineEdit{min-height:36px;max-height:36px; border:1px solid #505050;color:grey;border-radius:3px;} QLineEdit:enabled{background-color: #505050;color:#fcfcfc;} QDateEdit{min-height:36px;max-height:36px; border:1px solid #505050;color:grey;border-radius:3px;} QDateEdit:enabled{background-color: #505050;color:#fcfcfc;} QTextEdit{ border:1px solid #505050;color:grey;border-radius:3px;} QTextEdit:enabled{background-color: #505050;color:#fcfcfc;} QComboBox{text-align:center;min-height:36px;max-height:36px; border:1px solid #505050} QComboBox:enabled{background-color: #505050} QComboBox::drop-down{width:20px} QComboBox QAbstractItemView{min-width:120px;} QComboBox QAbstractItemView::item {min-height:60px;max-height:60px; border:1px solid white;} QWidget QToolButton#showeditBtn{border-top:1px solid darkgray;border-bottom:1px solid darkgray;border-left:1px solid darkgray;border-radius: 0;border-bottom-left-radius:10px;background: #505050;font-size:20px;font-weight:normal; } QWidget QToolButton#hideeditBtn{border-top:1px solid darkgray;border-bottom:1px solid darkgray;border-left:1px solid darkgray;border-radius: 0;border-top-left-radius:10px;border-bottom-left-radius:10px;background: #505050;font-size:20px;font-weight:normal; } QWidget QToolButton{border:none;border-radius:10%;font-size:26px; font-weight:Bold;padding:5px;} QWidget QToolButton:disabled{color:#606060;} QWidget QToolButton:hover{background:#505050;} QWidget QToolButton:checked{border:5px solid darkorange;padding:0px;} QPushButton{border:1px solid #505050 ;padding-left:50px;padding-right:50px; border-radius:5px; min-height:28px; max-height:28px; background:qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #505050, stop:1 #606060);} QListView{border:none;margin:5px; font-weight:bold} QListView::item{background:#4d4d4d;min-height:30px; border:1px solid #505050; border-radius:5px} QListView::item:selected{background:#365880;font-weight:bold;color:#fcfcfc;} /*QListView::item:selected{ background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ABAFE5, stop: 1 #8588B2); border:1px solid #505050; }*/ QHeaderView::section{background-color:#595959;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;} QTableView{border:none;alternate-background-color: #595959;selection-color:#fcfcfc;selection-background-color:#0078d8} /*-----------Specific---------------*/ QLabel#sliderPickerLabel{color:grey;padding:0;background:#505050;font-weight:normal;font-size:50px;} QWidget#topbarWidget{min-height:36px;max-height:36px;} QWidget#contentWidget{border-top:1px solid #505050;} QWidget#commandWidget{min-height:123px;max-height:123px;border-top:1px solid #505050; border-bottom:1px solid #323232;} QLabel#logo{min-width:30px;max-width:30px} QLabel#company{min-width:150px;max-width:150px; } QLabel#systemMsgBar{min-width:500px;} QLabel#warn{color:#CCCC00;background:transparent;font-size:20px;} QWidget QWidget#statusBarWidget{min-width:300px;} QToolButton#btn_main{border:2px solid #0078d8;border-radius:10%;font-size:26px; font-weight:Bold;padding:5px;} QWidget#editcmdWidget{min-height:83px;max-height:83px;} QWidget#verSpaceLine{ border-right:1px solid #0078d8;} QWidget#topBottomLine{ border-top:2px solid #0078d8;border-bottom:2px solid #0078d8;background:transparent;} /*-----Settings*/ QPushButton#BigBtn{ padding-left:0px; padding-right:0px; min-height:60px; max-height:60px; min-width:140px; max-width:140px; font-size: 20px; font-weight:bold; } /*-----蒙版Dialog-----*/ QDialog QWidget#innerWidget{background:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0.0 darkgray, stop: 0.5 lightgray, stop: 1.0 darkgray);border-radius:20px;border:5px solid #0078d8; } QDialog#MessageDialog QWidget QWidget{ background:transparent;color:#3078d8;} QDialog#MessageDialog QWidget QWidget QLabel{ font-size:30px} #spacer_1, #spacer_2{min-width:2px;max-width:2px;margin-top:6px;margin-bottom:6px;border-right:1px solid #0078d8;} /*-----FormDialog-----*/ QPushButton#btnOK{background:#365880; font-weight:bold} QDialog#formDialog{border:3px solid grey; border-radius:8px} QWidget#slider_one{border:1px solid #505050; border-radius:8px} QWidget#formWidget QLabel#endline{border-bottom:1px solid grey} QWidget#formWidget{font-size:30px;} QLabel#title{font-size:30px; border-bottom:1px solid #3078d8 } QWidget#edit_patient{min-width:300px;max-width:300px;} QToolButton#sexBtn{min-width:120px;max-width:120px;font-size:20px;padding:2px;} QToolButton#sexBtn:disabled{color:grey} QWidget#sexpanelwidget{border:1px solid #505050;} QWidget#sexpanelwidget:enabled{background-color: #505050;} QToolButton#sexBtn:checked{border:2px solid darkorange;padding:0px;} /*---------Abount----------*/ QLabel#normal{color:#fcfcfc; font-weight:normal; font-size:16px;} QDialog#loginform{background-color:#3c3c3c; color:white;margin:0;font-size:16px;} QDialog#loginform QLabel#title{font-Size:98px;color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0.0 darkgray, stop: 0.5 lightgray, stop: 1.0 darkgray);} QLabel#warn{color:#930000;background:transparent;font-size:20px;} QFrame#login_frame_username{min-width:700px;max-width:700px;max-height:500px;min-height:500px; border:1px solid #0078d8;border-radius:20px; background:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0.0 darkgray, stop: 0.5 gray, stop: 1.0 darkgray);} QDialog#loginform QLineEdit{min-height:100px;max-height:100px; border:1px solid silver;border-radius:10px;font-size:26px;} QDialog#loginform QLineEdit:enabled{background-color: #515151} QDialog#loginform QToolButton#btnlogin{min-height:100px;max-height:100px; min-width:border:1px solid #505050; border-radius:10%;font-size:26px; font-weight:Bold;padding:5px;} QDialog#loginform QToolButton#btnlogin:hover{background:#505050;} \ No newline at end of file