feat: 做按钮的三态
Description: 做按钮的三态 ,使用dtoolbutton就可以 Log: 做按钮的三态 ,使用dtoolbutton就可以 Change-Id: I5f24d50e7d173a6f0bea1d82e4e771e215530783
This commit is contained in:
parent
dabea64329
commit
53be5d7f64
|
@ -17,6 +17,7 @@
|
||||||
#include <DMainWindow>
|
#include <DMainWindow>
|
||||||
#include <DTitlebar>
|
#include <DTitlebar>
|
||||||
#include <DMessageManager>
|
#include <DMessageManager>
|
||||||
|
#include <DToolButton>
|
||||||
|
|
||||||
#define App (static_cast<QApplication*>(QCoreApplication::instance()))
|
#define App (static_cast<QApplication*>(QCoreApplication::instance()))
|
||||||
MainWidget::MainWidget(QWidget *parent) :
|
MainWidget::MainWidget(QWidget *parent) :
|
||||||
|
@ -155,15 +156,17 @@ void MainWidget::setupUi(QWidget *Widget)
|
||||||
QSpacerItem *horizontalSpacer = new QSpacerItem(159, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
QSpacerItem *horizontalSpacer = new QSpacerItem(159, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||||
m_buttonHorizontalLayout->addItem(horizontalSpacer);
|
m_buttonHorizontalLayout->addItem(horizontalSpacer);
|
||||||
|
|
||||||
m_copyBtn = new DIconButton(Widget);
|
m_copyBtn = new DToolButton(Widget);
|
||||||
m_copyBtn->setObjectName(QStringLiteral("Copy"));
|
m_copyBtn->setObjectName(QStringLiteral("Copy text"));
|
||||||
m_copyBtn->setMaximumSize(QSize(40, 40));
|
m_copyBtn->setMaximumSize(QSize(40, 40));
|
||||||
|
m_copyBtn->setToolTip(tr("Copy text"));
|
||||||
|
|
||||||
m_buttonHorizontalLayout->addWidget(m_copyBtn);
|
m_buttonHorizontalLayout->addWidget(m_copyBtn);
|
||||||
|
|
||||||
m_exportBtn = new DIconButton(Widget);
|
m_exportBtn = new DToolButton(Widget);
|
||||||
m_exportBtn->setObjectName(QStringLiteral("Export"));
|
m_exportBtn->setObjectName(QStringLiteral("Save as TXT"));
|
||||||
m_exportBtn->setMaximumSize(QSize(40, 40));
|
m_exportBtn->setMaximumSize(QSize(40, 40));
|
||||||
|
m_exportBtn->setToolTip(tr("Save as TXT"));
|
||||||
|
|
||||||
m_buttonHorizontalLayout->addWidget(m_exportBtn);
|
m_buttonHorizontalLayout->addWidget(m_exportBtn);
|
||||||
|
|
||||||
|
@ -382,12 +385,10 @@ void MainWidget::setIcons(DGuiApplicationHelper::ColorType themeType)
|
||||||
if (m_copyBtn) {
|
if (m_copyBtn) {
|
||||||
m_copyBtn->setIcon(QIcon(":/assets/copy_dark.svg"));
|
m_copyBtn->setIcon(QIcon(":/assets/copy_dark.svg"));
|
||||||
m_copyBtn->setIconSize(QSize(36, 36));
|
m_copyBtn->setIconSize(QSize(36, 36));
|
||||||
m_copyBtn->setFlat(true);
|
|
||||||
}
|
}
|
||||||
if (m_exportBtn) {
|
if (m_exportBtn) {
|
||||||
m_exportBtn->setIcon(QIcon(":/assets/download_dark.svg"));
|
m_exportBtn->setIcon(QIcon(":/assets/download_dark.svg"));
|
||||||
m_exportBtn->setIconSize(QSize(36, 36));
|
m_exportBtn->setIconSize(QSize(36, 36));
|
||||||
m_exportBtn->setFlat(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
App->setWindowIcon(QIcon(":/assets/appicon_dark.svg"));
|
App->setWindowIcon(QIcon(":/assets/appicon_dark.svg"));
|
||||||
|
@ -407,12 +408,10 @@ void MainWidget::setIcons(DGuiApplicationHelper::ColorType themeType)
|
||||||
if (m_copyBtn) {
|
if (m_copyBtn) {
|
||||||
m_copyBtn->setIcon(QIcon(":/assets/copy_light.svg"));
|
m_copyBtn->setIcon(QIcon(":/assets/copy_light.svg"));
|
||||||
m_copyBtn->setIconSize(QSize(36, 36));
|
m_copyBtn->setIconSize(QSize(36, 36));
|
||||||
m_copyBtn->setFlat(true);
|
|
||||||
}
|
}
|
||||||
if (m_exportBtn) {
|
if (m_exportBtn) {
|
||||||
m_exportBtn->setIcon(QIcon(":/assets/download_light.svg"));
|
m_exportBtn->setIcon(QIcon(":/assets/download_light.svg"));
|
||||||
m_exportBtn->setIconSize(QSize(36, 36));
|
m_exportBtn->setIconSize(QSize(36, 36));
|
||||||
m_exportBtn->setFlat(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
App->setWindowIcon(QIcon(":/assets/appicon_light.svg"));
|
App->setWindowIcon(QIcon(":/assets/appicon_light.svg"));
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
|
#include <DToolButton>
|
||||||
|
|
||||||
#include "resulttextview.h"
|
#include "resulttextview.h"
|
||||||
#include "textloadwidget.h"
|
#include "textloadwidget.h"
|
||||||
|
@ -19,6 +20,7 @@ class QGridLayout;
|
||||||
class QHBoxLayout;
|
class QHBoxLayout;
|
||||||
class ImageView;
|
class ImageView;
|
||||||
|
|
||||||
|
|
||||||
DWIDGET_USE_NAMESPACE
|
DWIDGET_USE_NAMESPACE
|
||||||
|
|
||||||
class MainWidget : public DWidget
|
class MainWidget : public DWidget
|
||||||
|
@ -61,8 +63,8 @@ private:
|
||||||
QHBoxLayout *m_buttonHorizontalLayout{nullptr};
|
QHBoxLayout *m_buttonHorizontalLayout{nullptr};
|
||||||
QHBoxLayout *m_tipHorizontalLayout{nullptr};
|
QHBoxLayout *m_tipHorizontalLayout{nullptr};
|
||||||
DLabel *m_tiplabel{nullptr};
|
DLabel *m_tiplabel{nullptr};
|
||||||
DIconButton *m_copyBtn{nullptr};
|
DToolButton *m_copyBtn{nullptr};
|
||||||
DIconButton *m_exportBtn{nullptr};
|
DToolButton *m_exportBtn{nullptr};
|
||||||
ImageView *m_imageview{nullptr};
|
ImageView *m_imageview{nullptr};
|
||||||
DLabel *m_tipIconLabel{nullptr};
|
DLabel *m_tipIconLabel{nullptr};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user