mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
fixed(tray):tray pos error
偶尔会出现托盘图标错位的问题
This commit is contained in:
parent
0356c5ca54
commit
6ffbf9e39f
@ -49,11 +49,6 @@ void PowerStatusWidget::refreshIcon()
|
||||
update();
|
||||
}
|
||||
|
||||
QSize PowerStatusWidget::sizeHint() const
|
||||
{
|
||||
return QSize(26, 26);
|
||||
}
|
||||
|
||||
void PowerStatusWidget::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
Q_UNUSED(e);
|
||||
@ -105,3 +100,18 @@ QPixmap PowerStatusWidget::getBatteryIcon()
|
||||
|
||||
return pix;
|
||||
}
|
||||
|
||||
void PowerStatusWidget::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QWidget::resizeEvent(event);
|
||||
|
||||
const Dock::Position position = qApp->property(PROP_POSITION).value<Dock::Position>();
|
||||
// 保持横纵比
|
||||
if (position == Dock::Bottom || position == Dock::Top) {
|
||||
setMaximumWidth(height());
|
||||
setMaximumHeight(QWIDGETSIZE_MAX);
|
||||
} else {
|
||||
setMaximumHeight(width());
|
||||
setMaximumWidth(QWIDGETSIZE_MAX);
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ signals:
|
||||
void requestContextMenu(const QString &itemKey) const;
|
||||
|
||||
protected:
|
||||
QSize sizeHint() const;
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void paintEvent(QPaintEvent *e);
|
||||
|
||||
private:
|
||||
|
@ -118,15 +118,20 @@ void SoundItem::invokeMenuItem(const QString menuId, const bool checked)
|
||||
.call();
|
||||
}
|
||||
|
||||
QSize SoundItem::sizeHint() const
|
||||
{
|
||||
return QSize(26, 26);
|
||||
}
|
||||
|
||||
void SoundItem::resizeEvent(QResizeEvent *e)
|
||||
{
|
||||
QWidget::resizeEvent(e);
|
||||
|
||||
const Dock::Position position = qApp->property(PROP_POSITION).value<Dock::Position>();
|
||||
// 保持横纵比
|
||||
if (position == Dock::Bottom || position == Dock::Top) {
|
||||
setMaximumWidth(height());
|
||||
setMaximumHeight(QWIDGETSIZE_MAX);
|
||||
} else {
|
||||
setMaximumHeight(width());
|
||||
setMaximumWidth(QWIDGETSIZE_MAX);
|
||||
}
|
||||
|
||||
refreshIcon();
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,6 @@ signals:
|
||||
void requestContextMenu() const;
|
||||
|
||||
protected:
|
||||
QSize sizeHint() const;
|
||||
void resizeEvent(QResizeEvent *e);
|
||||
void wheelEvent(QWheelEvent *e);
|
||||
void paintEvent(QPaintEvent *e);
|
||||
|
Loading…
x
Reference in New Issue
Block a user