diff --git a/include/DWidget/DBounceAnimation b/include/DWidget/DBounceAnimation new file mode 100644 index 00000000..b088a733 --- /dev/null +++ b/include/DWidget/DBounceAnimation @@ -0,0 +1 @@ +#include "dbounceanimation.h" diff --git a/include/widgets/dbounceanimation.h b/include/widgets/dbounceanimation.h new file mode 100644 index 00000000..b5ff98fa --- /dev/null +++ b/include/widgets/dbounceanimation.h @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later +#ifndef DBOUNCEANIMATION_H +#define DBOUNCEANIMATION_H + +#include +#include + +class QPropertyAnimation; +class QAbstractScrollArea; +class DBounceAnimationPrivate; +class DBounceAnimation : public QObject, public DTK_CORE_NAMESPACE::DObject +{ + Q_OBJECT +public: + explicit DBounceAnimation(QObject *parent = nullptr); + + void setAnimationTarget(QAbstractScrollArea *w); + void setAniMationEnable(bool enable); + +protected: + bool eventFilter(QObject *o, QEvent *e) override; + void bounceBack(Qt::Orientation orientation); + +private: + D_DECLARE_PRIVATE(DBounceAnimation) + +}; + +#endif // DBOUNCEANIMATION_H diff --git a/include/widgets/dtoolbutton.h b/include/widgets/dtoolbutton.h index 95d4feb5..61982ea0 100644 --- a/include/widgets/dtoolbutton.h +++ b/include/widgets/dtoolbutton.h @@ -5,23 +5,34 @@ #ifndef DTOOLBUTTON_H #define DTOOLBUTTON_H -#include #include +#include + +#include +#include + DWIDGET_BEGIN_NAMESPACE +DGUI_USE_NAMESPACE -class LIBDTKWIDGETSHARED_EXPORT DToolButton : public QToolButton +class DToolButtonPrivate; +class LIBDTKWIDGETSHARED_EXPORT DToolButton : public QToolButton, public DCORE_NAMESPACE::DObject { Q_OBJECT public: DToolButton(QWidget *parent = nullptr); void setAlignment(Qt::Alignment flag); Qt::Alignment alignment() const; + void setDciIcon(const DDciIcon &dciIcon); protected: void paintEvent(QPaintEvent *event) override; void initStyleOption(QStyleOptionToolButton *option) const; QSize sizeHint() const override; + bool event(QEvent *e) override; + +private: + D_DECLARE_PRIVATE(DToolButton) }; DWIDGET_END_NAMESPACE diff --git a/src/widgets/assets/icons/bloom/checkbox_checked.dci b/src/widgets/assets/icons/bloom/checkbox_checked.dci new file mode 100644 index 00000000..de394945 Binary files /dev/null and b/src/widgets/assets/icons/bloom/checkbox_checked.dci differ diff --git a/src/widgets/assets/icons/bloom/checkbox_unchecked.dci b/src/widgets/assets/icons/bloom/checkbox_unchecked.dci new file mode 100644 index 00000000..413e4145 Binary files /dev/null and b/src/widgets/assets/icons/bloom/checkbox_unchecked.dci differ diff --git a/src/widgets/assets/icons/bloom/radio_checked.dci b/src/widgets/assets/icons/bloom/radio_checked.dci new file mode 100644 index 00000000..69df89f3 Binary files /dev/null and b/src/widgets/assets/icons/bloom/radio_checked.dci differ diff --git a/src/widgets/assets/icons/bloom/radio_unchecked.dci b/src/widgets/assets/icons/bloom/radio_unchecked.dci new file mode 100644 index 00000000..792ce8ec Binary files /dev/null and b/src/widgets/assets/icons/bloom/radio_unchecked.dci differ diff --git a/src/widgets/assets/icons/bloom/switch_off.dci b/src/widgets/assets/icons/bloom/switch_off.dci index 957f499a..a02a0ed1 100644 Binary files a/src/widgets/assets/icons/bloom/switch_off.dci and b/src/widgets/assets/icons/bloom/switch_off.dci differ diff --git a/src/widgets/assets/icons/bloom/switch_on.dci b/src/widgets/assets/icons/bloom/switch_on.dci index 20ec32c8..a0cc2653 100644 Binary files a/src/widgets/assets/icons/bloom/switch_on.dci and b/src/widgets/assets/icons/bloom/switch_on.dci differ diff --git a/src/widgets/assets/icons/dtk-icon-theme.qrc b/src/widgets/assets/icons/dtk-icon-theme.qrc index 6d792447..9a47c616 100644 --- a/src/widgets/assets/icons/dtk-icon-theme.qrc +++ b/src/widgets/assets/icons/dtk-icon-theme.qrc @@ -74,5 +74,9 @@ bloom/window_normal.dci bloom/switch_on.dci bloom/switch_off.dci + bloom/radio_checked.dci + bloom/radio_unchecked.dci + bloom/checkbox_checked.dci + bloom/checkbox_unchecked.dci diff --git a/src/widgets/dbounceanimation.cpp b/src/widgets/dbounceanimation.cpp new file mode 100644 index 00000000..496d602f --- /dev/null +++ b/src/widgets/dbounceanimation.cpp @@ -0,0 +1,107 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later +#include "private/dbounceanimation_p.h" +#include +#include +#include +#include +#include +#include +#include + +DBounceAnimationPrivate::DBounceAnimationPrivate(DBounceAnimation *qq) + : DObjectPrivate (qq) + , m_animation(nullptr) + , m_animationTarget(nullptr) + , m_deltaSum(0) +{ +} + +DBounceAnimation::DBounceAnimation(QObject *parent) + : QObject(parent) + , DObject(*new DBounceAnimationPrivate(this)) +{ +} + +void DBounceAnimation::setAnimationTarget(QAbstractScrollArea *w) +{ + D_D(DBounceAnimation); + if (!w) + return; + + if (d->m_animationTarget == w) + return; + + d->m_animationTarget = w; +} + +void DBounceAnimation::setAniMationEnable(bool enable) +{ + D_D(DBounceAnimation); + enable ? d->m_animationTarget->installEventFilter(this) + : d->m_animationTarget->removeEventFilter(this); +} + +bool DBounceAnimation::eventFilter(QObject *o, QEvent *e) +{ + D_D(DBounceAnimation); + if (e->type() == QEvent::Wheel) { + if (auto absscroll = dynamic_cast(o)) { + if (auto wheelEvent = dynamic_cast(e)) { + if (absscroll->verticalScrollBar()->value() <= 0 || absscroll->verticalScrollBar()->value() >= absscroll->verticalScrollBar()->maximum()) { + d->m_deltaSum += wheelEvent->pixelDelta().x() != 0 ? wheelEvent->pixelDelta().x() : wheelEvent->pixelDelta().y(); + bounceBack(wheelEvent->angleDelta().x() == 0 ? Qt::Vertical : Qt::Horizontal); + } + } + } + } + + return false; +} + +void DBounceAnimation::bounceBack(Qt::Orientation orientation) +{ + D_D(DBounceAnimation); + if (d->m_animation) + return; + + if (orientation & Qt::Vertical && d->m_animationTarget->verticalScrollBar()->maximum() == d->m_animationTarget->verticalScrollBar()->minimum()) + return; + + if (orientation & Qt::Horizontal && d->m_animationTarget->horizontalScrollBar()->maximum() == d->m_animationTarget->horizontalScrollBar()->minimum()) + return; + + d->m_animation = new QPropertyAnimation(this); + d->m_animation->setTargetObject(d->m_animationTarget->viewport()); + d->m_animation->setPropertyName("pos"); + d->m_animation->setDuration(100); + d->m_animation->setEasingCurve(QEasingCurve::InQuart); + d->m_animation->setStartValue(QPoint(d->m_animationTarget->viewport()->x(), d->m_animationTarget->viewport()->y())); + + QTimer::singleShot(100, this, [this, d, orientation]() { + + if (orientation & Qt::Vertical) { + d->m_animation->setEndValue( + QPoint(d->m_animationTarget->viewport()->x(), d->m_animationTarget->viewport()->y() + d->m_deltaSum / 16)); + } else { + d->m_animation->setEndValue( + QPoint(d->m_animationTarget->viewport()->x() + d->m_deltaSum / 16, d->m_animationTarget->viewport()->y())); + } + + d->m_animation->start(); + + connect(d->m_animation, &QPropertyAnimation::finished, this, [d]() { + if (d->m_animation->direction() == QPropertyAnimation::Backward) { + delete d->m_animation; + d->m_animation = nullptr; + return; + } + + d->m_animation->setDirection(QPropertyAnimation::Direction::Backward); + d->m_animation->setDuration(1000); + d->m_animation->start(QPropertyAnimation::DeleteWhenStopped); + d->m_deltaSum = 0; + }); + }); +} diff --git a/src/widgets/dindeterminateprogressbar.cpp b/src/widgets/dindeterminateprogressbar.cpp index bb071314..e0d04d4d 100644 --- a/src/widgets/dindeterminateprogressbar.cpp +++ b/src/widgets/dindeterminateprogressbar.cpp @@ -5,6 +5,7 @@ #include "private/dindeterminateprogressbar_p.h" #include +#include #include #include @@ -12,6 +13,8 @@ #include #include +DGUI_USE_NAMESPACE + const int SPOT_WIDGET_WIDTH = 200; DIndeterminateProgressbarPrivate::DIndeterminateProgressbarPrivate(DIndeterminateProgressbar *qq) @@ -48,6 +51,7 @@ DIndeterminateProgressbar::DIndeterminateProgressbar(QWidget *parent) d->m_leftToRight ? step += 2 : step -= 2; d->m_sliderWidget->move(step, 0); + update(); }); d->m_timer->start(); } @@ -81,26 +85,31 @@ void DIndeterminateProgressbar::paintEvent(QPaintEvent *e) ? radius = height() / 2 : radius = DTK_WIDGET_NAMESPACE::DStyle::pixelMetric(style(), DTK_WIDGET_NAMESPACE::DStyle::PM_FrameRadius); - p.setBrush(QColor(0, 0, 0, int(0.1 * 255))); + bool isDarkType = DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::DarkType; + QColor color = isDarkType ? QColor(255, 255, 255, int(0.1 * 255)) : QColor(0, 0, 0, int(0.1 * 255)); + p.setBrush(color); p.setPen(Qt::NoPen); p.drawRoundedRect(rect(), radius, radius); QPen pen; pen.setWidth(1); - pen.setColor(QColor(0, 0, 0, int(0.2 * 255))); + pen.setColor(color); p.setBrush(Qt::NoBrush); p.setPen(pen); - p.drawRoundedRect(rect().marginsRemoved(QMargins(1, 1, 1, 1)), radius, radius); + p.drawRoundedRect(rect(), radius, radius); p.setPen(Qt::NoPen); p.setBrush(palette().highlight().color()); p.drawRoundedRect(d->m_sliderWidget->geometry(), radius, radius); - pen.setColor(QColor(0, 0, 0, int(0.3 * 255))); + QColor highLightColor(palette().highlight().color()); + auto borderColor = isDarkType ? DGuiApplicationHelper::adjustColor(highLightColor, 0, 0, +10, 0, 0, 0, 0) + : DGuiApplicationHelper::adjustColor(highLightColor, 0, 0, -20, 0, 0, 0, -20); + pen.setColor(borderColor); p.setBrush(Qt::NoBrush); p.setPen(pen); - p.drawRoundedRect(d->m_sliderWidget->geometry().marginsRemoved(QMargins(1, 1, 1, 1)), radius, radius); + p.drawRoundedRect(d->m_sliderWidget->geometry(), radius, radius); if (d->m_sliderWidget->width() < d->m_spotWidget->width() / 2) return; @@ -108,15 +117,11 @@ void DIndeterminateProgressbar::paintEvent(QPaintEvent *e) QPointF pointStart(d->m_spotWidget->geometry().left(), d->m_spotWidget->geometry().center().y()); QPointF pointEnd(d->m_spotWidget->geometry().right(), d->m_spotWidget->geometry().center().y()); - QColor shadowColor(0, 0, 0, int(0.15 * 255)); - QColor spotColor(255, 255, 255, int(0.5 * 255)); - QColor highLightColor(palette().highlight().color()); + QColor spotColor = DGuiApplicationHelper::adjustColor(highLightColor, 0, +30, +30, 0, 0, 0, 0); QLinearGradient linear(pointStart, pointEnd); linear.setColorAt(0, highLightColor); - linear.setColorAt(0.35, shadowColor); linear.setColorAt(0.5, spotColor); - linear.setColorAt(0.65, shadowColor); linear.setColorAt(1, highLightColor); linear.setSpread(QGradient::PadSpread); linear.setInterpolationMode(QLinearGradient::InterpolationMode::ColorInterpolation); @@ -125,9 +130,9 @@ void DIndeterminateProgressbar::paintEvent(QPaintEvent *e) p.setPen(Qt::NoPen); QPainterPath clipPath; - clipPath.addRoundedRect(d->m_sliderWidget->geometry(), radius, radius); + clipPath.addRoundedRect(d->m_sliderWidget->geometry().marginsRemoved(QMargins(1, 1, 1, 1)), radius - 1, radius - 1); p.setClipPath(clipPath); p.setClipping(true); - p.drawRoundedRect(d->m_spotWidget->geometry().marginsRemoved(QMargins(2, 2, 2, 2)), radius, radius); + p.drawRoundedRect(d->m_spotWidget->geometry(), radius, radius); p.setClipping(false); } diff --git a/src/widgets/dlistview.cpp b/src/widgets/dlistview.cpp index 16672ba0..8b7bff3d 100644 --- a/src/widgets/dlistview.cpp +++ b/src/widgets/dlistview.cpp @@ -13,6 +13,8 @@ #include "dstyleditemdelegate.h" #include "dstyle.h" +#include + DWIDGET_BEGIN_NAMESPACE DVariantListModel::DVariantListModel(QObject *parent) : @@ -196,6 +198,11 @@ DListView::DListView(QWidget *parent) : DObject(*new DListViewPrivate(this)) { d_func()->init(); + if (!qEnvironmentVariableIsSet("DTK_DISABLE_LISTVIEW_ANIMATION")) { + auto ani = new DBounceAnimation(this); + ani->setAnimationTarget(this); + ani->setAniMationEnable(true); + } } /*! diff --git a/src/widgets/dmessagemanager.cpp b/src/widgets/dmessagemanager.cpp index 043731e8..f5147241 100644 --- a/src/widgets/dmessagemanager.cpp +++ b/src/widgets/dmessagemanager.cpp @@ -37,7 +37,7 @@ class ImageLabel : public QLabel { QPainter p(this); p.setRenderHint(QPainter::Antialiasing); p.setOpacity(m_opacity); - p.drawPixmap(rect().marginsRemoved(contentsMargins()), *pixmap()); + p.drawPixmap(rect().marginsRemoved(contentsMargins()), pixmap(Qt::ReturnByValue)); }; private: qreal m_opacity; diff --git a/src/widgets/dsearchedit.cpp b/src/widgets/dsearchedit.cpp index afafab3a..35acfdcd 100644 --- a/src/widgets/dsearchedit.cpp +++ b/src/widgets/dsearchedit.cpp @@ -39,6 +39,9 @@ DWIDGET_BEGIN_NAMESPACE DCORE_USE_NAMESPACE DGUI_USE_NAMESPACE +constexpr int ANI_DURATION = 200; +constexpr int HIDE_CURSOR_MARGIN = -4; + #ifdef ENABLE_AI class VoiceDevice : public QIODevice { @@ -270,7 +273,11 @@ DSearchEditPrivate::DSearchEditPrivate(DSearchEdit *q) , action(nullptr) , iconWidget(nullptr) , label(nullptr) + , animation(new QPropertyAnimation) { + animation->setPropertyName("pos"); + animation->setEasingCurve(QEasingCurve::OutCubic); + animation->setDuration(ANI_DURATION); } DSearchEditPrivate::~DSearchEditPrivate() @@ -377,15 +384,31 @@ void DSearchEditPrivate::_q_toEditMode(bool focus) { D_Q(DSearchEdit); - if (focus || !q->lineEdit()->text().isEmpty()) { - action->setVisible(true); - iconWidget->setVisible(false); - lineEdit->setPlaceholderText(placeholderText); - } else { - action->setVisible(false); - iconWidget->setVisible(true); - lineEdit->setPlaceholderText(QString()); - } + if (animation->state() == QPropertyAnimation::Running) + return; + + auto textMargins = q->lineEdit()->textMargins(); + QMargins marginsInAnimation(HIDE_CURSOR_MARGIN, 0, 0, 0); + + if (!animation->parent()) + animation->setParent(iconWidget); + + animation->setTargetObject(iconWidget); + animation->setStartValue(QPoint(q->lineEdit()->geometry().center().x() - iconWidget->width() / 2, iconWidget->pos().y())); + animation->setEndValue(QPoint(0, iconWidget->pos().y())); + + q->connect(animation, &QPropertyAnimation::finished, q, [q, this, textMargins]() { + q->lineEdit()->setTextMargins(textMargins); + if (animation->direction() == QPropertyAnimation::Direction::Forward) { + action->setVisible(true); + iconWidget->setVisible(false); + lineEdit->setPlaceholderText(placeholderText); + } else { + iconWidget->setVisible(true); + lineEdit->setPlaceholderText(QString()); + iconWidget->move(QPoint(q->lineEdit()->geometry().center().x() - iconWidget->width() / 2, iconWidget->pos().y())); + } + }); #ifdef ENABLE_AI //Focus disappears, clear voice check @@ -394,6 +417,20 @@ void DSearchEditPrivate::_q_toEditMode(bool focus) _q_onVoiceActionTrigger(false); } #endif + + if (!q->lineEdit()->text().isEmpty()) + return; + + if (focus) { + animation->setDirection(QPropertyAnimation::Direction::Forward); + } else { + action->setVisible(false); + animation->setDirection(QPropertyAnimation::Direction::Backward); + } + + iconWidget->setVisible(true); + q->lineEdit()->setTextMargins(marginsInAnimation); + animation->start(); } void DSearchEditPrivate::_q_onVoiceActionTrigger(bool checked) diff --git a/src/widgets/dswitchbutton.cpp b/src/widgets/dswitchbutton.cpp index 9aed27f4..48e5d1bc 100644 --- a/src/widgets/dswitchbutton.cpp +++ b/src/widgets/dswitchbutton.cpp @@ -11,12 +11,10 @@ #include #include -#include DWIDGET_BEGIN_NAMESPACE constexpr int DCI_ICON_SIZE = 120; -constexpr int TIMER_INTERVAL = 200; /*! @~english @@ -63,7 +61,7 @@ void DSwitchButton::paintEvent(QPaintEvent *e) painter.drawControl(DStyle::CE_SwitchButton, opt); painter.setRenderHint(QPainter::SmoothPixmapTransform); - painter.drawImage(rect().adjusted(2, -10, -2, 8), d->player.currentImage()); // 为了显示按钮的阴影所留的空白 + painter.drawImage(rect().adjusted(4, -8, -4, 8), d->player.currentImage()); // 为了显示按钮的阴影所留的空白 } /*! @@ -98,7 +96,6 @@ void DSwitchButton::initStyleOption(DStyleOptionButton *option) const DSwitchButtonPrivate::DSwitchButtonPrivate(DSwitchButton *qq) : DObjectPrivate(qq) - , timer(new QTimer(qq)) { } @@ -113,7 +110,6 @@ void DSwitchButtonPrivate::init() checked = false; animationStartValue = 0; animationEndValue = 1; - timer->setInterval(TIMER_INTERVAL); D_Q(DSwitchButton); @@ -143,7 +139,6 @@ void DSwitchButtonPrivate::init() DDciIcon icon = checked ? DDciIcon::fromTheme("switch_on") : DDciIcon::fromTheme("switch_off"); player.setIcon(icon); player.play(DDciIcon::Mode::Normal); - timer->start(); Q_EMIT q->checkedChanged(checked); }); @@ -152,13 +147,6 @@ void DSwitchButtonPrivate::init() q->update(); }); - q->connect(timer, &QTimer::timeout, q, [q, this]() { - player.stop(); - player.setIcon(!q->isChecked() ? DDciIcon::fromTheme("switch_on") : DDciIcon::fromTheme("switch_off")); - player.setMode(DDciIcon::Normal); - timer->stop(); - }); - q->connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, q, initPlayer); } diff --git a/src/widgets/dtoolbutton.cpp b/src/widgets/dtoolbutton.cpp index a2ac4d42..7ce71c19 100644 --- a/src/widgets/dtoolbutton.cpp +++ b/src/widgets/dtoolbutton.cpp @@ -2,13 +2,25 @@ // // SPDX-License-Identifier: LGPL-3.0-or-later -#include "dtoolbutton.h" +#include "private/dtoolbutton_p.h" + +#include +#include #include #include +#include +#include +#include DWIDGET_BEGIN_NAMESPACE +Dtk::Widget::DToolButtonPrivate::DToolButtonPrivate(DToolButton *qq) + : DObjectPrivate(qq) +{ + +} + /*! @~english @class Dtk::Widget::DToolButton @@ -17,8 +29,15 @@ DWIDGET_BEGIN_NAMESPACE DToolButton::DToolButton(QWidget *parent) : QToolButton(parent) + , DObject(*new DToolButtonPrivate(this)) { - + D_D(DToolButton); + connect(this, &DToolButton::pressed, this, [d]() { + d->m_dciPlayer.play(DDciIcon::Pressed); + }); + connect(this, &DToolButton::released, this, [d]() { + d->m_dciPlayer.play(DDciIcon::Normal); + }); } /*! @@ -30,10 +49,26 @@ DToolButton::DToolButton(QWidget *parent) void DToolButton::paintEvent(QPaintEvent *event) { + D_D(DToolButton); Q_UNUSED(event) QStylePainter p(this); QStyleOptionToolButton opt; initStyleOption(&opt); + + if (!d->m_dciIcon.isNull()) { + p.setRenderHint(QPainter::SmoothPixmapTransform); + p.drawImage(rect(), d->m_dciPlayer.currentImage()); + + if (opt.state & QStyle::State_HasFocus) { + p.setPen(QPen(palette().highlight().color(), 2)); + p.setBrush(Qt::NoBrush); + p.setRenderHint(QPainter::Antialiasing); + int radius = DStyle::pixelMetric(style(), DStyle::PM_FrameRadius); + p.drawRoundedRect(opt.rect.marginsRemoved(QMargins(1, 1, 1, 1)), radius, radius); + } + return; + } + p.drawComplexControl(QStyle::CC_ToolButton, opt); } @@ -60,6 +95,26 @@ QSize DToolButton::sizeHint() const return QToolButton::sizeHint(); } +bool DToolButton::event(QEvent *e) +{ + D_D(DToolButton); + if (d->m_dciIcon.isNull()) + return QToolButton::event(e); + + if (e->type() == QEvent::WindowActivate) { + auto palette = DDciIconPalette::fromQPalette(this->palette()); + d->m_dciPlayer.setPalette(palette); + d->m_dciPlayer.setTheme(DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::DarkType + ? DDciIcon::Dark : DDciIcon::Light); + d->m_dciPlayer.setMode(DDciIcon::Normal); + } else if (e->type() == QEvent::HoverEnter) { + d->m_dciPlayer.play(DDciIcon::Hover); + } else if (e->type() == QEvent::HoverLeave) { + d->m_dciPlayer.play(DDciIcon::Normal); + } + return QToolButton::event(e); +} + /*! @~english @fn void DToolButton::setAlignment(Qt::Alignment flag) @@ -85,4 +140,22 @@ Qt::Alignment DToolButton::alignment() const return Qt::AlignLeft; } +void DToolButton::setDciIcon(const DDciIcon &dciIcon) +{ + D_D(DToolButton); + d->m_dciIcon = dciIcon; + d->m_dciPlayer.setIcon(dciIcon); + d->m_dciPlayer.setIconSize(120); + + connect(&d->m_dciPlayer, &DDciIconPlayer::updated, this, [this]() { + update(); + }); + + connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, [this, d](DGuiApplicationHelper::ColorType colorType) { + auto palette = DDciIconPalette::fromQPalette(this->palette()); + d->m_dciPlayer.setPalette(palette); + d->m_dciPlayer.setTheme(colorType ? DDciIcon::Dark : DDciIcon::Light); + }); +} + DWIDGET_END_NAMESPACE diff --git a/src/widgets/private/dbounceanimation_p.h b/src/widgets/private/dbounceanimation_p.h new file mode 100644 index 00000000..09e2d5b3 --- /dev/null +++ b/src/widgets/private/dbounceanimation_p.h @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later +#ifndef DBOUNCEANIMATION_P_H +#define DBOUNCEANIMATION_P_H + +#include "dbounceanimation.h" +#include + +class DBounceAnimationPrivate : public DTK_CORE_NAMESPACE::DObjectPrivate +{ +public: + DBounceAnimationPrivate(DBounceAnimation *qq); + + QPropertyAnimation *m_animation; + QAbstractScrollArea *m_animationTarget; + int m_deltaSum; + +private: + D_DECLARE_PUBLIC(DBounceAnimation) +}; + +#endif // DBOUNCEANIMATION_P_H diff --git a/src/widgets/private/dsearchedit_p.h b/src/widgets/private/dsearchedit_p.h index d5c3eaac..58d614b3 100644 --- a/src/widgets/private/dsearchedit_p.h +++ b/src/widgets/private/dsearchedit_p.h @@ -9,6 +9,7 @@ #include #include +#include QT_BEGIN_NAMESPACE class QAudioInput; @@ -37,6 +38,7 @@ class DSearchEditPrivate : DLineEditPrivate QWidget *iconWidget; QLabel *label; + QPropertyAnimation *animation; #ifdef ENABLE_AI QAction *voiceAction = nullptr; diff --git a/src/widgets/private/dswitchbutton_p.h b/src/widgets/private/dswitchbutton_p.h index 32f265aa..81c8513a 100644 --- a/src/widgets/private/dswitchbutton_p.h +++ b/src/widgets/private/dswitchbutton_p.h @@ -31,7 +31,6 @@ class DSwitchButtonPrivate : public DTK_CORE_NAMESPACE::DObjectPrivate double animationEndValue = 0.0; DDciIconPlayer player; - QTimer *timer; public: D_DECLARE_PUBLIC(DSwitchButton) diff --git a/src/widgets/private/dtoolbutton_p.h b/src/widgets/private/dtoolbutton_p.h new file mode 100644 index 00000000..ff90bf41 --- /dev/null +++ b/src/widgets/private/dtoolbutton_p.h @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later + +#ifndef DABOUTDIALOG_P_H +#define DABOUTDIALOG_P_H + +#include +#include + +DWIDGET_BEGIN_NAMESPACE + +class DToolButtonPrivate : public DCORE_NAMESPACE::DObjectPrivate +{ +public: + DToolButtonPrivate(DToolButton *qq); + + DDciIcon m_dciIcon; + DDciIconPlayer m_dciPlayer; + + Q_DECLARE_PUBLIC(DToolButton) +}; + +DWIDGET_END_NAMESPACE + +#endif // DABOUTDIALOG_P_H