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 <QStringList>
#include <QThread>
#include <QScrollArea>
#include "event/EventCenter.h"
#include "json/cmdhelper.h"
#include "AppVersion.h"
#include "device/DeviceManager.h"
#include "recon/ReconManager.h"
#include "components/SlideWidget.h"
AboutForm::AboutForm(QWidget* aParent)
: QWidget(aParent)
,mReconSotfVer( new QLabel(this))
{
initUiWidget();
mReconSotfVer->setSizePolicy(QSizePolicy::Policy::Expanding,QSizePolicy::Policy::Expanding);
}
AboutForm::~AboutForm()
@@ -23,6 +31,11 @@ AboutForm::~AboutForm()
}
void AboutForm::setReconVersion(const QString& version)
{
mReconSotfVer->setText(version);
}
void AboutForm::initUiWidget()
{
const int subContentMargin = 10;
@@ -35,7 +48,6 @@ void AboutForm::initUiWidget()
QLabel* pCompanyCopyRight;
QLabel* pGuiVer;
QLabel* pEmbededSoftVer;
QLabel* pReconSotfVer;
QLabel* pFEBVer;
QLabel* pQtVer;
QLabel* pQtCopyright;
@@ -46,8 +58,16 @@ void AboutForm::initUiWidget()
QLabel* pSUSEVer;
this->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
pMainLayout = new QVBoxLayout(this);
this->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
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->setSpacing(10);
@@ -78,9 +98,9 @@ void AboutForm::initUiWidget()
pEmbededSoftVer->setText(tr("Embedded Software %1").arg(getEmbVersion()));
pMainLayout->addWidget(pEmbededSoftVer);
pReconSotfVer = new QLabel(this);
pReconSotfVer->setText(tr("Reconstruction Software V1.2"));
pMainLayout->addWidget(pReconSotfVer);
mReconSotfVer->setText(tr("Reconstruction Software Loading..."));
pMainLayout->addWidget(mReconSotfVer);
pMainLayout->addSpacing(subContentSpacing);
pFEBVer = new QLabel(this);
@@ -123,6 +143,8 @@ void AboutForm::initUiWidget()
t->start();
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(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"));
pGuiVer->setText(QString(tr("GUI Software V%1")).arg(getGUIVersion()));
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"));
});
}

View File

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