summaryrefslogtreecommitdiff
path: root/src/getsuyomi.cpp
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2024-09-30 00:36:19 -0500
committerDominick Allen <djallen@librehumanitas.org>2024-09-30 00:36:19 -0500
commit6f2b61b676a16482fdac70a58a8e875c4d68e713 (patch)
treee2f8b2376847b5b13b278572c0fae8a6bc4d0e82 /src/getsuyomi.cpp
parentdacd752bbf46f2afb08b4b8d730ba3619528dda4 (diff)
Add configuration handling.
Diffstat (limited to 'src/getsuyomi.cpp')
-rw-r--r--src/getsuyomi.cpp16
1 files changed, 14 insertions, 2 deletions
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());
}
}