From 662c02bdf9a284a9ae2217a46ed6a6554a6a735d Mon Sep 17 00:00:00 2001 From: kradchen Date: Thu, 7 Sep 2023 17:30:06 +0800 Subject: [PATCH] Make About form slide able --- src/forms/settings/AboutForm.cpp | 36 +++++++++++++++++++++++++------- src/forms/settings/AboutForm.h | 3 +++ 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/forms/settings/AboutForm.cpp b/src/forms/settings/AboutForm.cpp index 9f2ddbc..bf1650b 100644 --- a/src/forms/settings/AboutForm.cpp +++ b/src/forms/settings/AboutForm.cpp @@ -6,16 +6,24 @@ #include #include #include +#include + #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")); }); } diff --git a/src/forms/settings/AboutForm.h b/src/forms/settings/AboutForm.h index ae28f84..9775e12 100644 --- a/src/forms/settings/AboutForm.h +++ b/src/forms/settings/AboutForm.h @@ -8,6 +8,7 @@ #include #include +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; };