Mercurial > minori
diff src/gui/widgets/poster.cpp @ 68:2417121d894e
*: normalize usage of layouts
before, I used them two ways, once was by setting the layout later
by using setLayout(QWidget), and the other was just using the constructor.
I find the constructor to be easier to read, so I chose that one.
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Mon, 02 Oct 2023 21:33:25 -0400 |
parents | 442065432549 |
children | d3e9310598b1 |
line wrap: on
line diff
--- a/src/gui/widgets/poster.cpp Mon Oct 02 07:06:44 2023 -0400 +++ b/src/gui/widgets/poster.cpp Mon Oct 02 21:33:25 2023 -0400 @@ -56,6 +56,7 @@ QPixmap pixmap = QPixmap::fromImage(img); label = new ClickableLabel(this); + label->setAlignment(Qt::AlignCenter); connect(label, &ClickableLabel::clicked, this, [anime]{ QDesktopServices::openUrl(Strings::ToQString(anime.GetServiceUrl())); }); @@ -63,7 +64,7 @@ } void Poster::resizeEvent(QResizeEvent*) { - QPixmap pixmap = QPixmap::fromImage(img).scaled(size(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); + QPixmap pixmap = QPixmap::fromImage(img).scaled(label->size(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation); label->setPixmap(pixmap); }