chore: 格式化ElaWidgetTools代码
This commit is contained in:
@@ -16,9 +16,7 @@
|
||||
#include <QTimer>
|
||||
#include <QVBoxLayout>
|
||||
Q_TAKEOVER_NATIVEEVENT_CPP(ElaContentDialog, d_func()->_appBar);
|
||||
ElaContentDialog::ElaContentDialog(QWidget* parent)
|
||||
: QDialog{parent}, d_ptr(new ElaContentDialogPrivate())
|
||||
{
|
||||
ElaContentDialog::ElaContentDialog(QWidget *parent) : QDialog{parent}, d_ptr(new ElaContentDialogPrivate()) {
|
||||
Q_D(ElaContentDialog);
|
||||
d->q_ptr = this;
|
||||
|
||||
@@ -76,12 +74,12 @@ ElaContentDialog::ElaContentDialog(QWidget* parent)
|
||||
d->_rightButton->setFixedHeight(38);
|
||||
d->_rightButton->setBorderRadius(6);
|
||||
|
||||
d->_centralWidget = new QWidget(this);
|
||||
QVBoxLayout* centralVLayout = new QVBoxLayout(d->_centralWidget);
|
||||
d->_centralWidget = new QWidget(this);
|
||||
QVBoxLayout *centralVLayout = new QVBoxLayout(d->_centralWidget);
|
||||
centralVLayout->setContentsMargins(15, 25, 15, 10);
|
||||
ElaText* title = new ElaText("退出", this);
|
||||
ElaText *title = new ElaText("退出", this);
|
||||
title->setTextStyle(ElaTextType::Title);
|
||||
ElaText* subTitle = new ElaText("确定要退出程序吗", this);
|
||||
ElaText *subTitle = new ElaText("确定要退出程序吗", this);
|
||||
subTitle->setTextStyle(ElaTextType::Body);
|
||||
centralVLayout->addWidget(title);
|
||||
centralVLayout->addSpacing(2);
|
||||
@@ -92,7 +90,7 @@ ElaContentDialog::ElaContentDialog(QWidget* parent)
|
||||
d->_mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
d->_buttonWidget = new QWidget(this);
|
||||
d->_buttonWidget->setFixedHeight(60);
|
||||
QHBoxLayout* buttonLayout = new QHBoxLayout(d->_buttonWidget);
|
||||
QHBoxLayout *buttonLayout = new QHBoxLayout(d->_buttonWidget);
|
||||
buttonLayout->addWidget(d->_leftButton);
|
||||
buttonLayout->addWidget(d->_middleButton);
|
||||
buttonLayout->addWidget(d->_rightButton);
|
||||
@@ -100,31 +98,21 @@ ElaContentDialog::ElaContentDialog(QWidget* parent)
|
||||
d->_mainLayout->addWidget(d->_buttonWidget);
|
||||
|
||||
d->_themeMode = eTheme->getThemeMode();
|
||||
connect(eTheme, &ElaTheme::themeModeChanged, this, [=](ElaThemeType::ThemeMode themeMode) {
|
||||
d->_themeMode = themeMode;
|
||||
});
|
||||
connect(eTheme, &ElaTheme::themeModeChanged, this, [=](ElaThemeType::ThemeMode themeMode) { d->_themeMode = themeMode; });
|
||||
}
|
||||
|
||||
ElaContentDialog::~ElaContentDialog()
|
||||
{
|
||||
ElaContentDialog::~ElaContentDialog() {
|
||||
Q_D(ElaContentDialog);
|
||||
d->_maskWidget->deleteLater();
|
||||
}
|
||||
|
||||
void ElaContentDialog::onLeftButtonClicked()
|
||||
{
|
||||
}
|
||||
void ElaContentDialog::onLeftButtonClicked() {}
|
||||
|
||||
void ElaContentDialog::onMiddleButtonClicked()
|
||||
{
|
||||
}
|
||||
void ElaContentDialog::onMiddleButtonClicked() {}
|
||||
|
||||
void ElaContentDialog::onRightButtonClicked()
|
||||
{
|
||||
}
|
||||
void ElaContentDialog::onRightButtonClicked() {}
|
||||
|
||||
void ElaContentDialog::setCentralWidget(QWidget* centralWidget)
|
||||
{
|
||||
void ElaContentDialog::setCentralWidget(QWidget *centralWidget) {
|
||||
Q_D(ElaContentDialog);
|
||||
d->_mainLayout->takeAt(0);
|
||||
d->_mainLayout->takeAt(0);
|
||||
@@ -134,32 +122,27 @@ void ElaContentDialog::setCentralWidget(QWidget* centralWidget)
|
||||
d->_mainLayout->addWidget(d->_buttonWidget);
|
||||
}
|
||||
|
||||
void ElaContentDialog::setLeftButtonText(QString text)
|
||||
{
|
||||
void ElaContentDialog::setLeftButtonText(QString text) {
|
||||
Q_D(ElaContentDialog);
|
||||
d->_leftButton->setText(text);
|
||||
}
|
||||
|
||||
void ElaContentDialog::setMiddleButtonText(QString text)
|
||||
{
|
||||
void ElaContentDialog::setMiddleButtonText(QString text) {
|
||||
Q_D(ElaContentDialog);
|
||||
d->_middleButton->setText(text);
|
||||
}
|
||||
|
||||
void ElaContentDialog::setRightButtonText(QString text)
|
||||
{
|
||||
void ElaContentDialog::setRightButtonText(QString text) {
|
||||
Q_D(ElaContentDialog);
|
||||
d->_rightButton->setText(text);
|
||||
}
|
||||
|
||||
void ElaContentDialog::close()
|
||||
{
|
||||
void ElaContentDialog::close() {
|
||||
Q_D(ElaContentDialog);
|
||||
d->_doCloseAnimation(false);
|
||||
}
|
||||
|
||||
void ElaContentDialog::showEvent(QShowEvent* event)
|
||||
{
|
||||
void ElaContentDialog::showEvent(QShowEvent *event) {
|
||||
Q_D(ElaContentDialog);
|
||||
d->_maskWidget->setVisible(true);
|
||||
d->_maskWidget->raise();
|
||||
@@ -168,8 +151,7 @@ void ElaContentDialog::showEvent(QShowEvent* event)
|
||||
QDialog::showEvent(event);
|
||||
}
|
||||
|
||||
void ElaContentDialog::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
void ElaContentDialog::paintEvent(QPaintEvent *event) {
|
||||
Q_D(ElaContentDialog);
|
||||
QPainter painter(this);
|
||||
painter.save();
|
||||
@@ -184,7 +166,4 @@ void ElaContentDialog::paintEvent(QPaintEvent* event)
|
||||
painter.restore();
|
||||
}
|
||||
|
||||
void ElaContentDialog::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
event->accept();
|
||||
}
|
||||
void ElaContentDialog::keyPressEvent(QKeyEvent *event) { event->accept(); }
|
||||
|
||||
Reference in New Issue
Block a user