Compare commits
12 Commits
V0.6.9
...
v0.6.10bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23065c6cc5 | ||
|
|
9bffca90ae | ||
|
|
3fecd89689 | ||
|
|
3835339758 | ||
|
|
01bcd510e6 | ||
|
|
da284a2d0b | ||
|
|
27832c6d76 | ||
|
|
96e848750c | ||
|
|
e2301c3139 | ||
|
|
04b7191702 | ||
|
|
f4fdb4d223 | ||
|
|
fb525d3cdd |
@@ -7,4 +7,5 @@
|
|||||||
#define GUI_VERSION_MAJOR @GUI_VERSION_MAJOR@
|
#define GUI_VERSION_MAJOR @GUI_VERSION_MAJOR@
|
||||||
#define GUI_VERSION_MINOR @GUI_VERSION_MINOR@
|
#define GUI_VERSION_MINOR @GUI_VERSION_MINOR@
|
||||||
#define GUI_VERSION_BUILD @GUI_VERSION_BUILD@
|
#define GUI_VERSION_BUILD @GUI_VERSION_BUILD@
|
||||||
|
#define GUI_VERSION_BETA @GUI_VERSION_BETA@
|
||||||
#endif //GUI_VERSION_H
|
#endif //GUI_VERSION_H
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|||||||
# GUI Version
|
# GUI Version
|
||||||
set(GUI_VERSION_MAJOR 0)
|
set(GUI_VERSION_MAJOR 0)
|
||||||
set(GUI_VERSION_MINOR 6)
|
set(GUI_VERSION_MINOR 6)
|
||||||
set(GUI_VERSION_BUILD 8)
|
set(GUI_VERSION_BUILD 9)
|
||||||
|
set(GUI_VERSION_BETA 1)
|
||||||
# use AppVersion.h as a configure file
|
# use AppVersion.h as a configure file
|
||||||
configure_file(
|
configure_file(
|
||||||
"AppVersion.h.in"
|
"AppVersion.h.in"
|
||||||
|
|||||||
37
src/DateSelectDialog.cpp
Normal file
37
src/DateSelectDialog.cpp
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
//
|
||||||
|
// Created by Krad on 2022/3/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "DateSelectDialog.h"
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include "components/DateSlidePickerBox.h"
|
||||||
|
#include <QDate>
|
||||||
|
DateSelectDialog::DateSelectDialog(QWidget *parent, Qt::WindowFlags f) : GUIFormBaseDialog(parent, f) {
|
||||||
|
this->setFixedSize(460, 380);
|
||||||
|
QVBoxLayout* layout = new QVBoxLayout(formWidget);
|
||||||
|
box = new DateSlidePickerBox(formWidget);
|
||||||
|
box->setObjectName("slider_one");
|
||||||
|
box->setSelectedValue("1990-01-01");
|
||||||
|
layout->addWidget(box);
|
||||||
|
}
|
||||||
|
|
||||||
|
DateSelectDialog::~DateSelectDialog() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QString DateSelectDialog::getSelectedValue() {
|
||||||
|
return box->getSelectedValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DateSelectDialog::setSelectedValue(const QString &val) {
|
||||||
|
box->setSelectedValue(val);
|
||||||
|
box->resizeLabel();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DateSelectDialog::updateReferenceData() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DateSelectDialog::showEvent(QShowEvent * event) {
|
||||||
|
QDialog::showEvent(event);
|
||||||
|
}
|
||||||
24
src/DateSelectDialog.h
Normal file
24
src/DateSelectDialog.h
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
//
|
||||||
|
// Created by Krad on 2022/3/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef GUI_DATESELECTDIALOG_H
|
||||||
|
#define GUI_DATESELECTDIALOG_H
|
||||||
|
|
||||||
|
#include "GUIFormBaseDialog.h"
|
||||||
|
class DateSlidePickerBox;
|
||||||
|
class DateSelectDialog:public GUIFormBaseDialog{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit DateSelectDialog(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
|
||||||
|
~DateSelectDialog() override;
|
||||||
|
QString getSelectedValue();
|
||||||
|
void setSelectedValue(const QString& val);
|
||||||
|
void showEvent(QShowEvent *) override;
|
||||||
|
protected:
|
||||||
|
bool updateReferenceData() override;
|
||||||
|
DateSlidePickerBox* box;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //GUI_DATESELECTDIALOG_H
|
||||||
212
src/EditPatientDialog.cpp
Normal file
212
src/EditPatientDialog.cpp
Normal file
@@ -0,0 +1,212 @@
|
|||||||
|
//
|
||||||
|
// Created by Krad on 2022/3/21.
|
||||||
|
//
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QDateTime>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QTextEdit>
|
||||||
|
#include <QToolButton>
|
||||||
|
#include <QSqlTableModel>
|
||||||
|
#include <QUuid>
|
||||||
|
#include "EditPatientDialog.h"
|
||||||
|
#include "SelectDialog.h"
|
||||||
|
#include "DateSelectDialog.h"
|
||||||
|
#include "components/Listbox.h"
|
||||||
|
|
||||||
|
int queryValue(QSqlTableModel* model, int colID, QVariant var)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < model->rowCount(); ++i) {
|
||||||
|
if (model->data(model->index(i, colID)) == var) return i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
EditPatientDialog::EditPatientDialog(QWidget *parent, Qt::WindowFlags f) : GUIFormBaseDialog(parent, f) {
|
||||||
|
QVBoxLayout* layout = new QVBoxLayout(formWidget);
|
||||||
|
layout->setSpacing(10);
|
||||||
|
// add title
|
||||||
|
QLabel* lbl_title = new QLabel(this);
|
||||||
|
lbl_title->setAlignment(Qt::AlignCenter);
|
||||||
|
lbl_title->setText(tr("Edit Patient"));
|
||||||
|
lbl_title->setObjectName("title");
|
||||||
|
layout->addWidget(lbl_title);
|
||||||
|
|
||||||
|
//add old password
|
||||||
|
QLabel* lbl_id = new QLabel(this);
|
||||||
|
lbl_id->setText(tr("ID"));
|
||||||
|
le_id = new QLineEdit(this);
|
||||||
|
layout->addWidget(lbl_id);
|
||||||
|
layout->addWidget(le_id);
|
||||||
|
QLabel* lbl_endline1 = new QLabel(this);
|
||||||
|
lbl_endline1->setObjectName("endline");
|
||||||
|
layout->addWidget(lbl_endline1);
|
||||||
|
|
||||||
|
QLabel* lbl_name= new QLabel(this);
|
||||||
|
lbl_name->setText(tr("Name"));
|
||||||
|
le_name = new QLineEdit(this);
|
||||||
|
layout->addWidget(lbl_name);
|
||||||
|
layout->addWidget(le_name);
|
||||||
|
QLabel* lbl_endline2 = new QLabel(this);
|
||||||
|
lbl_endline2->setObjectName("endline");
|
||||||
|
layout->addWidget(lbl_endline2);
|
||||||
|
|
||||||
|
QLabel* lbl_sex= new QLabel(this);
|
||||||
|
lbl_sex->setText(tr("Gender"));
|
||||||
|
layout->addWidget(lbl_sex);
|
||||||
|
btnSex = new Listbox(this);
|
||||||
|
btnSex->setText(tr("Female"));
|
||||||
|
btnSex->setProperty("idx",0);
|
||||||
|
btnSex->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||||
|
btnSex->setLayoutDirection(Qt::RightToLeft);
|
||||||
|
btnSex->setObjectName("editvalBtn");
|
||||||
|
btnSex->setIcon(QIcon(":/icons/arrow-down.png"));
|
||||||
|
btnSex->setIconSize({30, 30});
|
||||||
|
|
||||||
|
btnSex->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||||
|
connect(btnSex, &QToolButton::clicked,[=](){
|
||||||
|
SelectDialog dialog(this);
|
||||||
|
QStringList items;
|
||||||
|
items<<tr("Female")<<tr("Male")<<tr("Other");
|
||||||
|
dialog.setValues(items);
|
||||||
|
dialog.setSelectedValue(items[btnSex->property("idx").toInt()]);
|
||||||
|
dialog.setWindowModality(Qt::WindowModal);
|
||||||
|
if (dialog.exec() == QDialog::Accepted){
|
||||||
|
btnSex->setText(dialog.getSelectedValue());
|
||||||
|
btnSex->setProperty("idx",items.indexOf(dialog.getSelectedValue()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
layout->addWidget(btnSex);
|
||||||
|
QLabel *lbl_endline9 = new QLabel(this);
|
||||||
|
lbl_endline9->setFixedHeight(2);
|
||||||
|
lbl_endline9->setObjectName("endline");
|
||||||
|
layout->addWidget(lbl_endline9);
|
||||||
|
|
||||||
|
|
||||||
|
QLabel* lbl_date = new QLabel(this);
|
||||||
|
lbl_date->setText(tr("Birth Date"));
|
||||||
|
|
||||||
|
layout->addWidget(lbl_date);
|
||||||
|
btnDate = new Listbox(this);
|
||||||
|
btnDate->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||||
|
btnDate->setLayoutDirection(Qt::RightToLeft);
|
||||||
|
btnDate->setObjectName("editvalBtn");
|
||||||
|
btnDate->setIcon(QIcon(":/icons/arrow-down.png"));
|
||||||
|
btnDate->setIconSize({30, 30});
|
||||||
|
btnDate->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||||
|
btnDate->setText("1990-06-15");
|
||||||
|
connect(btnDate, &QToolButton::clicked,[=](){
|
||||||
|
DateSelectDialog dialog(this);
|
||||||
|
dialog.setSelectedValue(btnDate->text());
|
||||||
|
dialog.setWindowModality(Qt::WindowModal);
|
||||||
|
if (dialog.exec() == QDialog::Accepted){
|
||||||
|
btnDate->setText(dialog.getSelectedValue());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
layout->addWidget(btnDate);
|
||||||
|
QLabel* lbl_endline5 = new QLabel(this);
|
||||||
|
lbl_endline5->setObjectName("endline");
|
||||||
|
layout->addWidget(lbl_endline5);
|
||||||
|
|
||||||
|
QLabel* lbl_comment = new QLabel(this);
|
||||||
|
lbl_comment->setText(tr("Comment"));
|
||||||
|
te_comment = new QTextEdit(this);
|
||||||
|
layout->addWidget(lbl_comment);
|
||||||
|
layout->addWidget(te_comment);
|
||||||
|
QLabel* lbl_endline6 = new QLabel(this);
|
||||||
|
lbl_endline6->setObjectName("endline");
|
||||||
|
layout->addWidget(lbl_endline6);
|
||||||
|
|
||||||
|
lbl_error = new QLabel(this);
|
||||||
|
lbl_error->setObjectName("warn");
|
||||||
|
layout->addWidget(lbl_error);
|
||||||
|
}
|
||||||
|
|
||||||
|
EditPatientDialog::~EditPatientDialog() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditPatientDialog::setPatientInformation(PatientInformation* information) {
|
||||||
|
if (information)
|
||||||
|
{
|
||||||
|
le_id->setText(information->ID);
|
||||||
|
btnSex->setText(information->Sex == tr("F")?tr("Female"):(information->Sex == tr("M")?tr("Male"):tr("Other")));
|
||||||
|
le_name->setText(information->Name);
|
||||||
|
te_comment->setText(information->Comment);
|
||||||
|
btnDate->setText(information->BirthDate);
|
||||||
|
currentPatientUID = information->PatientUID;
|
||||||
|
AddDate = information->AddDate;
|
||||||
|
le_id->setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditPatientDialog::clearPatientInformation() {
|
||||||
|
le_id->setText("");
|
||||||
|
// le_date->setText("");
|
||||||
|
le_name->setText("");
|
||||||
|
te_comment->setText("");
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditPatientDialog::storePatientInformation() {
|
||||||
|
store.PatientUID = currentPatientUID;
|
||||||
|
// store.AddDate = AddDate;
|
||||||
|
store.ID = le_id->text();
|
||||||
|
store.BirthDate = le_date->text();
|
||||||
|
store.Name = le_name->text();
|
||||||
|
store.Sex = le_sex->text();
|
||||||
|
store.Comment = te_comment->toPlainText();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EditPatientDialog::updateReferenceData() {
|
||||||
|
PatientInformation* inf = getPatientInformation();
|
||||||
|
if (le_id->text().isEmpty()){
|
||||||
|
lbl_error->setText("ID can't be empty!");
|
||||||
|
lbl_error->setVisible(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
inf->ID = le_id->text().trimmed();
|
||||||
|
if (le_name->text().isEmpty()){
|
||||||
|
lbl_error->setText("Patient Name can't be empty!");
|
||||||
|
lbl_error->setVisible(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
inf->Name = le_name->text().trimmed();
|
||||||
|
int selectedRow = 0;
|
||||||
|
bool isAdd = currentPatientUID.isEmpty();
|
||||||
|
if (isAdd) {
|
||||||
|
int ref_rowid = queryValue(model, 1, inf->ID);
|
||||||
|
if (ref_rowid >= 0)
|
||||||
|
{
|
||||||
|
lbl_error->setText("The ID is already existed!");
|
||||||
|
lbl_error->setVisible(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
inf->PatientUID = QUuid::createUuid().toString();
|
||||||
|
inf->AddDate = QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss");
|
||||||
|
model->insertRow(0);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
inf->PatientUID = currentPatientUID;
|
||||||
|
selectedRow = queryValue(model, 1, inf->ID);
|
||||||
|
inf->AddDate = AddDate;
|
||||||
|
}
|
||||||
|
inf->Sex = btnSex->text()==tr("Female")?"F":(tr("Male")==btnSex->text()?"M":"O");
|
||||||
|
inf->BirthDate = btnDate->text();
|
||||||
|
inf->Comment = te_comment->toPlainText();
|
||||||
|
|
||||||
|
|
||||||
|
#define ADD_PATIENT_PROPERTY(val)\
|
||||||
|
model->setData(model->index(selectedRow,PatientInformationEnum:: val),inf-> val);
|
||||||
|
EDIT_PATIENT()
|
||||||
|
#undef ADD_PATIENT_PROPERTY
|
||||||
|
if (model->submitAll())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lbl_error->setText("Submit to database error!");
|
||||||
|
lbl_error->setVisible(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
53
src/EditPatientDialog.h
Normal file
53
src/EditPatientDialog.h
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
//
|
||||||
|
// Created by Krad on 2022/3/21.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef GUI_EDITPATIENTDIALOG_H
|
||||||
|
#define GUI_EDITPATIENTDIALOG_H
|
||||||
|
|
||||||
|
#include "GUIFormBaseDialog.h"
|
||||||
|
#include "editpatientform.h"
|
||||||
|
|
||||||
|
class QLineEdit;
|
||||||
|
class QTextEdit;
|
||||||
|
class QLabel;
|
||||||
|
class QToolButton;
|
||||||
|
class QSqlTableModel;
|
||||||
|
class EditPatientDialog :public GUIFormBaseDialog{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit EditPatientDialog(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
|
||||||
|
~EditPatientDialog();
|
||||||
|
|
||||||
|
void setModel(QSqlTableModel * m){
|
||||||
|
model=m;
|
||||||
|
}
|
||||||
|
|
||||||
|
PatientInformation * getPatientInformation(){
|
||||||
|
return &store;
|
||||||
|
}
|
||||||
|
void setPatientInformation(PatientInformation * information);
|
||||||
|
void clearPatientInformation();
|
||||||
|
void storePatientInformation();
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool updateReferenceData() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QLineEdit* le_id= nullptr;
|
||||||
|
QLineEdit* le_name = nullptr;
|
||||||
|
QLineEdit* le_sex = nullptr;
|
||||||
|
QLineEdit* le_date = nullptr;
|
||||||
|
QTextEdit* te_comment = nullptr;
|
||||||
|
QLabel* lbl_error = nullptr;
|
||||||
|
PatientInformation store;
|
||||||
|
QString currentPatientUID;
|
||||||
|
QString AddDate;
|
||||||
|
QToolButton* btnSex = nullptr;
|
||||||
|
QToolButton* btnDate = nullptr;
|
||||||
|
QSqlTableModel* model = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //GUI_EDITPATIENTDIALOG_H
|
||||||
@@ -24,7 +24,7 @@ bool SelectDialog::updateReferenceData() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectDialog::setAvailableDates(QStringList dates) {
|
void SelectDialog::setValues(QStringList dates) {
|
||||||
box->setItems(dates);
|
box->setItems(dates);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class SelectDialog :public GUIFormBaseDialog{
|
|||||||
public:
|
public:
|
||||||
explicit SelectDialog(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
|
explicit SelectDialog(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
|
||||||
~SelectDialog() override;
|
~SelectDialog() override;
|
||||||
void setAvailableDates(QStringList dates);
|
void setValues(QStringList values);
|
||||||
QString getSelectedValue();
|
QString getSelectedValue();
|
||||||
void setSelectedValue(const QString& val);
|
void setSelectedValue(const QString& val);
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -23,20 +23,8 @@
|
|||||||
|
|
||||||
#include <QScroller>
|
#include <QScroller>
|
||||||
|
|
||||||
#define ADD_CENTER_ITEM(row,col,text)\
|
|
||||||
item = new QTableWidgetItem(text);\
|
|
||||||
item->setTextAlignment(Qt::AlignmentFlag::AlignCenter);\
|
|
||||||
table->setItem(row,col,item);
|
|
||||||
|
|
||||||
|
|
||||||
int queryValue(QSqlTableModel* model, int colID, QVariant var)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < model->rowCount(); ++i) {
|
|
||||||
if (model->data(model->index(i, colID)) == var) return i;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
||||||
TabFormWidget(parent)
|
TabFormWidget(parent)
|
||||||
{
|
{
|
||||||
@@ -171,20 +159,31 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
|||||||
|
|
||||||
// btn add slot
|
// btn add slot
|
||||||
connect(btnAdd, &QToolButton::clicked, [=]() {
|
connect(btnAdd, &QToolButton::clicked, [=]() {
|
||||||
edit_patient->show();
|
EditPatientDialog dialog(this);
|
||||||
btnShowEdit->hide();
|
dialog.clearPatientInformation();
|
||||||
edit_patient->clearPatientInformation();
|
dialog.setWindowModality(Qt::WindowModal);
|
||||||
edit_patient->setEditEnable(true);
|
dialog.setModel(model);
|
||||||
btnSelect->setEnabled(false);
|
// accept change
|
||||||
});
|
if (dialog.exec() == QDialog::Accepted) {
|
||||||
|
table->selectRow(0);
|
||||||
|
model->selectRow(0);
|
||||||
|
}
|
||||||
|
LOG_USER_OPERATION(AddPatient);
|
||||||
|
btnSelect->setEnabled(true);
|
||||||
|
});
|
||||||
|
|
||||||
// btn edit slot
|
// btn edit slot
|
||||||
connect(btnEdit, &QToolButton::clicked, [=]() {
|
connect(btnEdit, &QToolButton::clicked, [=]() {
|
||||||
edit_patient->show();
|
EditPatientDialog dialog(this);
|
||||||
btnShowEdit->hide();
|
dialog.setPatientInformation(edit_patient->getPatientInformation());
|
||||||
table->clicked(table->currentIndex());
|
dialog.setWindowModality(Qt::WindowModal);
|
||||||
edit_patient->setEditEnable(true);
|
dialog.setModel(model);
|
||||||
btnSelect->setEnabled(false);
|
// accept change
|
||||||
|
if (dialog.exec() == QDialog::Accepted) {
|
||||||
|
table->clicked(table->currentIndex());
|
||||||
|
LOG_USER_OPERATION(AddPatient);
|
||||||
|
btnSelect->setEnabled(true);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// btn add slot
|
// btn add slot
|
||||||
@@ -198,17 +197,6 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
|||||||
int selectedRow = table->currentIndex().row();
|
int selectedRow = table->currentIndex().row();
|
||||||
bool isAdd = inf->PatientUID.isEmpty();
|
bool isAdd = inf->PatientUID.isEmpty();
|
||||||
if (isAdd) {
|
if (isAdd) {
|
||||||
int ref_rowid = queryValue(model, 1, inf->ID);
|
|
||||||
if (ref_rowid >= 0)
|
|
||||||
{
|
|
||||||
//非触屏时,如果被选中的行在选中区域外,以下代码可能会出错
|
|
||||||
//但是触屏时一般没问题
|
|
||||||
qDebug() << ref_rowid;
|
|
||||||
table->scrollTo(model->index(ref_rowid, 3));
|
|
||||||
table->selectRow(ref_rowid);
|
|
||||||
result = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
selectedRow = model->rowCount();
|
selectedRow = model->rowCount();
|
||||||
inf->PatientUID = QUuid::createUuid().toString();
|
inf->PatientUID = QUuid::createUuid().toString();
|
||||||
inf->AddDate = QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss");
|
inf->AddDate = QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#define GUI_SELECTFORMWIDGET_H
|
#define GUI_SELECTFORMWIDGET_H
|
||||||
|
|
||||||
#include "tabformwidget.h"
|
#include "tabformwidget.h"
|
||||||
|
#include "EditPatientDialog.h"
|
||||||
class EditPatientForm;
|
class EditPatientForm;
|
||||||
class SelectFormWidget: public TabFormWidget {
|
class SelectFormWidget: public TabFormWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -15,6 +16,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QString selectedPatientUID;
|
QString selectedPatientUID;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -111,6 +111,8 @@ const char* GetDeviceInfo(DeviceInfo infoType) {
|
|||||||
switch (infoType) {
|
switch (infoType) {
|
||||||
case MEAN_TEMPERATURE:
|
case MEAN_TEMPERATURE:
|
||||||
return "28";
|
return "28";
|
||||||
|
case VERSION:
|
||||||
|
return "6.6.06";
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ typedef enum {
|
|||||||
|
|
||||||
//kinds of device information
|
//kinds of device information
|
||||||
typedef enum {
|
typedef enum {
|
||||||
MEAN_TEMPERATURE
|
MEAN_TEMPERATURE,
|
||||||
|
VERSION
|
||||||
} DeviceInfo;
|
} DeviceInfo;
|
||||||
|
|
||||||
extern int InitLib(void(*)(const char *msg));
|
extern int InitLib(void(*)(const char *msg));
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ UserOperationLogForm::UserOperationLogForm(QWidget* parent) {
|
|||||||
dialog = new SelectDialog(this);
|
dialog = new SelectDialog(this);
|
||||||
dialog->setWindowModality(Qt::WindowModal);
|
dialog->setWindowModality(Qt::WindowModal);
|
||||||
}
|
}
|
||||||
dialog->setAvailableDates(dates);
|
dialog->setValues(dates);
|
||||||
if (!selectedDateStr.isEmpty()) dialog->setSelectedValue(selectedDateStr);
|
if (!selectedDateStr.isEmpty()) dialog->setSelectedValue(selectedDateStr);
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "json/cmdhelper.h"
|
#include "json/cmdhelper.h"
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include "AppVersion.h"
|
#include "AppVersion.h"
|
||||||
|
#include "device/DeviceManager.h"
|
||||||
|
|
||||||
AboutWidget::AboutWidget(QWidget* parent)
|
AboutWidget::AboutWidget(QWidget* parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
@@ -76,7 +77,7 @@ void AboutWidget::initUi()
|
|||||||
pMainLayout->addWidget(pGuiVer);
|
pMainLayout->addWidget(pGuiVer);
|
||||||
|
|
||||||
pEmbededSoftVer = new QLabel(this);
|
pEmbededSoftVer = new QLabel(this);
|
||||||
pEmbededSoftVer->setText(tr("Embedded Software V1.5"));
|
pEmbededSoftVer->setText(tr("Embedded Software V%1").arg(getEmbVersion()));
|
||||||
pEmbededSoftVer->setContentsMargins(subContentMargin, 0, 0, 0);
|
pEmbededSoftVer->setContentsMargins(subContentMargin, 0, 0, 0);
|
||||||
pMainLayout->addWidget(pEmbededSoftVer);
|
pMainLayout->addWidget(pEmbededSoftVer);
|
||||||
|
|
||||||
@@ -156,7 +157,7 @@ void AboutWidget::initUi()
|
|||||||
pBtnHelp->setText(tr("?"));
|
pBtnHelp->setText(tr("?"));
|
||||||
pCompanyCopyRight->setText(tr("Copyright © 2017-2020 Zhejiang Equilibrium Nine Medical Equipment Co., Ltd. All Rights Reversed"));
|
pCompanyCopyRight->setText(tr("Copyright © 2017-2020 Zhejiang Equilibrium Nine Medical Equipment Co., Ltd. All Rights Reversed"));
|
||||||
pGuiVer->setText(QString(tr("GUI Software V%1")).arg(getGUIVersion()));
|
pGuiVer->setText(QString(tr("GUI Software V%1")).arg(getGUIVersion()));
|
||||||
pEmbededSoftVer->setText(tr("Embedded Software V1.5"));
|
pEmbededSoftVer->setText(tr("Embedded Software V%1").arg(getEmbVersion()));
|
||||||
pReconSotfVer->setText(tr("Reconstruction Software V1.2"));
|
pReconSotfVer->setText(tr("Reconstruction Software V1.2"));
|
||||||
pFEBVer->setText(tr("FEB Information"));
|
pFEBVer->setText(tr("FEB Information"));
|
||||||
});
|
});
|
||||||
@@ -180,5 +181,13 @@ void AboutWidget::openHelpFile()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString AboutWidget::getGUIVersion() {
|
QString AboutWidget::getGUIVersion() {
|
||||||
|
|
||||||
|
if (GUI_VERSION_BETA){
|
||||||
|
return QString("%1.%2.%3 beta").arg(GUI_VERSION_MAJOR).arg(GUI_VERSION_MINOR).arg(GUI_VERSION_BUILD);
|
||||||
|
}
|
||||||
return QString("%1.%2.%3").arg(GUI_VERSION_MAJOR).arg(GUI_VERSION_MINOR).arg(GUI_VERSION_BUILD);
|
return QString("%1.%2.%3").arg(GUI_VERSION_MAJOR).arg(GUI_VERSION_MINOR).arg(GUI_VERSION_BUILD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString AboutWidget::getEmbVersion() {
|
||||||
|
return DeviceManager::Default()->getSoftwareVersion();
|
||||||
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public:
|
|||||||
~AboutWidget();
|
~AboutWidget();
|
||||||
|
|
||||||
QString getGUIVersion();
|
QString getGUIVersion();
|
||||||
|
QString getEmbVersion();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void openHelpFile();
|
void openHelpFile();
|
||||||
|
|||||||
152
src/components/DateSlidePickerBox.cpp
Normal file
152
src/components/DateSlidePickerBox.cpp
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
//
|
||||||
|
// Created by Krad on 2022/3/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "DateSlidePickerBox.h"
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QDate>
|
||||||
|
DateSlidePickerBox::DateSlidePickerBox(QWidget *parent) {
|
||||||
|
layout = new QHBoxLayout(this);
|
||||||
|
myear = new SlidePickerBox(this);
|
||||||
|
QStringList centry;
|
||||||
|
centry<<"19"<<"20";
|
||||||
|
myear->setFixedWidth(56);
|
||||||
|
myear->setItems(centry);
|
||||||
|
layout->addWidget(myear);
|
||||||
|
|
||||||
|
tyear = new SlidePickerBox(this);
|
||||||
|
QStringList m_centry;
|
||||||
|
m_centry << "0" << "1" << "2" << "3" << "4" << "5" << "6" << "7" << "8" << "9";
|
||||||
|
tyear->setItems(m_centry);
|
||||||
|
tyear->setFixedWidth(50);
|
||||||
|
layout->addWidget(tyear);
|
||||||
|
|
||||||
|
year = new SlidePickerBox(this);
|
||||||
|
year->setItems(m_centry);
|
||||||
|
year->setFixedWidth(50);
|
||||||
|
layout->addWidget(year);
|
||||||
|
|
||||||
|
QLabel* label = new QLabel(this);
|
||||||
|
label->setText("/");
|
||||||
|
// label->setFixedHeight(110);
|
||||||
|
label->setAlignment(Qt::AlignCenter);
|
||||||
|
|
||||||
|
label->setFixedWidth(50);
|
||||||
|
label->setObjectName("sliderSpliterLabel");
|
||||||
|
layout->addWidget(label);
|
||||||
|
|
||||||
|
|
||||||
|
month = new SlidePickerBox(this);
|
||||||
|
QStringList m_mouth;
|
||||||
|
m_mouth << "01" << "02" << "03" << "04" << "05" << "06" << "07" << "08" << "09"<<"10"<<"11"<<"12";
|
||||||
|
month->setItems(m_mouth);
|
||||||
|
month->setFixedWidth(56);
|
||||||
|
layout->addWidget(month);
|
||||||
|
|
||||||
|
QLabel* label2 = new QLabel(this);
|
||||||
|
label2->setText("/");
|
||||||
|
// label2->setFixedHeight(110);
|
||||||
|
label2->setAlignment(Qt::AlignCenter);
|
||||||
|
// label2->setFixedHeight(80);
|
||||||
|
label2->setFixedWidth(50);
|
||||||
|
label2->setObjectName("sliderSpliterLabel");
|
||||||
|
|
||||||
|
layout->addWidget(label2);
|
||||||
|
|
||||||
|
day = new SlidePickerBox(this);
|
||||||
|
QStringList days;
|
||||||
|
days << "01" << "02" << "03" << "04" << "05" << "06" << "07" << "08" << "09";
|
||||||
|
|
||||||
|
for (int i=10;i<=31;i++){
|
||||||
|
days<<QString("%1").arg(i);
|
||||||
|
}
|
||||||
|
day->setFixedWidth(56);
|
||||||
|
day->setItems(days);
|
||||||
|
layout->addWidget(day);
|
||||||
|
|
||||||
|
bigMonth << "01" << "03" << "05" << "07" << "08" << "10" << "12";
|
||||||
|
connect(myear,&SlidePickerBox::valueChanged,this,&DateSlidePickerBox::leapYearAndFebruaryAdjust);
|
||||||
|
connect(tyear,&SlidePickerBox::valueChanged,this,&DateSlidePickerBox::leapYearAndFebruaryAdjust);
|
||||||
|
connect(year,&SlidePickerBox::valueChanged,this,&DateSlidePickerBox::leapYearAndFebruaryAdjust);
|
||||||
|
connect(month,&SlidePickerBox::valueChanged,this,&DateSlidePickerBox::leapYearAndFebruaryAdjust);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DateSlidePickerBox::resizeLabel() {
|
||||||
|
|
||||||
|
myear->resizeLabelWidth();
|
||||||
|
tyear->resizeLabelWidth();
|
||||||
|
year->resizeLabelWidth();
|
||||||
|
month->resizeLabelWidth();
|
||||||
|
day->resizeLabelWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString DateSlidePickerBox::getSelectedValue() {
|
||||||
|
return QString("%1%2%3-%4-%5").arg(myear->getSelectedValue()).
|
||||||
|
arg(tyear->getSelectedValue()).arg(year->getSelectedValue())
|
||||||
|
.arg(month->getSelectedValue()).arg(day->getSelectedValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
void DateSlidePickerBox::setSelectedValue(const QString &val) {
|
||||||
|
myear->setSelectedValue(val.left(2));
|
||||||
|
tyear->setSelectedValue(val.left(3).right(1));
|
||||||
|
year->setSelectedValue(val.left(4).right(1));
|
||||||
|
QStringList sary = val.split('-');
|
||||||
|
month->setSelectedValue(sary[1]);
|
||||||
|
day->setSelectedValue(sary[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DateSlidePickerBox::getYear() {
|
||||||
|
return QString("%1%2%3").arg(myear->getSelectedValue()).
|
||||||
|
arg(tyear->getSelectedValue()).arg(year->getSelectedValue()).toInt();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void DateSlidePickerBox::leapYearAndFebruaryAdjust() {
|
||||||
|
QString d = day->getSelectedValue();
|
||||||
|
//闰年且二月
|
||||||
|
if (QDate::isLeapYear(getYear()) && month->getSelectedValue() == "02") {
|
||||||
|
//seq is important, must enable item firstly
|
||||||
|
day->enableItem("29");
|
||||||
|
if (d.toInt() > 29) {
|
||||||
|
day->setSelectedValue("29");
|
||||||
|
}
|
||||||
|
|
||||||
|
day->disableItem("30");
|
||||||
|
day->disableItem("31");
|
||||||
|
}
|
||||||
|
//普通年份2月或其他月份
|
||||||
|
else{
|
||||||
|
//普通年份2月
|
||||||
|
if (month->getSelectedValue() == "02") {
|
||||||
|
//seq is important, must set selected value firstly
|
||||||
|
if (d.toInt() > 28) {
|
||||||
|
day->setSelectedValue("28");
|
||||||
|
}
|
||||||
|
day->disableItem("29");
|
||||||
|
day->disableItem("30");
|
||||||
|
day->disableItem("31");
|
||||||
|
}
|
||||||
|
//其他月份
|
||||||
|
else{
|
||||||
|
|
||||||
|
day->enableItem("29");
|
||||||
|
day->enableItem("30");
|
||||||
|
if (isBigMonth()){
|
||||||
|
day->enableItem("31");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
//seq is important, must set selected value firstly
|
||||||
|
if (d == "31") {
|
||||||
|
day->setSelectedValue("30");
|
||||||
|
}
|
||||||
|
day->disableItem("31");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// day->setSelectedValue(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DateSlidePickerBox::isBigMonth() {
|
||||||
|
return bigMonth.contains(month->getSelectedValue());
|
||||||
|
}
|
||||||
34
src/components/DateSlidePickerBox.h
Normal file
34
src/components/DateSlidePickerBox.h
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
//
|
||||||
|
// Created by Krad on 2022/3/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef GUI_DATESLIDEPICKERBOX_H
|
||||||
|
#define GUI_DATESLIDEPICKERBOX_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "SlidePickerBox.h"
|
||||||
|
#include <QDate>
|
||||||
|
class QHBoxLayout;
|
||||||
|
class DateSlidePickerBox:public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit DateSlidePickerBox(QWidget *parent = nullptr);
|
||||||
|
QString getSelectedValue();
|
||||||
|
void setSelectedValue(const QString& val);
|
||||||
|
void resizeLabel();
|
||||||
|
SlidePickerBox* myear;
|
||||||
|
SlidePickerBox* tyear;
|
||||||
|
SlidePickerBox* year;
|
||||||
|
SlidePickerBox* month;
|
||||||
|
SlidePickerBox* day;
|
||||||
|
public Q_SLOTS:
|
||||||
|
void leapYearAndFebruaryAdjust();
|
||||||
|
private:
|
||||||
|
int getYear();
|
||||||
|
QStringList bigMonth;
|
||||||
|
bool isBigMonth();
|
||||||
|
QHBoxLayout* layout;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //GUI_DATESLIDEPICKERBOX_H
|
||||||
20
src/components/Listbox.cpp
Normal file
20
src/components/Listbox.cpp
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
//
|
||||||
|
// Created by Krad on 2022/3/21.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <QtWidgets/qstyleoption.h>
|
||||||
|
#include <QPaintEvent>
|
||||||
|
#include <QStylePainter>
|
||||||
|
#include "Listbox.h"
|
||||||
|
|
||||||
|
void Listbox::paintEvent(QPaintEvent *e) {
|
||||||
|
QString temp = this->text();
|
||||||
|
this->setText("");
|
||||||
|
QToolButton::paintEvent(e);
|
||||||
|
this->setText(temp);
|
||||||
|
QStylePainter p(this);
|
||||||
|
QStyleOptionToolButton opt;
|
||||||
|
initStyleOption(&opt);
|
||||||
|
|
||||||
|
p.drawText((size().width()-this->iconSize().width())/2-(this->text().length()*opt.font.pixelSize())/4,this->iconSize().height()+2,this->text());
|
||||||
|
}
|
||||||
21
src/components/Listbox.h
Normal file
21
src/components/Listbox.h
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
//
|
||||||
|
// Created by Krad on 2022/3/21.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef GUI_LISTBOX_H
|
||||||
|
#define GUI_LISTBOX_H
|
||||||
|
|
||||||
|
#include <QToolButton>
|
||||||
|
class Listbox: public QToolButton {
|
||||||
|
public:
|
||||||
|
explicit Listbox(QWidget* parent = nullptr){};
|
||||||
|
virtual ~Listbox(){};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void paintEvent(QPaintEvent* e) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //GUI_LISTBOX_H
|
||||||
@@ -19,7 +19,7 @@ SlidePickerBox::SlidePickerBox(QWidget *parent):QWidget(parent) {
|
|||||||
label->setObjectName("sliderPickerLabel");
|
label->setObjectName("sliderPickerLabel");
|
||||||
label->setFixedHeight(fontSize);
|
label->setFixedHeight(fontSize);
|
||||||
label->setFixedWidth(320);
|
label->setFixedWidth(320);
|
||||||
QPoint p = this->mapToGlobal({this->contentsMargins().left(),50-fontSize/2});
|
QPoint p = {0,50-fontSize/2};
|
||||||
label->move(p);
|
label->move(p);
|
||||||
lbls.push_back(label);
|
lbls.push_back(label);
|
||||||
QLabel* label1 = new QLabel(this);
|
QLabel* label1 = new QLabel(this);
|
||||||
@@ -29,7 +29,7 @@ SlidePickerBox::SlidePickerBox(QWidget *parent):QWidget(parent) {
|
|||||||
label1->setObjectName("sliderPickerLabel");
|
label1->setObjectName("sliderPickerLabel");
|
||||||
label1->setFixedHeight(fontSize);
|
label1->setFixedHeight(fontSize);
|
||||||
label1->setFixedWidth(320);
|
label1->setFixedWidth(320);
|
||||||
QPoint p1 = this->mapToGlobal({this->contentsMargins().left(),150-fontSize/2});
|
QPoint p1 = {0,150-fontSize/2};
|
||||||
label1->move(p1);
|
label1->move(p1);
|
||||||
lbls.push_back(label1);
|
lbls.push_back(label1);
|
||||||
QLabel* label2 = new QLabel(this);
|
QLabel* label2 = new QLabel(this);
|
||||||
@@ -39,7 +39,7 @@ SlidePickerBox::SlidePickerBox(QWidget *parent):QWidget(parent) {
|
|||||||
label2->setObjectName("sliderPickerLabel");
|
label2->setObjectName("sliderPickerLabel");
|
||||||
label2->setFixedHeight(fontSize);
|
label2->setFixedHeight(fontSize);
|
||||||
label2->setFixedWidth(320);
|
label2->setFixedWidth(320);
|
||||||
QPoint p2 = this->mapToGlobal({this->contentsMargins().left(),250-fontSize/2});
|
QPoint p2 = {0,250-fontSize/2};
|
||||||
label2->move(p2);
|
label2->move(p2);
|
||||||
lbls.push_back(label2);
|
lbls.push_back(label2);
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ SlidePickerBox::SlidePickerBox(QWidget *parent):QWidget(parent) {
|
|||||||
line1->setFixedSize(320,100);
|
line1->setFixedSize(320,100);
|
||||||
line1->setObjectName("topBottomLine");
|
line1->setObjectName("topBottomLine");
|
||||||
line1->raise();
|
line1->raise();
|
||||||
QPoint lp = this->mapToGlobal({this->contentsMargins().left(),100});
|
QPoint lp = {0,100};
|
||||||
line1->move(lp);
|
line1->move(lp);
|
||||||
|
|
||||||
selectedIndex = 1;
|
selectedIndex = 1;
|
||||||
@@ -76,11 +76,13 @@ void SlidePickerBox::mouseMoveEvent(QMouseEvent *ev) {
|
|||||||
}
|
}
|
||||||
//防止拉过头
|
//防止拉过头
|
||||||
int selectItemCenter = selectedLbl->geometry().center().y();
|
int selectItemCenter = selectedLbl->geometry().center().y();
|
||||||
if (selectedLbl == lbls.last() && selectItemCenter<=150 && offset<0) return;
|
if (selectedLbl == getEnabledLastLabel() && selectItemCenter<=150 && offset<0) return;
|
||||||
if (selectedLbl == lbls.first() && selectItemCenter>=150 && offset>0) return;
|
if (selectedLbl == getEnabledFirstLabel() && selectItemCenter>=150 && offset>0) return;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (auto item : lbls)
|
for (auto item : lbls)
|
||||||
{
|
{
|
||||||
|
if (disableItems.contains(item->text()))continue;
|
||||||
|
|
||||||
//不需要横向
|
//不需要横向
|
||||||
//int nx = item->geometry().left()+(ev->pos().x()-o_x);
|
//int nx = item->geometry().left()+(ev->pos().x()-o_x);
|
||||||
int ny = item->geometry().top() + offset;
|
int ny = item->geometry().top() + offset;
|
||||||
@@ -109,6 +111,8 @@ void SlidePickerBox::mouseReleaseEvent(QMouseEvent *ev) {
|
|||||||
isDragging = false;
|
isDragging = false;
|
||||||
adjustPositon();
|
adjustPositon();
|
||||||
QWidget::mouseReleaseEvent(ev);
|
QWidget::mouseReleaseEvent(ev);
|
||||||
|
QString v = getSelectedValue();
|
||||||
|
emit valueChanged(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlidePickerBox::adjustPositon() const {
|
void SlidePickerBox::adjustPositon() const {
|
||||||
@@ -163,7 +167,7 @@ void SlidePickerBox::setItems(QStringList itemsList) {
|
|||||||
lbl->setFixedHeight(fontSize);
|
lbl->setFixedHeight(fontSize);
|
||||||
lbl->setFixedWidth(320);
|
lbl->setFixedWidth(320);
|
||||||
lbls.push_back(lbl);
|
lbls.push_back(lbl);
|
||||||
QPoint p = this->mapToGlobal({this->contentsMargins().left(),-150});
|
QPoint p = {0,-150};
|
||||||
lbl->move(p);
|
lbl->move(p);
|
||||||
}
|
}
|
||||||
selectedIndex = lbls.count()-1;
|
selectedIndex = lbls.count()-1;
|
||||||
@@ -178,36 +182,32 @@ QString SlidePickerBox::getSelectedValue() {
|
|||||||
void SlidePickerBox::setCurrentLabel(QLabel *label) {
|
void SlidePickerBox::setCurrentLabel(QLabel *label) {
|
||||||
if (selectedLbl)hideLabel(selectedLbl);
|
if (selectedLbl)hideLabel(selectedLbl);
|
||||||
if (label) {
|
if (label) {
|
||||||
QPoint lp = this->mapToGlobal({this->contentsMargins().left(), 100});
|
QPoint lp = {0, 100};
|
||||||
label->move(lp);
|
label->move(lp);
|
||||||
label->show();
|
label->show();
|
||||||
selectedLbl = label;
|
selectedLbl = label;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlidePickerBox::setNextLabel(QLabel *label) {
|
QLabel * SlidePickerBox::getEnabledFirstLabel() {
|
||||||
if (nextLbl)hideLabel(nextLbl);
|
if (disableItems.empty()) return lbls.first();
|
||||||
if (label){
|
for(int idx = 0; idx<disableItems.size(); idx++){
|
||||||
QPoint lp = this->mapToGlobal({this->contentsMargins().left(),200});
|
if(disableItems.contains(lbls[idx]->text()))continue;
|
||||||
label->move(lp);
|
return lbls[idx];
|
||||||
label->show();
|
|
||||||
nextLbl = label;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlidePickerBox::setPrevLabel(QLabel *label) {
|
QLabel * SlidePickerBox::getEnabledLastLabel() {
|
||||||
if (prevLbl)hideLabel(prevLbl);
|
if (disableItems.empty()) return lbls.last();
|
||||||
if (label) {
|
for(int idx = lbls.size()-1; idx>=0; idx--){
|
||||||
QPoint lp = this->mapToGlobal({this->contentsMargins().left(), 0});
|
if(disableItems.contains(lbls[idx]->text()))continue;
|
||||||
label->move(lp);
|
return lbls[idx];
|
||||||
label->show();
|
|
||||||
prevLbl = label;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlidePickerBox::hideLabel(QLabel *label) {
|
void SlidePickerBox::hideLabel(QLabel *label) {
|
||||||
if (!label) return;
|
if (!label) return;
|
||||||
QPoint lp = this->mapToGlobal({this->contentsMargins().left(), -150});
|
QPoint lp = {0, -150};
|
||||||
label->move(lp);
|
label->move(lp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,11 +221,53 @@ void SlidePickerBox::setSelectedValue(const QString& val) {
|
|||||||
}
|
}
|
||||||
int first_y = -100 * (selectedIndex-1);
|
int first_y = -100 * (selectedIndex-1);
|
||||||
for (int i = 0; i < lbls.count() ; ++i) {
|
for (int i = 0; i < lbls.count() ; ++i) {
|
||||||
QPoint lp = {this->contentsMargins().left(), first_y+i*100};
|
|
||||||
|
QPoint lp = this->mapTo(this,{0, first_y+i*100});
|
||||||
lbls[i]->move(lp);
|
lbls[i]->move(lp);
|
||||||
lbls[i]->show();
|
lbls[i]->show();
|
||||||
lbls[i]->setStyleSheet("background:transparent");
|
lbls[i]->setStyleSheet("background:transparent");
|
||||||
lbls[i]->lower();
|
|
||||||
|
}
|
||||||
|
selectedLbl = lbls[selectedIndex];
|
||||||
|
lbls[selectedIndex]->setStyleSheet("color:white");
|
||||||
|
adjustPositon();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlidePickerBox::resizeLabelWidth() {
|
||||||
|
for (int i = 0; i < lbls.count() ; ++i) {
|
||||||
|
lbls[i]->setAlignment(defaultAlign);
|
||||||
|
lbls[i]->setFixedWidth(this->width()+this->contentsMargins().left()+this->contentsMargins().right());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlidePickerBox::disableItem(const QString& val) {
|
||||||
|
if (!disableItems.contains(val)){
|
||||||
|
disableItems.append(val);
|
||||||
|
rearrangeLabels();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlidePickerBox::enableItem(const QString &val) {
|
||||||
|
if (disableItems.contains(val)){
|
||||||
|
disableItems.removeOne(val);
|
||||||
|
rearrangeLabels();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SlidePickerBox::rearrangeLabels() {
|
||||||
|
int first_y = -100 * (selectedIndex-1);
|
||||||
|
int r_index = 0;
|
||||||
|
for (int i = 0; i < lbls.count() ; ++i) {
|
||||||
|
if (disableItems.contains(lbls[i]->text())){
|
||||||
|
lbls[i]->hide();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
QPoint lp = this->mapTo(this,{0, first_y+r_index*100});
|
||||||
|
r_index++;
|
||||||
|
lbls[i]->move(lp);
|
||||||
|
lbls[i]->show();
|
||||||
|
lbls[i]->setStyleSheet("background:transparent");
|
||||||
|
|
||||||
}
|
}
|
||||||
selectedLbl = lbls[selectedIndex];
|
selectedLbl = lbls[selectedIndex];
|
||||||
lbls[selectedIndex]->setStyleSheet("color:white");
|
lbls[selectedIndex]->setStyleSheet("color:white");
|
||||||
|
|||||||
@@ -13,11 +13,21 @@ public:
|
|||||||
explicit SlidePickerBox(QWidget *parent = nullptr);
|
explicit SlidePickerBox(QWidget *parent = nullptr);
|
||||||
QString getSelectedValue();
|
QString getSelectedValue();
|
||||||
void setItems(QStringList itemsList);
|
void setItems(QStringList itemsList);
|
||||||
void addItem(QString& item)
|
void addItem(QString& item) {
|
||||||
{
|
|
||||||
this->items.append(item);
|
this->items.append(item);
|
||||||
}
|
}
|
||||||
|
void disableItem(const QString& val);
|
||||||
|
void enableItem(const QString& val);
|
||||||
|
int getItemsCount(){
|
||||||
|
return items.size();
|
||||||
|
}
|
||||||
void setSelectedValue(const QString& val);
|
void setSelectedValue(const QString& val);
|
||||||
|
void resizeLabelWidth();
|
||||||
|
void setDefaultAlignment(QFlags<Qt::AlignmentFlag> align){
|
||||||
|
this->defaultAlign = align;
|
||||||
|
}
|
||||||
|
signals:
|
||||||
|
void valueChanged(QString & value);
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
bool isDragging;
|
bool isDragging;
|
||||||
@@ -33,9 +43,10 @@ protected:
|
|||||||
}
|
}
|
||||||
void setCurrentLabel(QLabel* label);
|
void setCurrentLabel(QLabel* label);
|
||||||
|
|
||||||
void setPrevLabel(QLabel* label);
|
QLabel * getEnabledLastLabel();
|
||||||
void setNextLabel(QLabel* label);
|
QLabel * getEnabledFirstLabel();
|
||||||
void hideLabel(QLabel* label);
|
void hideLabel(QLabel* label);
|
||||||
|
void rearrangeLabels();
|
||||||
private:
|
private:
|
||||||
int o_x=0,o_y=10;
|
int o_x=0,o_y=10;
|
||||||
int selectedIndex = -1;
|
int selectedIndex = -1;
|
||||||
@@ -44,7 +55,8 @@ private:
|
|||||||
QLabel* nextLbl = nullptr;
|
QLabel* nextLbl = nullptr;
|
||||||
QList<QLabel*> lbls;
|
QList<QLabel*> lbls;
|
||||||
QStringList items;
|
QStringList items;
|
||||||
|
QStringList disableItems;
|
||||||
|
QFlags<Qt::AlignmentFlag> defaultAlign= Qt::AlignCenter;
|
||||||
void adjustPositon() const;
|
void adjustPositon() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,15 @@ protected:
|
|||||||
QVariant data(const QModelIndex& index, int role) const override {
|
QVariant data(const QModelIndex& index, int role) const override {
|
||||||
if (index.column() >0 && role == Qt::TextAlignmentRole) {
|
if (index.column() >0 && role == Qt::TextAlignmentRole) {
|
||||||
return Qt::AlignCenter;
|
return Qt::AlignCenter;
|
||||||
} else {
|
}
|
||||||
|
if (index.column() >0 && role == Qt::DisplayRole){
|
||||||
|
auto val = QSqlTableModel::data(index,role).toString();
|
||||||
|
QStringList list = val.split("\n");
|
||||||
|
if (list.size()>1)
|
||||||
|
return QString("%1...").arg(list[0].left(list[0].length()<20?list[0].length():20));
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
else {
|
||||||
return QSqlTableModel::data(index,role);
|
return QSqlTableModel::data(index,role);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -310,3 +310,7 @@ void DeviceManager::close() {
|
|||||||
previewDataCaller->terminate();
|
previewDataCaller->terminate();
|
||||||
delete previewDataCaller;
|
delete previewDataCaller;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString DeviceManager::getSoftwareVersion() {
|
||||||
|
return GetDeviceInfo(VERSION);
|
||||||
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public:
|
|||||||
void setErrorOccurred(bool v){
|
void setErrorOccurred(bool v){
|
||||||
errorOccurred = v;
|
errorOccurred = v;
|
||||||
}
|
}
|
||||||
|
QString getSoftwareVersion();
|
||||||
bool getErrorOccurred(){
|
bool getErrorOccurred(){
|
||||||
return errorOccurred;
|
return errorOccurred;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ GeneralForm::GeneralForm(QWidget* parent) : QWidget(parent)
|
|||||||
dialog = new SelectDialog(this);
|
dialog = new SelectDialog(this);
|
||||||
dialog->setWindowModality(Qt::WindowModal);
|
dialog->setWindowModality(Qt::WindowModal);
|
||||||
}
|
}
|
||||||
dialog->setAvailableDates(JsonObject::Instance()->language());
|
dialog->setValues(JsonObject::Instance()->language());
|
||||||
dialog->setSelectedValue(JsonObject::Instance()->defaultLanguage());
|
dialog->setSelectedValue(JsonObject::Instance()->defaultLanguage());
|
||||||
if (dialog->exec() == QDialog::Accepted)
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -116,7 +116,7 @@ systemSettingForm::systemSettingForm(QWidget* parent) :
|
|||||||
sd_protocal = new SelectDialog(this);
|
sd_protocal = new SelectDialog(this);
|
||||||
sd_protocal->setWindowModality(Qt::WindowModal);
|
sd_protocal->setWindowModality(Qt::WindowModal);
|
||||||
}
|
}
|
||||||
sd_protocal->setAvailableDates(JsonObject::Instance()->protocals());
|
sd_protocal->setValues(JsonObject::Instance()->protocals());
|
||||||
sd_protocal->setSelectedValue(JsonObject::Instance()->defaultProtocal());
|
sd_protocal->setSelectedValue(JsonObject::Instance()->defaultProtocal());
|
||||||
if (sd_protocal->exec() == QDialog::Accepted)
|
if (sd_protocal->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
@@ -132,7 +132,7 @@ systemSettingForm::systemSettingForm(QWidget* parent) :
|
|||||||
sd_filter = new SelectDialog(this);
|
sd_filter = new SelectDialog(this);
|
||||||
sd_filter->setWindowModality(Qt::WindowModal);
|
sd_filter->setWindowModality(Qt::WindowModal);
|
||||||
}
|
}
|
||||||
sd_filter->setAvailableDates(JsonObject::Instance()->worklistFilters());
|
sd_filter->setValues(JsonObject::Instance()->worklistFilters());
|
||||||
sd_filter->setSelectedValue(JsonObject::Instance()->defaultFilter());
|
sd_filter->setSelectedValue(JsonObject::Instance()->defaultFilter());
|
||||||
if (sd_filter->exec() == QDialog::Accepted)
|
if (sd_filter->exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user