mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
fix: apps preview position error
Change-Id: Ibe1bdd5ec2d67ff09127b52a2a5864f8d83e1cf3
This commit is contained in:
parent
8d6ca47929
commit
14e1cd49ed
Notes:
gerrit
2018-09-11 10:15:28 +08:00
Verified+1: <jenkins@deepin.com> Code-Review+2: 张丁元 <lxz@ilxz.me> Submitted-by: 张丁元 <lxz@ilxz.me> Submitted-at: Tue, 11 Sep 2018 10:15:27 +0800 Reviewed-on: https://cr.deepin.io/38313 Project: dde/dde-dock Branch: refs/heads/master
@ -243,10 +243,8 @@ void AppSnapshot::paintEvent(QPaintEvent *e)
|
||||
// draw image
|
||||
const QImage &im = m_snapshot;
|
||||
|
||||
const QRect ir = im.rect();
|
||||
const qreal offset_x = r.x() + r.width() / 2.0 - ir.width() / ratio / 2 + m_snapshotSrcRect.x();
|
||||
const qreal offset_y = r.y() + r.height() / 2.0 - ir.height() / ratio / 2 + m_snapshotSrcRect.y();
|
||||
|
||||
const qreal offset_x = width() / 2.0 - m_snapshotSrcRect.width() / ratio / 2;
|
||||
const qreal offset_y = height() / 2.0 - m_snapshotSrcRect.height() / ratio / 2;
|
||||
painter.drawImage(QPointF(offset_x, offset_y), im, m_snapshotSrcRect);
|
||||
}
|
||||
|
||||
|
@ -85,12 +85,11 @@ void FloatingPreview::paintEvent(QPaintEvent *e)
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
const QRect r = rect().marginsRemoved(QMargins(8, 8, 8, 8));
|
||||
const QRectF r = rect().marginsRemoved(QMargins(8, 8, 8, 8));
|
||||
const auto ratio = devicePixelRatioF();
|
||||
|
||||
const QRect ir = snapshot.rect();
|
||||
const qreal offset_x = r.x() + r.width() / 2.0 - ir.width() / ratio / 2 + snapshot_geometry.x();
|
||||
const qreal offset_y = r.y() + r.height() / 2.0 - ir.height() / ratio / 2 + snapshot_geometry.y();
|
||||
const qreal offset_x = width() / 2.0 - snapshot_geometry.width() / ratio / 2;
|
||||
const qreal offset_y = height() / 2.0 - snapshot_geometry.height() / ratio / 2;
|
||||
const int radius = 4;
|
||||
|
||||
// draw background
|
||||
@ -98,14 +97,13 @@ void FloatingPreview::paintEvent(QPaintEvent *e)
|
||||
painter.setBrush(QColor(255, 255, 255, 255 * 0.3));
|
||||
painter.drawRoundedRect(r, radius, radius);
|
||||
|
||||
// draw preview image
|
||||
painter.drawImage(QPointF(offset_x, offset_y), snapshot, m_tracked->snapshotGeometry());
|
||||
|
||||
// bottom black background
|
||||
QRect bgr = r;
|
||||
QRectF bgr = r;
|
||||
bgr.setTop(bgr.bottom() - 25);
|
||||
|
||||
QRect bgre = bgr;
|
||||
QRectF bgre = bgr;
|
||||
bgre.setTop(bgr.top() - radius);
|
||||
|
||||
painter.save();
|
||||
|
Loading…
x
Reference in New Issue
Block a user