mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
fix: tray icon pixmap align
Change-Id: Idb017b7706d8f3eb13ebc90dc517a5c174642d03
This commit is contained in:
parent
b696c4daf2
commit
d1fa536406
Notes:
gerrit
2018-11-21 09:07:24 +08:00
Verified+1: <jenkins@deepin.com> Code-Review+2: listenerri <listenerri@gmail.com> Submitted-by: listenerri <listenerri@gmail.com> Submitted-at: Wed, 21 Nov 2018 09:07:23 +0800 Reviewed-on: https://cr.deepin.io/39888 Project: dde/dde-dock Branch: refs/heads/master
@ -84,8 +84,10 @@ void WiredItem::paintEvent(QPaintEvent *e)
|
||||
|
||||
QPainter painter(this);
|
||||
const auto ratio = qApp->devicePixelRatio();
|
||||
const int x = rect().center().x() - m_icon.rect().center().x() / ratio;
|
||||
const int y = rect().center().y() - m_icon.rect().center().y() / ratio;
|
||||
const QRectF &rf = QRectF(rect());
|
||||
const QRectF &rfp = QRectF(m_icon.rect());
|
||||
const int x = rf.center().x() - rfp.center().x() / ratio;
|
||||
const int y = rf.center().y() - rfp.center().y() / ratio;
|
||||
painter.drawPixmap(x, y, m_icon);
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,9 @@ void WirelessItem::paintEvent(QPaintEvent *e)
|
||||
pixmap.setDevicePixelRatio(ratio);
|
||||
painter.drawPixmap(rect().center() - pixmap.rect().center() / ratio, pixmap);
|
||||
}
|
||||
painter.drawPixmap(rect().center() - pixmap.rect().center() / ratio, pixmap);
|
||||
const QRectF &rf = QRectF(rect());
|
||||
const QRectF &rfp = QRectF(pixmap.rect());
|
||||
painter.drawPixmap(rf.center() - rfp.center() / ratio, pixmap);
|
||||
|
||||
if (m_reloadIcon)
|
||||
m_reloadIcon = false;
|
||||
|
@ -50,7 +50,9 @@ void PowerStatusWidget::paintEvent(QPaintEvent *e)
|
||||
const auto ratio = devicePixelRatioF();
|
||||
|
||||
QPainter painter(this);
|
||||
painter.drawPixmap(rect().center() - icon.rect().center() / ratio, icon);
|
||||
const QRectF &rf = QRectF(rect());
|
||||
const QRectF &rfp = QRectF(icon.rect());
|
||||
painter.drawPixmap(rf.center() - rfp.center() / ratio, icon);
|
||||
}
|
||||
|
||||
void PowerStatusWidget::mousePressEvent(QMouseEvent *e)
|
||||
|
@ -153,7 +153,9 @@ void SoundItem::paintEvent(QPaintEvent *e)
|
||||
QWidget::paintEvent(e);
|
||||
|
||||
QPainter painter(this);
|
||||
painter.drawPixmap(rect().center() - m_iconPixmap.rect().center() / m_iconPixmap.devicePixelRatioF(), m_iconPixmap);
|
||||
const QRectF &rf = QRectF(rect());
|
||||
const QRectF &rfp = QRectF(m_iconPixmap.rect());
|
||||
painter.drawPixmap(rf.center() - rfp.center() / m_iconPixmap.devicePixelRatioF(), m_iconPixmap);
|
||||
}
|
||||
|
||||
void SoundItem::refershIcon()
|
||||
|
Loading…
x
Reference in New Issue
Block a user