summaryrefslogtreecommitdiffstats
path: root/hoverwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'hoverwindow.cpp')
-rw-r--r--hoverwindow.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/hoverwindow.cpp b/hoverwindow.cpp
index 59c851e..8c5f227 100644
--- a/hoverwindow.cpp
+++ b/hoverwindow.cpp
@@ -37,5 +37,17 @@ void HoverWindow::setContent(const QString &parent, const QStringList &children)
}
void HoverWindow::setPixmap(const QPixmap &pm){
- mLabel->setPixmap(pm);
+ QPixmap curPm = pm;
+ if(curPm.height() > 500){
+ curPm = curPm.scaledToHeight(500);
+ }
+ if(curPm.width() > 300){
+ curPm = curPm.scaledToWidth(300);
+ }
+ mLabel->setPixmap(curPm);
+}
+
+int HoverWindow::pixmapHeight() const{
+ const QPixmap *pm = mLabel->pixmap();
+ return pm ? pm->height() : 0;
}