From 19674f64699ba883f24a97a04505ca2c7f12634e Mon Sep 17 00:00:00 2001 From: Arno Date: Sun, 17 Oct 2010 12:48:20 +0200 Subject: Implemented hovering in FilesystemWidget Hovering over dirs and pictures show either the content of the directory or a scaled image of the picture. This is a strange commit, though. When the archive was the last opened tab the program crashes when changing to FilesystemView. I don't have the slightest clue, why, so I simply removed setting the last opened tab on startup. Also there is some strange behavior regarding the position of the HoverWindow and what Qt thinks the global position is... --- hoverwindow.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'hoverwindow.cpp') diff --git a/hoverwindow.cpp b/hoverwindow.cpp index 100f278..7f2e4af 100644 --- a/hoverwindow.cpp +++ b/hoverwindow.cpp @@ -49,6 +49,24 @@ void HoverWindow::setPixmap(const QPixmap &pm){ mLabel->setPixmap(curPm); } +void HoverWindow::setData(const QList &data){ + if(data.isEmpty()){ + return; + } + if(data.at(0).canConvert(QVariant::Pixmap)){ + setPixmap(data.at(0).value()); + return; + } + if(data.size() != 2){ + return; + } + QStringList dataList = data.at(1).toStringList(); + if(dataList.isEmpty()){ + dataList << tr("<empty>"); + } + setContent(data.at(0).toString(), dataList); +} + int HoverWindow::pixmapHeight() const{ const QPixmap *pm = mLabel->pixmap(); return pm ? pm->height() : 0; -- cgit v1.2.3-70-g09d2