fixed(bug3751):tray icon size error

This commit is contained in:
shaojun 2019-10-16 13:41:30 +08:00
parent 4f3799a817
commit 68b45bbf4b
4 changed files with 17 additions and 17 deletions

View File

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

View File

@ -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()) {

View File

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

View File

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