mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fixed(bug3751):tray icon size error
This commit is contained in:
parent
4f3799a817
commit
68b45bbf4b
@ -180,9 +180,6 @@ void MainPanelControl::addAppAreaItem(int index, QWidget *wdg)
|
||||
void MainPanelControl::addTrayAreaItem(int index, QWidget *wdg)
|
||||
{
|
||||
m_trayAreaLayout->insertWidget(index, wdg);
|
||||
|
||||
//解决开机或切换用户时托盘区域大小没有调整,导致托盘图标重叠问题
|
||||
QTimer::singleShot(50, this, [ = ] {m_trayAreaWidget->adjustSize();});
|
||||
}
|
||||
|
||||
void MainPanelControl::addPluginAreaItem(int index, QWidget *wdg)
|
||||
|
@ -8,14 +8,7 @@ NormalContainer::NormalContainer(TrayPlugin *trayPlugin, QWidget *parent)
|
||||
m_sizeAnimation->setEasingCurve(QEasingCurve::InOutCubic);
|
||||
|
||||
connect(m_sizeAnimation, &QVariantAnimation::valueChanged, [ = ](const QVariant & value) {
|
||||
|
||||
if (dockPosition() == Dock::Top || dockPosition() == Dock::Bottom) {
|
||||
this->setMaximumWidth(value.toSize().width());
|
||||
this->setMaximumHeight(DOCK_MAX_SIZE);
|
||||
} else {
|
||||
this->setMaximumWidth(DOCK_MAX_SIZE);
|
||||
this->setMaximumHeight(value.toSize().height());
|
||||
}
|
||||
adjustMaxSize(value.toSize());
|
||||
});
|
||||
|
||||
connect(m_sizeAnimation, &QVariantAnimation::finished, [ = ]() {
|
||||
@ -101,8 +94,11 @@ void NormalContainer::refreshVisible()
|
||||
m_sizeAnimation->setStartValue(size());
|
||||
m_sizeAnimation->setEndValue(endSize);
|
||||
|
||||
if (isVisible() == expand())
|
||||
if (isVisible() == expand()) {
|
||||
// 非x86平台,第一次启动setEndValue时,不进QVariantAnimation::valueChanged
|
||||
adjustMaxSize(endSize);
|
||||
return;
|
||||
}
|
||||
|
||||
if (expand()) {
|
||||
setVisible(true);
|
||||
@ -111,6 +107,17 @@ void NormalContainer::refreshVisible()
|
||||
m_sizeAnimation->start();
|
||||
}
|
||||
|
||||
void NormalContainer::adjustMaxSize(const QSize size)
|
||||
{
|
||||
if (dockPosition() == Dock::Top || dockPosition() == Dock::Bottom) {
|
||||
this->setMaximumWidth(size.width());
|
||||
this->setMaximumHeight(DOCK_MAX_SIZE);
|
||||
} else {
|
||||
this->setMaximumWidth(DOCK_MAX_SIZE);
|
||||
this->setMaximumHeight(size.height());
|
||||
}
|
||||
}
|
||||
|
||||
void NormalContainer::setExpand(const bool expand)
|
||||
{
|
||||
for (auto w : wrapperList()) {
|
||||
|
@ -26,6 +26,7 @@ private:
|
||||
int whereToInsertAppTrayByDefault(FashionTrayWidgetWrapper *wrapper) const;
|
||||
int whereToInsertSystemTrayByDefault(FashionTrayWidgetWrapper *wrapper) const;
|
||||
void compositeChanged();
|
||||
void adjustMaxSize(const QSize size);
|
||||
|
||||
private:
|
||||
mutable QVariantAnimation *m_sizeAnimation;
|
||||
|
@ -194,11 +194,6 @@ void FashionTrayItem::onPluginSettingsChanged()
|
||||
void FashionTrayItem::showEvent(QShowEvent *event)
|
||||
{
|
||||
requestResize();
|
||||
//抓托盘重叠问题log,以后删除打印
|
||||
qDebug()<<"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ controlWidget rect:"<<m_controlWidget->rect();
|
||||
qDebug()<<"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ normalContainer rect:"<<m_normalContainer->rect();
|
||||
qDebug()<<"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ controlWidget geometry:"<<m_controlWidget->geometry();
|
||||
qDebug()<<"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ normalContainer geometry:"<<m_normalContainer->geometry();
|
||||
|
||||
QWidget::showEvent(event);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user