From 6f2b61b676a16482fdac70a58a8e875c4d68e713 Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Mon, 30 Sep 2024 00:36:19 -0500 Subject: Add configuration handling. --- src/getsuyomi.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/getsuyomi.cpp') diff --git a/src/getsuyomi.cpp b/src/getsuyomi.cpp index 0472496..4e0dad7 100644 --- a/src/getsuyomi.cpp +++ b/src/getsuyomi.cpp @@ -6,7 +6,7 @@ namespace getsuyomi { -Getsuyomi::Getsuyomi() +Getsuyomi::Getsuyomi(QWidget* parent) : QWidget(parent) { // m_pageLeft.setContentsMargins(0, 1, 0, 1); // m_pageRight.setContentsMargins(0, 1, 0, 1); @@ -104,7 +104,19 @@ void Getsuyomi::setPagesNormal() auto& label1 = m_pageLeft; if (page1.isOkay()) { - label1.setPixmap(QPixmap::fromImage(page1.getOkay())); + auto pixmap = QPixmap::fromImage(page1.getOkay()); + auto pixmapHeight = pixmap.height(); + auto widgetHeight = height(); + if (pixmapHeight < widgetHeight) + { + // do nothing + label1.setPixmap(pixmap); + } + else + { + label1.setPixmap(pixmap.scaledToHeight(widgetHeight)); + } + label1.resize(label1.pixmap().size()); } } -- cgit v1.2.3