summaryrefslogtreecommitdiff
path: root/src/getsuyomi.cpp
diff options
context:
space:
mode:
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());
}
}