From 7f730c867f8466b22b2f0dc531339632440ced11 Mon Sep 17 00:00:00 2001 From: zhaolong Date: Sun, 28 Jun 2020 19:57:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9B=BA=E5=AE=9A=E5=8C=BA=E4=B8=8E?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=8C=BA=E5=9B=BE=E6=A0=87=E4=B8=8D=E4=B8=80?= =?UTF-8?q?=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 固定区图标所设值,与应用区图标自适应后调为一致 Log: 修复缩放任务栏时,启动器图标和应用图标大小不一致问题 Bug: https://pms.uniontech.com/zentao/bug-view-35028.html --- frame/panel/mainpanelcontrol.cpp | 19 ++++++++++++++++++- frame/panel/mainpanelcontrol.h | 5 ++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/frame/panel/mainpanelcontrol.cpp b/frame/panel/mainpanelcontrol.cpp index 8e029b9d1..fc8cb5365 100755 --- a/frame/panel/mainpanelcontrol.cpp +++ b/frame/panel/mainpanelcontrol.cpp @@ -300,6 +300,7 @@ void MainPanelControl::updateAppAreaSonWidgetSize() m_appAreaSonWidget->adjustSize(); moveAppSonWidget(); + updateFixedAreaIcon(); } void MainPanelControl::setPositonValue(Dock::Position position) @@ -555,7 +556,7 @@ bool MainPanelControl::eventFilter(QObject *watched, QEvent *event) if (event->type() == QEvent::LayoutRequest) { m_appAreaSonWidget->adjustSize(); resizeDockIcon(); - + updateFixedAreaIcon(); } else { moveAppSonWidget(); } @@ -1086,3 +1087,19 @@ void MainPanelControl::resizeDesktopWidget() m_desktopWidget->setFixedSize(0, 0); } +void MainPanelControl::updateFixedAreaIcon() +{ + QLayoutItem *appLayoutItem = m_appAreaSonLayout->itemAt(0); + if (appLayoutItem) { + QWidget *appWidget = appLayoutItem->widget(); + if (appWidget) { + int w = appWidget->width(); + int h = appWidget->height(); + for (int i = 0; i < m_fixedAreaLayout->count(); ++ i) { + // 取最近较小偶数, 去抖 + m_fixedAreaLayout->itemAt(i)->widget()->setFixedSize((w | 1) - 1, (h | 1) - 1); + } + } + } +} + diff --git a/frame/panel/mainpanelcontrol.h b/frame/panel/mainpanelcontrol.h index 0b0b6dd26..51d5b69ba 100755 --- a/frame/panel/mainpanelcontrol.h +++ b/frame/panel/mainpanelcontrol.h @@ -100,7 +100,10 @@ private: void paintEvent(QPaintEvent *event) override; void resizeDockIcon(); void calcuDockIconSize(int w, int h, PluginsItem *trashPlugin, PluginsItem *shutdownPlugin, PluginsItem *keyboardPlugin, PluginsItem *notificationPlugin); - void resizeDesktopWidget(); + void resizeDesktopWidget(); + + void updateFixedAreaIcon(); + public slots: void insertItem(const int index, DockItem *item); void removeItem(DockItem *item);