From 35b8b4aeda175a33208a4a027f1636d2a806ca52 Mon Sep 17 00:00:00 2001 From: Firefly-29710 <2235501805@qq.com> Date: Sat, 6 Jul 2024 16:09:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BA=86DirCard=E7=B1=BB?= =?UTF-8?q?=E7=9A=84=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- thirdParty/ElaWidgetTools/DirCard.cpp | 90 +++++++++++---------- thirdParty/ElaWidgetTools/include/DirCard.h | 9 ++- 2 files changed, 52 insertions(+), 47 deletions(-) diff --git a/thirdParty/ElaWidgetTools/DirCard.cpp b/thirdParty/ElaWidgetTools/DirCard.cpp index 681f9f6..4f823d7 100644 --- a/thirdParty/ElaWidgetTools/DirCard.cpp +++ b/thirdParty/ElaWidgetTools/DirCard.cpp @@ -7,56 +7,60 @@ #include"ElaCheckBox.h" #include "private/DirCardPrivate.h" -#include"ElaText.h" #include"ElaPushButton.h" #include"ElaToggleButton.h" -DirCard::DirCard(QString filename, QString datasize,QString bingtime) +DirCard::DirCard(QString f, QString d,QString b) { - //ElaScrollPageArea*DirCardArea=new ElaScrollPageArea(this); this->setMaximumHeight(25); - int DirCardWidth=this->width(); - QHBoxLayout*DirCardLayout=new QHBoxLayout(this); - - _checkBox = new ElaCheckBox(filename, this); - _checkBox->setFont(QFont("",10)); - - ElaText* dataSize = new ElaText(datasize, this); + filename=new ElaText(f); + datasize=new ElaText(d); + bindtime=new ElaText(b); + QFont font("宋体",10); + font.setBold(true); + + _checkBox = new ElaCheckBox(filename->text(), this); + _checkBox->setFont(font); + QVBoxLayout*checkBoxArea=new QVBoxLayout(); + checkBoxArea->addWidget(_checkBox,0,Qt::AlignCenter); + + datasize->setTextSize(12); + datasize->setFont(font); + QVBoxLayout*dataSizeArea=new QVBoxLayout(); + dataSizeArea->addWidget(datasize,0,Qt::AlignCenter); + + bindtime->setTextSize(12); + bindtime->setFont(font); + QVBoxLayout*bindTimeArea=new QVBoxLayout(); ElaText*text=new ElaText("绑定于",this); - ElaText*bindTime=new ElaText(bingtime,this); - - dataSize->setTextSize(10); - text->setTextSize(10); - bindTime->setTextSize(10); - - DirCardLayout->addWidget(_checkBox); - - int index1=DirCardLayout->count(); - DirCardLayout->insertSpacing(index1,DirCardWidth/6); - - DirCardLayout->addWidget(dataSize); - - int index2=DirCardLayout->count(); - DirCardLayout->insertSpacing(index2,DirCardWidth/4*3); - - DirCardLayout->addWidget(text); - DirCardLayout->addWidget(bindTime); - - int index3=DirCardLayout->count(); - DirCardLayout->insertSpacing(index3,DirCardWidth/5); - - ElaToggleButton*pause=new ElaToggleButton("暂时停止"); - pause->setFixedSize(70,25); - pause->setFont(QFont("",10)); - - ElaPushButton*relieve=new ElaPushButton("解除绑定"); - relieve->setFixedSize(70,25); - relieve->setFont(QFont("",10)); - - DirCardLayout->addWidget(pause); - DirCardLayout->addWidget(relieve); - DirCardLayout->addStretch(); + text->setTextSize(12); + text->setFont(font); + bindTimeArea->addWidget(text,0,Qt::AlignCenter); + bindTimeArea->setSpacing(0); + bindTimeArea->addWidget(bindtime,0,Qt::AlignCenter); + + QVBoxLayout*pauseArea=new QVBoxLayout(); + ElaToggleButton*pauseBtn=new ElaToggleButton("暂时停止"); + pauseBtn->setFixedSize(70,25); + pauseBtn->setFont(font); + pauseArea->addWidget(pauseBtn,0,Qt::AlignCenter); + + QVBoxLayout*relieveArea=new QVBoxLayout(); + ElaPushButton*relieveBtn=new ElaPushButton("解除绑定"); + relieveBtn->setFixedSize(70,25); + relieveBtn->setFont(font); + relieveArea->addWidget(relieveBtn,0,Qt::AlignCenter); + + QHBoxLayout*prArea=new QHBoxLayout(); + prArea->addLayout(pauseArea,Qt::AlignCenter); + prArea->addLayout(relieveArea,Qt::AlignCenter); + + QHBoxLayout*DirCardArea=new QHBoxLayout(this); + DirCardArea->addLayout(checkBoxArea,Qt::AlignCenter); + DirCardArea->addLayout(dataSizeArea,Qt::AlignCenter); + DirCardArea->addLayout(bindTimeArea,Qt::AlignCenter); + DirCardArea->addLayout(prArea,Qt::AlignCenter); } DirCard::~DirCard() {} diff --git a/thirdParty/ElaWidgetTools/include/DirCard.h b/thirdParty/ElaWidgetTools/include/DirCard.h index d2b12f7..d88594a 100644 --- a/thirdParty/ElaWidgetTools/include/DirCard.h +++ b/thirdParty/ElaWidgetTools/include/DirCard.h @@ -3,6 +3,7 @@ #include #include"ElaScrollPageArea.h" +#include"ElaText.h" #include "stdafx.h" class ElaCheckBox; @@ -10,13 +11,13 @@ class DirCardPrivate; class ELA_EXPORT DirCard : public ElaScrollPageArea { public: - explicit DirCard(QString filename,QString datasize,QString bingtime); + explicit DirCard(QString f, QString d,QString b); ~DirCard(); private: ElaCheckBox* _checkBox{nullptr}; - QString filename; - QString datasize; - QString bingtime; + ElaText *filename; + ElaText *datasize; + ElaText *bindtime; }; #endif // ELAREMINDERCARD_H