Make About form slide able

This commit is contained in:
kradchen
2023-09-07 17:30:06 +08:00
parent 19a7b10659
commit 662c02bdf9
2 changed files with 32 additions and 7 deletions

View File

@@ -6,16 +6,24 @@
#include <QPushButton> #include <QPushButton>
#include <QStringList> #include <QStringList>
#include <QThread> #include <QThread>
#include <QScrollArea>
#include "event/EventCenter.h" #include "event/EventCenter.h"
#include "json/cmdhelper.h" #include "json/cmdhelper.h"
#include "AppVersion.h" #include "AppVersion.h"
#include "device/DeviceManager.h" #include "device/DeviceManager.h"
#include "recon/ReconManager.h"
#include "components/SlideWidget.h"
AboutForm::AboutForm(QWidget* aParent) AboutForm::AboutForm(QWidget* aParent)
: QWidget(aParent) : QWidget(aParent)
,mReconSotfVer( new QLabel(this))
{ {
initUiWidget(); initUiWidget();
mReconSotfVer->setSizePolicy(QSizePolicy::Policy::Expanding,QSizePolicy::Policy::Expanding);
} }
AboutForm::~AboutForm() AboutForm::~AboutForm()
@@ -23,6 +31,11 @@ AboutForm::~AboutForm()
} }
void AboutForm::setReconVersion(const QString& version)
{
mReconSotfVer->setText(version);
}
void AboutForm::initUiWidget() void AboutForm::initUiWidget()
{ {
const int subContentMargin = 10; const int subContentMargin = 10;
@@ -35,7 +48,6 @@ void AboutForm::initUiWidget()
QLabel* pCompanyCopyRight; QLabel* pCompanyCopyRight;
QLabel* pGuiVer; QLabel* pGuiVer;
QLabel* pEmbededSoftVer; QLabel* pEmbededSoftVer;
QLabel* pReconSotfVer;
QLabel* pFEBVer; QLabel* pFEBVer;
QLabel* pQtVer; QLabel* pQtVer;
QLabel* pQtCopyright; QLabel* pQtCopyright;
@@ -46,8 +58,16 @@ void AboutForm::initUiWidget()
QLabel* pSUSEVer; QLabel* pSUSEVer;
this->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); this->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
pMainLayout = new QVBoxLayout(this); QHBoxLayout * l = new QHBoxLayout(this);
QScrollArea* scrollArea = new QScrollArea(this);
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
l->addWidget(scrollArea);
SlideWidget * widget = new SlideWidget(this);
scrollArea->setWidget(widget);
scrollArea->setWidgetResizable(true);
widget->setVerticalScrollBar(scrollArea->verticalScrollBar());
pMainLayout = new QVBoxLayout(widget);
pMainLayout->setAlignment(Qt::AlignLeft); pMainLayout->setAlignment(Qt::AlignLeft);
pMainLayout->setSpacing(10); pMainLayout->setSpacing(10);
@@ -78,9 +98,9 @@ void AboutForm::initUiWidget()
pEmbededSoftVer->setText(tr("Embedded Software %1").arg(getEmbVersion())); pEmbededSoftVer->setText(tr("Embedded Software %1").arg(getEmbVersion()));
pMainLayout->addWidget(pEmbededSoftVer); pMainLayout->addWidget(pEmbededSoftVer);
pReconSotfVer = new QLabel(this);
pReconSotfVer->setText(tr("Reconstruction Software V1.2")); mReconSotfVer->setText(tr("Reconstruction Software Loading..."));
pMainLayout->addWidget(pReconSotfVer); pMainLayout->addWidget(mReconSotfVer);
pMainLayout->addSpacing(subContentSpacing); pMainLayout->addSpacing(subContentSpacing);
pFEBVer = new QLabel(this); pFEBVer = new QLabel(this);
@@ -123,6 +143,8 @@ void AboutForm::initUiWidget()
t->start(); t->start();
connect(t, SIGNAL(finished()), t, SLOT(deleteLater())); connect(t, SIGNAL(finished()), t, SLOT(deleteLater()));
QMetaObject::invokeMethod(ReconManager::getInstance(), "getReconVersion", Qt::QueuedConnection);
connect(ReconManager::getInstance(), &ReconManager::getReconVersionResponsed,this,&AboutForm::setReconVersion,Qt::QueuedConnection);
connect(pBtnHelp, SIGNAL(clicked()), this, SLOT(openHelpFile())); connect(pBtnHelp, SIGNAL(clicked()), this, SLOT(openHelpFile()));
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() { connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() {
@@ -131,7 +153,7 @@ void AboutForm::initUiWidget()
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 %1").arg(getEmbVersion())); pEmbededSoftVer->setText(tr("Embedded Software %1").arg(getEmbVersion()));
pReconSotfVer->setText(tr("Reconstruction Software V1.2")); mReconSotfVer->setText(tr("Reconstruction Software V1.2"));
pFEBVer->setText(tr("FEB Information")); pFEBVer->setText(tr("FEB Information"));
}); });
} }

View File

@@ -8,6 +8,7 @@
#include <QFileInfo> #include <QFileInfo>
#include <QCoreApplication> #include <QCoreApplication>
class QLabel;
class AboutForm : public QWidget class AboutForm : public QWidget
{ {
Q_OBJECT Q_OBJECT
@@ -21,9 +22,11 @@ public:
private slots: private slots:
void openHelpFile(); void openHelpFile();
void setReconVersion(const QString& version);
private: private:
void initUiWidget(); void initUiWidget();
QLabel* mReconSotfVer;
}; };