diff --git a/frame/panel/mainpanelcontrol.cpp b/frame/panel/mainpanelcontrol.cpp index 99746d82d..bdfdd993c 100755 --- a/frame/panel/mainpanelcontrol.cpp +++ b/frame/panel/mainpanelcontrol.cpp @@ -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(layout->itemAt(0)->widget()); + if (pItem && pItem->sizeHint().width() != -1) { + pItem->updateGeometry(); + } + } + } +} + void MainPanelControl::itemUpdated(DockItem *item) { - item->parentWidget()->adjustSize(); + item->updateGeometry(); resizeDockIcon(); } diff --git a/frame/panel/mainpanelcontrol.h b/frame/panel/mainpanelcontrol.h index 6ca8b7fa7..e6ecb06af 100755 --- a/frame/panel/mainpanelcontrol.h +++ b/frame/panel/mainpanelcontrol.h @@ -65,6 +65,7 @@ public: void setPositonValue(Position position); void setDisplayMode(DisplayMode dislayMode); void getTrayVisableItemCount(); + void updatePluginsLayout(); MainPanelDelegate *delegate() const; void setDelegate(MainPanelDelegate *delegate); diff --git a/frame/window/mainwindow.cpp b/frame/window/mainwindow.cpp index 4e8c88f1d..598570229 100755 --- a/frame/window/mainwindow.cpp +++ b/frame/window/mainwindow.cpp @@ -254,6 +254,7 @@ void MainWindow::resizeEvent(QResizeEvent *event) // 任务栏大小、位置、模式改变都会触发resize,发射大小改变信号,供依赖项目更新位置 Q_EMIT panelGeometryChanged(); + m_mainPanel->updatePluginsLayout(); m_shadowMaskOptimizeTimer->start(); return DBlurEffectWidget::resizeEvent(event); diff --git a/plugins/datetime/datetimewidget.cpp b/plugins/datetime/datetimewidget.cpp index 227e789f1..50fbc0ef0 100644 --- a/plugins/datetime/datetimewidget.cpp +++ b/plugins/datetime/datetimewidget.cpp @@ -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(); }