From 9906278736092f1c6d3c0590b3ca64cc1add18fd Mon Sep 17 00:00:00 2001 From: deepin-ci-robot Date: Mon, 25 Mar 2024 10:27:46 +0000 Subject: [PATCH] sync: from linuxdeepin/dtkwidget Synchronize source files from linuxdeepin/dtkwidget. Source-pull-request: https://github.com/linuxdeepin/dtkwidget/pull/560 --- include/widgets/dstyle.h | 1 + .../assets/icons/bloom/window_close.dci | Bin 0 -> 819 bytes .../assets/icons/bloom/window_maximize.dci | Bin 0 -> 647 bytes .../assets/icons/bloom/window_menu.dci | Bin 1069 -> 971 bytes .../assets/icons/bloom/window_minimize.dci | Bin 0 -> 613 bytes .../assets/icons/bloom/window_normal.dci | Bin 0 -> 665 bytes src/widgets/assets/icons/dtk-icon-theme.qrc | 4 ++ src/widgets/daboutdialog.cpp | 1 + src/widgets/dalertcontrol.cpp | 3 -- src/widgets/dstyle.cpp | 48 ++++-------------- 10 files changed, 17 insertions(+), 40 deletions(-) create mode 100644 src/widgets/assets/icons/bloom/window_close.dci create mode 100644 src/widgets/assets/icons/bloom/window_maximize.dci create mode 100644 src/widgets/assets/icons/bloom/window_minimize.dci create mode 100644 src/widgets/assets/icons/bloom/window_normal.dci diff --git a/include/widgets/dstyle.h b/include/widgets/dstyle.h index c8fa4f544..755733796 100644 --- a/include/widgets/dstyle.h +++ b/include/widgets/dstyle.h @@ -73,6 +73,7 @@ void drawIndicatorChecked(QPainter *pa, const QRectF &rect); void drawDeleteButton(QPainter *pa, const QRectF &rect); void drawAddButton(QPainter *pa, const QRectF &rect); +void drawTitleBarIcon(QPainter *pa, const QRectF &rect, const QString &iconName); void drawTitleBarMenuButton(QPainter *pa, const QRectF &rect); void drawTitleBarMinButton(QPainter *pa, const QRectF &rect); void drawTitleBarMaxButton(QPainter *pa, const QRectF &rect); diff --git a/src/widgets/assets/icons/bloom/window_close.dci b/src/widgets/assets/icons/bloom/window_close.dci new file mode 100644 index 0000000000000000000000000000000000000000..bd2910c1510b6c8af890d761e9b22d35a082c65e GIT binary patch literal 819 zcmZ>9_GDmWWME)2HDI6wJZ6IEX3EPi%1zACOGzxsCda(BP)$t6bacE^o$aHV||#}Fi(TUNirUyco{GPK!8$D$3e|uggFdi zEXkx8)SMtsH#a^YJKWVNAS}SbhY85mpX#70P%j|JCFPm5_`danwg;^Y>M46>q<>Jh zJFs?JZsg|&YaVdl;L&+-;olktX!sB)|=%?TQ+fp zZTFadui?L6|KHhHWiCfNQMhrs_?T7qz3(zjdw(Xs)|s-uDM8)-*rNL_F54oj!}ujV zwq0NLHliKKo}M-I_14J#wf%Aj0WYouFwjzl!V3@_9_3LtPqwYAGG~RJY_njlEDpWoB@} nNB+#;RjUNv9RALr?alG6s^D*rufmNj4`v)Q>;Lb=|DPEEYKWVo literal 0 HcmV?d00001 diff --git a/src/widgets/assets/icons/bloom/window_maximize.dci b/src/widgets/assets/icons/bloom/window_maximize.dci new file mode 100644 index 0000000000000000000000000000000000000000..db5e9715871fb6e31f3f15e19543e085927fa764 GIT binary patch literal 647 zcmZ>9_GDmWWME)2HDI6wm@`3iGv(zMF^;}M7dPa%9u|CXfn5V(wBpDA;{0pjwQcrJ!n!^Zl7#VH> zX~}}>3-WYxO9HaPU7Z5L0xWz&fo%P$4ypp`0)j0!-Kx(f7O@vUX^c-0xEZ#pn?<2X zG{GZbeZB6R-ELpzJ6uX@`(gZG%Fpl1nXX#2Wtv0Ji8zL;wH) literal 0 HcmV?d00001 diff --git a/src/widgets/assets/icons/bloom/window_menu.dci b/src/widgets/assets/icons/bloom/window_menu.dci index 60357bbc1d6aae5dc9d7db71f58a52b9b9926606..3f775f229ff2711ac284a2316b290645907e11ef 100644 GIT binary patch delta 478 zcmV<40U`da2+IeMNCA7XNjw1xJ^}y$000000yC450Xzf%0QLcs&jCh%t^oi500000 zQb|TerU3u|S4BclR!}%hnE?O*FO@(g5ML1y3L8mEbL`{p5Xy)n#GnnuVff5K!7Y$D z4cCeb7=uCJ$c-dLs$u3?W`_9x69=Vg?QJ9a@5qfLMd}z{ic``4K>q0S_n)ZQ9nR0^ z`LJsub39pH=;g99!UKPQ{bi8v+85>6%QwJ%Q>B6925Ggu1H2ZtXvRAN>@%xR#me>o zM^E$;Ux8CHtdpF8Ypi#F!lxc*RDa;9b@Q(9$j3V654h@l(LTZ>9B&mq;HdJ;mhj1^ zXcZq=XpE03Cj^(Obv)=pwZ`naL*B2QodN;~SmH9GVWT>jZR27t| zs!dZ>=BDamjMMQs1sr2dxN@NCDlkNjw1xpaK8@000000yC450Xzf%09XQ(&jCh%5CQ-I00000 zQb|Te2m$~AS4BclR!}%h`~d&}FO@(g5T_9l4BNJG9DLc=``yQfkYr*iuA~mRYxNGqBxQ^YNRA{al5&`tnR%N1|F0X^E_J5%HWB@2;7F1Z`VN=IVfP2}6N8`s zE=a|cRMYot(*;iW4h}nUwE#&IrV*`D}UlT(%sX)01zH#gJ!K*tThL-LkPg7 zFKTHV0sPId{Mn{F-1q>;hUlc{0l~cT7o*BN0KA@PWD-NNs{d80zDgjTh&u8M;L%AV z)_DMnyeMMtaXXqyV`N@?9nJ3!aOUJN@IdOL`FnzrhH!TF^>b?+HGMH@ZB zqwYqq{(z&NHwh#iSBjkkw7gw%7g)KIT){=jyLbda-JN7TfRT>w73MBA=Wtcg>4INz zsaf@*D+*Y{#;xZD)*6PNFmx+Agr|bR7KCNDqU8`;l6j_ZaBX^ksbrod%sxo8$K!T- z2bsZAGS3MH@3-}T9$;Th=O7{jI7#NYL-S2x4*>gg4kFToyJQ{@YHybZ06;s1!wWU= zB=ba2d^H#Y0E|;OyikP5uEweXlV-VDwIZ{g-d4Totokaj>I=%Augxv24f-;#_|P@$ zFUF`pKCAwYjfx}~6?L&HLSOGYEx#} Pj4b^9a~A$520#80!~q2q diff --git a/src/widgets/assets/icons/bloom/window_minimize.dci b/src/widgets/assets/icons/bloom/window_minimize.dci new file mode 100644 index 0000000000000000000000000000000000000000..8f292b51696485b379462a3b0f89d42aef366a39 GIT binary patch literal 613 zcmZ>9_GDmWWME)2HDI6wh%!NRGv(zMF^;}M7dPa%9u|CXfn5V(wBpDA;d;_Y7Qcq8Sn!^Zl7#VH> zY4L#S3-WYxa{#i#U7Z5L0xWz$aiTxfK~+FpK#-|XW!B%)ZJg|`xwjpTMw>KmD6f3S c65#q}e!`?>xB42(O+%h`hCIH#GnJ760Fo0m+W-In literal 0 HcmV?d00001 diff --git a/src/widgets/assets/icons/bloom/window_normal.dci b/src/widgets/assets/icons/bloom/window_normal.dci new file mode 100644 index 0000000000000000000000000000000000000000..0726e8139ea6b0fd9376438d2c43723aad099045 GIT binary patch literal 665 zcmZ>9_GDmWWME)2HDI6wcrrnBGv(zMF^;}M7dPa%9u|CXfn5V(wBpDA;%ma)75TMl4MzT^9rA6;(c%-ju6yJ2Rxo zP4vW+;y!!xz5jL#&a_bloom/play_pause.dci bloom/play_previous.dci bloom/play_next.dci + bloom/window_close.dci + bloom/window_maximize.dci + bloom/window_minimize.dci + bloom/window_normal.dci diff --git a/src/widgets/daboutdialog.cpp b/src/widgets/daboutdialog.cpp index 3ee17afa8..93eca15b2 100644 --- a/src/widgets/daboutdialog.cpp +++ b/src/widgets/daboutdialog.cpp @@ -63,6 +63,7 @@ void DAboutDialogPrivate::init() D_Q(DAboutDialog); q->setFixedSize(540, 290); + q->setWindowFlags(q->windowFlags() | Qt::CustomizeWindowHint); // overwrite default info if distribution config file existed. loadDistributionInfo(); diff --git a/src/widgets/dalertcontrol.cpp b/src/widgets/dalertcontrol.cpp index 11b8104a4..40eb413ee 100644 --- a/src/widgets/dalertcontrol.cpp +++ b/src/widgets/dalertcontrol.cpp @@ -282,9 +282,6 @@ bool DAlertControl::eventFilter(QObject *watched, QEvent *event) if (watched == d->follower) { if (event->type() == QEvent::Move || event->type() == QEvent::Resize) d->updateTooltipPos(); - - if (event->type() == QEvent::Hide || event->type() == QEvent::HideToParent) - hideAlertMessage(); } if (d->follower && watched == d->follower->topLevelWidget()) { diff --git a/src/widgets/dstyle.cpp b/src/widgets/dstyle.cpp index d1877795b..234d0da24 100644 --- a/src/widgets/dstyle.cpp +++ b/src/widgets/dstyle.cpp @@ -696,7 +696,7 @@ void drawAddButton(QPainter *pa, const QRectF &rect) pa->fillPath(path, QColor("#48bf00")); } -void drawTitleBarMenuButton(QPainter *pa, const QRectF &rect) +void drawTitleBarIcon(QPainter *pa, const QRectF &rect, const QString &iconName) { const QPen pen = pa->pen(); pa->setPen(Qt::NoPen); @@ -705,7 +705,7 @@ void drawTitleBarMenuButton(QPainter *pa, const QRectF &rect) content_rect.moveCenter(rect.center().toPoint()); pa->setPen(pen); - const DDciIcon &icon = DDciIcon::fromTheme(QLatin1String("window_menu")); + const DDciIcon &icon = DDciIcon::fromTheme(iconName); auto devicePixelRatio = pa->device() ? pa->device()->devicePixelRatioF() : qApp->devicePixelRatio(); auto appTheme = DGuiApplicationHelper::toColorType(pa->pen().color()); @@ -714,55 +714,29 @@ void drawTitleBarMenuButton(QPainter *pa, const QRectF &rect) icon.paint(pa, rect.toRect(), devicePixelRatio, theme, DDciIcon::Normal, Qt::AlignCenter, palette); } +void drawTitleBarMenuButton(QPainter *pa, const QRectF &rect) +{ + drawTitleBarIcon(pa, rect, QLatin1String("window_menu")); +} + void drawTitleBarMinButton(QPainter *pa, const QRectF &rect) { - const QPen pen = pa->pen(); - pa->setPen(Qt::NoPen); - pa->drawRect(rect); - QRect content_rect(0, 0, rect.width() / 5, rect.height() / 5); - content_rect.moveCenter(rect.center().toPoint()); - pa->setPen(pen); - pa->setRenderHint(QPainter::Antialiasing, pa->device()->devicePixelRatioF() > 1.0); - drawDecreaseElement(pa, content_rect); + drawTitleBarIcon(pa, rect, QLatin1String("window_minimize")); } void drawTitleBarMaxButton(QPainter *pa, const QRectF &rect) { - const QPen pen = pa->pen(); - pa->setPen(Qt::NoPen); - pa->drawRect(rect); - QRect content_rect(0, 0, rect.width() / 5, rect.height() / 6); - content_rect.moveCenter(rect.center().toPoint()); - pa->setPen(pen); - pa->setRenderHint(QPainter::Antialiasing, pa->device()->devicePixelRatioF() > 1.0); - pa->drawRect(content_rect); + drawTitleBarIcon(pa, rect, QLatin1String("window_maximize")); } void drawTitleBarCloseButton(QPainter *pa, const QRectF &rect) { - const QPen pen = pa->pen(); - pa->setPen(Qt::NoPen); - pa->drawRect(rect); - QRectF content_rect(0, 0, rect.width() / 5, rect.height() / 5); - content_rect.moveCenter(rect.center()); - pa->setPen(pen); - pa->setRenderHint(QPainter::Antialiasing, pa->device()->devicePixelRatioF() > 1.0); - drawForkElement(pa, content_rect); + drawTitleBarIcon(pa, rect, QLatin1String("window_close")); } void drawTitleBarNormalButton(QPainter *pa, const QRectF &rect) { - const QPen pen = pa->pen(); - pa->setPen(Qt::NoPen); - pa->drawRect(rect); - QRect content_rect(0, 0, rect.width() / 5, rect.height() / 5); - content_rect.moveCenter(rect.center().toPoint()); - pa->setPen(pen); - - pa->setRenderHint(QPainter::Antialiasing, pa->device()->devicePixelRatioF() > 1.0); - pa->drawRect(content_rect.x(), content_rect.y() + 2, content_rect.width() - 2, content_rect.height() - 2); - pa->drawLine(content_rect.x() + 2, content_rect.y(), content_rect.right(), content_rect.y()); - pa->drawLine(content_rect.right() + 1, content_rect.y(), content_rect.right() + 1, content_rect.bottom() - 2); + drawTitleBarIcon(pa, rect, QLatin1String("window_normal")); } void drawTitleQuitFullButton(QPainter *pa, const QRectF &rect)