diff options
author | Arno <am@disconnect.de> | 2010-10-16 14:08:16 +0200 |
---|---|---|
committer | Arno <am@disconnect.de> | 2010-10-16 14:08:16 +0200 |
commit | bf5ccbe56631ac516751a9f194b643f77fdedf82 (patch) | |
tree | f5a4227e7ad222c87197c529c29629ee17c3631f /hoverwindow.cpp | |
parent | f10a0a63e699288f1288c193c49795cae9cb3b40 (diff) | |
download | SheMov-bf5ccbe56631ac516751a9f194b643f77fdedf82.tar.gz SheMov-bf5ccbe56631ac516751a9f194b643f77fdedf82.tar.bz2 SheMov-bf5ccbe56631ac516751a9f194b643f77fdedf82.zip |
Hover for FilesTreeWidget
Hovering over a cover item in FilesTreeWidget shows a HoverWindow with
the scaled image under the cursor.
Diffstat (limited to 'hoverwindow.cpp')
-rw-r--r-- | hoverwindow.cpp | 14 |
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; } |