mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
This reverts commit a5c509981b.
This commit is contained in:
parent
231d0380a7
commit
d41aa30e10
1 changed files with 3 additions and 17 deletions
|
|
@ -149,29 +149,15 @@ void CardInfoPictureWidget::paintEvent(QPaintEvent *event)
|
||||||
loadPixmap();
|
loadPixmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap transformedPixmap = resizedPixmap; // Default pixmap
|
const QSize scaledSize = resizedPixmap.size().scaled(size(), Qt::KeepAspectRatio);
|
||||||
if (info && info->getLandscapeOrientation()) {
|
const QPoint topLeft{(width() - scaledSize.width()) / 2, (height() - scaledSize.height()) / 2};
|
||||||
// Rotate pixmap 90 degrees to the left
|
|
||||||
QTransform transform;
|
|
||||||
transform.rotate(90);
|
|
||||||
transformedPixmap = resizedPixmap.transformed(transform, Qt::SmoothTransformation);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adjust scaling after rotation
|
|
||||||
const QSize availableSize = size(); // Size of the widget
|
|
||||||
const QSize pixmapSize = transformedPixmap.size();
|
|
||||||
const QSize scaledSize = pixmapSize.scaled(availableSize, Qt::KeepAspectRatio);
|
|
||||||
|
|
||||||
const QPoint topLeft{(availableSize.width() - scaledSize.width()) / 2,
|
|
||||||
(availableSize.height() - scaledSize.height()) / 2};
|
|
||||||
const qreal radius = 0.05 * scaledSize.width();
|
const qreal radius = 0.05 * scaledSize.width();
|
||||||
|
|
||||||
QStylePainter painter(this);
|
QStylePainter painter(this);
|
||||||
QPainterPath shape;
|
QPainterPath shape;
|
||||||
shape.addRoundedRect(QRect(topLeft, scaledSize), radius, radius);
|
shape.addRoundedRect(QRect(topLeft, scaledSize), radius, radius);
|
||||||
painter.setClipPath(shape);
|
painter.setClipPath(shape);
|
||||||
painter.drawItemPixmap(QRect(topLeft, scaledSize), Qt::AlignCenter,
|
painter.drawItemPixmap(QRect(topLeft, scaledSize), Qt::AlignCenter, resizedPixmap);
|
||||||
transformedPixmap.scaled(scaledSize, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue