From 5de33914573ed0900986827961c3214d7e2592de Mon Sep 17 00:00:00 2001 From: Zhang Sheng Date: Mon, 12 Aug 2024 13:47:42 +0800 Subject: [PATCH] refactor: use DciIco in wallpapertlist as title log: --- .../ddplugin-wallpapersetting/images.qrc | 2 ++ .../images/arrow-left.dci | Bin 0 -> 765 bytes .../images/arrow-right.dci | Bin 0 -> 761 bytes .../wallpaperlist.cpp | 21 ++---------------- .../ddplugin-wallpapersetting/wallpaperlist.h | 13 ++--------- 5 files changed, 6 insertions(+), 30 deletions(-) create mode 100644 src/plugins/desktop/ddplugin-wallpapersetting/images/arrow-left.dci create mode 100644 src/plugins/desktop/ddplugin-wallpapersetting/images/arrow-right.dci diff --git a/src/plugins/desktop/ddplugin-wallpapersetting/images.qrc b/src/plugins/desktop/ddplugin-wallpapersetting/images.qrc index ff28806e69..5f122d59ef 100644 --- a/src/plugins/desktop/ddplugin-wallpapersetting/images.qrc +++ b/src/plugins/desktop/ddplugin-wallpapersetting/images.qrc @@ -16,5 +16,7 @@ images/transparent_button_normal.svg images/transparent_button_press.svg images/edit.svg + images/arrow-left.dci + images/arrow-right.dci diff --git a/src/plugins/desktop/ddplugin-wallpapersetting/images/arrow-left.dci b/src/plugins/desktop/ddplugin-wallpapersetting/images/arrow-left.dci new file mode 100644 index 0000000000000000000000000000000000000000..1af6ac62989a162477fdcdca26731ec150176403 GIT binary patch literal 765 zcmZ>9_GDmWWME)2G-99xtYw1eX3EPi%1zACOGzxsCda(BP)$t6bacE^o$aHV||#}Fi(TUNirUyxBwUdAV8_7HK67&!W;%M zmSpk)R7a4fo7)W_JKWVNAS}Sb=M0douY7<*;Jlz9&+To6GFCfldzlx+OFZ6kR_TCb z@@_9(yO-rUoB|9np4)P*thaqmx_xcl{|leC_+iI^$mVXXv&!>m_ zO}#hiPRAzeNqaJiswX{(2(s9rBi!}qVyam96hFPoGZxhp{uc}k$Zp2@=h`eD69_GDmWWME)2G-99xtYm`dX3EPi%1zACOGzxsCda(BP)$t6bacE^o$aHV||#}Fi(TUNirUyI0qO3AV8_7RiNfD!W;%M zmSpk{R7a4fo7)v2JKWVNAS}Sb=LC?guY7<*;Jlz9&+To6GFCfldzlyTKYXy|tkT1t zjj>zA=6|^zA*8^tW15O*pji3yg7(8-YySPe{G#^7%^lx6{uvkDJ~naf%iYVTxX-BB zRm$lX8f7lH(>#JzNvU6L<=^;ES%s_SG?uq7u3@o@?YqSIVKb?c?Tp8=1|N@OnoF9eiSW&P?Jrg^yXf~+QR}5L0Vh3CW`*+sK{k#Ch_kv9T literal 0 HcmV?d00001 diff --git a/src/plugins/desktop/ddplugin-wallpapersetting/wallpaperlist.cpp b/src/plugins/desktop/ddplugin-wallpapersetting/wallpaperlist.cpp index 1ca00d8a04..746a529fff 100644 --- a/src/plugins/desktop/ddplugin-wallpapersetting/wallpaperlist.cpp +++ b/src/plugins/desktop/ddplugin-wallpapersetting/wallpaperlist.cpp @@ -389,20 +389,8 @@ void WallpaperList::updateItemThumb() void WallpaperList::init() { -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) - prevButton = new DImageButton(":/images/previous_normal.svg", - ":/images/previous_hover.svg", - ":/images/previous_press.svg", this); - nextButton = new DImageButton(":/images/next_normal.svg", - ":/images/next_hover.svg", - ":/images/next_press.svg", this); -#else - // TODO #v25: 需要设计师提供 dci icon - prevButton = new DIconButton(this); - prevButton->setIcon(QIcon(":/images/previous_normal.svg")); - nextButton = new DIconButton(this); - nextButton->setIcon(QIcon(":/images/next_normal.svg")); -#endif + prevButton = new DIconButton(DDciIcon(QStringLiteral(":/images/arrow-left.dci")), this); + nextButton = new DIconButton(DDciIcon(QStringLiteral(":/images/arrow-right.dci")), this); setObjectName("WallpaperList-QScrollArea"); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -436,13 +424,8 @@ void WallpaperList::init() nextButton.setAnchor(Qt::AnchorVerticalCenter, this, Qt::AnchorVerticalCenter); nextButton.setAnchor(Qt::AnchorRight, this, Qt::AnchorRight); -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) - connect(prevButton.widget(), &DImageButton::clicked, this, &WallpaperList::prevPage); - connect(nextButton.widget(), &DImageButton::clicked, this, &WallpaperList::nextPage); -#else connect(prevButton.widget(), &DIconButton::clicked, this, &WallpaperList::prevPage); connect(nextButton.widget(), &DIconButton::clicked, this, &WallpaperList::nextPage); -#endif scrollAnimation.setTargetObject(horizontalScrollBar()); scrollAnimation.setPropertyName("value"); diff --git a/src/plugins/desktop/ddplugin-wallpapersetting/wallpaperlist.h b/src/plugins/desktop/ddplugin-wallpapersetting/wallpaperlist.h index 795cda0aff..d96252d32c 100644 --- a/src/plugins/desktop/ddplugin-wallpapersetting/wallpaperlist.h +++ b/src/plugins/desktop/ddplugin-wallpapersetting/wallpaperlist.h @@ -9,17 +9,12 @@ #include "wallpaperitem.h" #include +#include #include #include #include -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) -# include -#else -# include -#endif - class QHBoxLayout; namespace ddplugin_wallpapersetting { @@ -80,13 +75,9 @@ private slots: static const int kItemHeight; private: -#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) - DTK_WIDGET_NAMESPACE::DAnchors prevButton = nullptr; - DTK_WIDGET_NAMESPACE::DAnchors nextButton = nullptr; -#else DTK_WIDGET_NAMESPACE::DAnchors prevButton = nullptr; DTK_WIDGET_NAMESPACE::DAnchors nextButton = nullptr; -#endif + QTimer *updateTimer = nullptr; QPropertyAnimation scrollAnimation;