fix: 时间插件显示异常

任务栏参数变化时,时间插件没有同步刷新布局。

Log: 修复时间插件显示异常的问题。
Bug: https://pms.uniontech.com/zentao/bug-view-59013.html
Bug: https://pms.uniontech.com/zentao/bug-view-60340.html
Bug: https://pms.uniontech.com/zentao/bug-view-59126.html
Change-Id: I6df9a6155dcff38758ef06b2ca12826761037fab
This commit is contained in:
Zhang Qipeng 2021-01-07 21:56:53 +08:00
parent 860b78cd5f
commit acbf68cca3
4 changed files with 21 additions and 4 deletions

View File

@ -342,6 +342,9 @@ void MainPanelControl::insertItem(int index, DockItem *item)
break;
}
resizeDockIcon();
QTimer::singleShot(0, [ = ] {
updatePluginsLayout();
});
}
void MainPanelControl::removeItem(DockItem *item)
@ -869,9 +872,22 @@ void MainPanelControl::moveAppSonWidget()
m_appAreaSonWidget->move(rect.x(), rect.y());
}
void MainPanelControl::updatePluginsLayout()
{
for (int i = 0; i < m_pluginLayout->count(); ++i) {
QLayout *layout = m_pluginLayout->itemAt(i)->layout();
if (layout) {
PluginsItem *pItem = static_cast<PluginsItem *>(layout->itemAt(0)->widget());
if (pItem && pItem->sizeHint().width() != -1) {
pItem->updateGeometry();
}
}
}
}
void MainPanelControl::itemUpdated(DockItem *item)
{
item->parentWidget()->adjustSize();
item->updateGeometry();
resizeDockIcon();
}

View File

@ -65,6 +65,7 @@ public:
void setPositonValue(Position position);
void setDisplayMode(DisplayMode dislayMode);
void getTrayVisableItemCount();
void updatePluginsLayout();
MainPanelDelegate *delegate() const;
void setDelegate(MainPanelDelegate *delegate);

View File

@ -254,6 +254,7 @@ void MainWindow::resizeEvent(QResizeEvent *event)
// 任务栏大小、位置、模式改变都会触发resize发射大小改变信号供依赖项目更新位置
Q_EMIT panelGeometryChanged();
m_mainPanel->updatePluginsLayout();
m_shadowMaskOptimizeTimer->start();
return DBlurEffectWidget::resizeEvent(event);

View File

@ -61,7 +61,6 @@ void DatetimeWidget::set24HourFormat(const bool value)
m_24HourFormat = value;
update();
adjustSize();
if (isVisible()) {
emit requestUpdateGeometry();
}
@ -86,7 +85,7 @@ void DatetimeWidget::setShortDateFormat(int type)
default: m_shortDateFormat = "yyyy-MM-dd"; break;
}
update();
adjustSize();
if (isVisible()) {
emit requestUpdateGeometry();
}
@ -104,7 +103,7 @@ void DatetimeWidget::setShortTimeFormat(int type)
default: m_shortTimeFormat = "hh:mm"; break;
}
update();
adjustSize();
if (isVisible()) {
emit requestUpdateGeometry();
}