From bf5ccbe56631ac516751a9f194b643f77fdedf82 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 16 Oct 2010 14:08:16 +0200 Subject: Hover for FilesTreeWidget Hovering over a cover item in FilesTreeWidget shows a HoverWindow with the scaled image under the cursor. --- hoverwindow.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'hoverwindow.cpp') 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; } -- cgit v1.2.3-70-g09d2