From 555c2ccc0ff5732abf8e04358861ee651eb10c1a Mon Sep 17 00:00:00 2001 From: houchengqiu Date: Mon, 18 Nov 2024 16:45:44 +0800 Subject: [PATCH] fix: adjust cut attribute confirm button style and layout (for circle 4) adjust cut attribute confirm button style and layout (for circle 4) Log: adjust cut attribute confirm button style and layout (for circle 4) Bug: https://pms.uniontech.com/bug-view-155955.html --- .../stylewidgets/cutattributionwidget.cpp | 14 ++++++++------ .../stylewidgets/cutattributionwidget.h | 7 +++++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/deepin-draw/attribution/stylewidgets/cutattributionwidget.cpp b/src/deepin-draw/attribution/stylewidgets/cutattributionwidget.cpp index 8c2956f59..e006b169e 100644 --- a/src/deepin-draw/attribution/stylewidgets/cutattributionwidget.cpp +++ b/src/deepin-draw/attribution/stylewidgets/cutattributionwidget.cpp @@ -30,6 +30,7 @@ void CutAttributionWidget::initUi() QLabel *title = new QLabel(tr("Ratio")); QLabel *scale_w = new QLabel(); scale_w->setText("W"); + scale_w->setAlignment(Qt::AlignRight | Qt::AlignVCenter); w_spinbox = new CSpinBox(); w_spinbox->setEnabledEmbedStyle(true); w_spinbox->setSpinRange(10, 10000); @@ -38,6 +39,7 @@ void CutAttributionWidget::initUi() QLabel *scale_h = new QLabel(); scale_h->setText("H"); + scale_h->setAlignment(Qt::AlignRight | Qt::AlignVCenter); h_spinbox = new CSpinBox(); h_spinbox->setEnabledEmbedStyle(true); h_spinbox->setSpinRange(10, 10000); @@ -46,10 +48,9 @@ void CutAttributionWidget::initUi() mainlayout->addWidget(title); m_scaleStyle->addWidget(scale_w); - m_scaleStyle->addSpacing(BUTTON_SPACING); m_scaleStyle->addWidget(w_spinbox); + m_scaleStyle->addSpacing(10); m_scaleStyle->addWidget(scale_h); - m_scaleStyle->addSpacing(BUTTON_SPACING); m_scaleStyle->addWidget(h_spinbox); QGridLayout *m_gridLayout = new QGridLayout(); @@ -74,14 +75,15 @@ void CutAttributionWidget::initUi() m_gridLayout->addWidget(button_type, i / MAXROWNUM, i % MAXROWNUM); } //确认/取消按钮 - m_confirmbutton = new QToolButton(this); - m_cancelbutton = new QToolButton(this); + m_confirmbutton = new DSuggestButton(this); + m_cancelbutton = new DPushButton(this); QHBoxLayout *m_buttonlayout = new QHBoxLayout(this); + m_buttonlayout->setSpacing(10); m_cancelbutton->setText(tr("Cancel")); m_confirmbutton->setText(tr("Confirm")); - m_confirmbutton->setFixedSize(QSize(110, 38)); - m_cancelbutton->setFixedSize(QSize(110, 38)); + m_confirmbutton->setFixedWidth(120); + m_cancelbutton->setFixedWidth(120); m_buttonlayout->addWidget(m_cancelbutton); m_buttonlayout->addWidget(m_confirmbutton); diff --git a/src/deepin-draw/attribution/stylewidgets/cutattributionwidget.h b/src/deepin-draw/attribution/stylewidgets/cutattributionwidget.h index 903102c60..ca90acb10 100644 --- a/src/deepin-draw/attribution/stylewidgets/cutattributionwidget.h +++ b/src/deepin-draw/attribution/stylewidgets/cutattributionwidget.h @@ -7,6 +7,9 @@ #include #include "iattributionregister.h" #include +#include +#include + #define CUTTYPE 6 #define MAXROWNUM 3 class QLabel; @@ -28,8 +31,8 @@ class CutAttributionWidget: public AttributeWgt QList m_buttonList; CSpinBox *h_spinbox = nullptr; CSpinBox *w_spinbox = nullptr; - QToolButton *m_confirmbutton = nullptr; - QToolButton *m_cancelbutton = nullptr; + DSuggestButton *m_confirmbutton = nullptr; + Dtk::Widget::DPushButton *m_cancelbutton = nullptr; QButtonGroup *button_group = nullptr; const qreal Radio[CUTTYPE] {-1, -2, 1.0, 2.0 / 3.0, 8.0 / 5.0, 16.0 / 9.0};