Mercurial > minori
diff src/gui/widgets/poster.cc @ 348:6b0768158dcd
text: redesign almost every widget
i.e. Paragraph is now a QLabel, etc etc, some things will probably
break, idc
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Tue, 25 Jun 2024 11:19:54 -0400 |
parents | b1f625b0227c |
children |
line wrap: on
line diff
--- a/src/gui/widgets/poster.cc Sun Jun 23 10:32:09 2024 -0400 +++ b/src/gui/widgets/poster.cc Tue Jun 25 11:19:54 2024 -0400 @@ -16,12 +16,14 @@ #include <QThread> #include <QUrl> +#include <iostream> + Poster::Poster(QWidget* parent) : QFrame(parent) { QHBoxLayout* layout = new QHBoxLayout(this); layout->setContentsMargins(1, 1, 1, 1); setCursor(Qt::PointingHandCursor); - setFixedSize(150, 225); + setFixedSize(150, 225); // FIXME need to kill this setFrameShape(QFrame::Box); setFrameShadow(QFrame::Plain); @@ -101,6 +103,22 @@ label_.setPixmap(pixmap.scaled(label_.size(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation)); } +bool Poster::hasHeightForWidth(void) const { + return true; +} + +int Poster::heightForWidth(int w) const { + return static_cast<int>(static_cast<double>(w) * 225 / 150); +} + void Poster::resizeEvent(QResizeEvent*) { RenderToLabel(); } + +QSize Poster::minimumSizeHint() const { + return QSize(120, heightForWidth(120)); +} + +QSize Poster::sizeHint() const { + return QSize(150, heightForWidth(150)); +}