fix: 固定区与应用区图标不一致

固定区图标所设值,与应用区图标自适应后调为一致

Log: 修复缩放任务栏时,启动器图标和应用图标大小不一致问题
Bug: https://pms.uniontech.com/zentao/bug-view-35028.html
This commit is contained in:
zhaolong 2020-06-28 19:57:46 +08:00
parent 8e97f166b9
commit 7f730c867f
2 changed files with 22 additions and 2 deletions

View File

@ -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);
}
}
}
}

View File

@ -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);