mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-01 07:05:48 +00:00
fixed(bug:3589):icon not in center
This commit is contained in:
parent
d76c0b7aab
commit
f14dc75d06
@ -46,7 +46,9 @@ void DiskPluginItem::paintEvent(QPaintEvent *e)
|
||||
QWidget::paintEvent(e);
|
||||
|
||||
QPainter painter(this);
|
||||
painter.drawPixmap(rect().center() - m_icon.rect().center(), m_icon);
|
||||
const QRectF &rf = QRectF(rect());
|
||||
const QRectF &rfp = QRectF(m_icon.rect());
|
||||
painter.drawPixmap(rf.center() - rfp.center(), m_icon);
|
||||
}
|
||||
|
||||
void DiskPluginItem::resizeEvent(QResizeEvent *e)
|
||||
|
@ -107,7 +107,9 @@ void OnboardItem::paintEvent(QPaintEvent *e)
|
||||
pixmap = loadSvg(iconName, QSize(iconSize, iconSize));
|
||||
|
||||
painter.setOpacity(1);
|
||||
painter.drawPixmap(rect().center() - pixmap.rect().center() / devicePixelRatioF(), pixmap);
|
||||
const QRectF &rf = QRectF(rect());
|
||||
const QRectF &rfp = QRectF(pixmap.rect());
|
||||
painter.drawPixmap(rf.center() - rfp.center() / devicePixelRatioF(), pixmap);
|
||||
}
|
||||
|
||||
const QPixmap OnboardItem::loadSvg(const QString &fileName, const QSize &size) const
|
||||
|
@ -57,7 +57,9 @@ void PluginWidget::paintEvent(QPaintEvent *e)
|
||||
pixmap = loadSvg(iconName, QSize(iconSize, iconSize));
|
||||
|
||||
QPainter painter(this);
|
||||
painter.drawPixmap(rect().center() - pixmap.rect().center() / devicePixelRatioF(), pixmap);
|
||||
const QRectF &rf = QRectF(rect());
|
||||
const QRectF &rfp = QRectF(pixmap.rect());
|
||||
painter.drawPixmap(rf.center() - rfp.center() / devicePixelRatioF(), pixmap);
|
||||
}
|
||||
|
||||
const QPixmap PluginWidget::loadSvg(const QString &fileName, const QSize &size) const
|
||||
|
@ -104,7 +104,9 @@ void PluginWidget::paintEvent(QPaintEvent *e)
|
||||
painter.setOpacity(1);
|
||||
|
||||
pixmap = loadSvg(iconName, QSize(iconSize, iconSize));
|
||||
painter.drawPixmap(rect().center() - pixmap.rect().center() / devicePixelRatioF(), pixmap);
|
||||
const QRectF &rf = QRectF(rect());
|
||||
const QRectF &rfp = QRectF(pixmap.rect());
|
||||
painter.drawPixmap(rf.center() - rfp.center() / pixmap.devicePixelRatioF(), pixmap);
|
||||
}
|
||||
|
||||
const QPixmap PluginWidget::loadSvg(const QString &fileName, const QSize &size) const
|
||||
|
@ -171,7 +171,9 @@ void TrashWidget::paintEvent(QPaintEvent *e)
|
||||
|
||||
updateIcon();
|
||||
|
||||
painter.drawPixmap(rect().center() - m_icon.rect().center() / devicePixelRatioF(), m_icon);
|
||||
const QRectF &rf = QRectF(rect());
|
||||
const QRectF &rfp = QRectF(m_icon.rect());
|
||||
painter.drawPixmap(rf.center() - rfp.center() / devicePixelRatioF(), m_icon);
|
||||
}
|
||||
|
||||
void TrashWidget::resizeEvent(QResizeEvent *e)
|
||||
|
Loading…
x
Reference in New Issue
Block a user