aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/divepicturewidget.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-06-02 22:09:21 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-03 00:06:42 -0700
commitdbdff1c0afe958c00cae9344ba50fe31e43b243d (patch)
treef6ab983e25c3644d941eba7d1f76f1b7204aab1b /qt-ui/divepicturewidget.cpp
parent3595ad029408cae855dcf3d7fdbb03c1a02a6714 (diff)
downloadsubsurface-dbdff1c0afe958c00cae9344ba50fe31e43b243d.tar.gz
Change from QPixmap to QImage due to thread issues.
QPixmap cannot be accessed from outside the Main thread, but QImage can. so change that. Also, make the Photo widget display in Icon mode. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divepicturewidget.cpp')
-rw-r--r--qt-ui/divepicturewidget.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/qt-ui/divepicturewidget.cpp b/qt-ui/divepicturewidget.cpp
index 916345346..e5824e608 100644
--- a/qt-ui/divepicturewidget.cpp
+++ b/qt-ui/divepicturewidget.cpp
@@ -1,6 +1,7 @@
#include "divepicturewidget.h"
#include <dive.h>
#include <qtconcurrentmap.h>
+#include <qdir.h>
void DivePictureDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
@@ -11,11 +12,11 @@ DivePictureModel::DivePictureModel(QObject *parent): QAbstractTableModel(parent)
{
}
-typedef QPair<QString, QPixmap> SPixmap;
+typedef QPair<QString, QImage> SPixmap;
typedef QList<SPixmap> SPixmapList;
SPixmap scaleImages(const QString& s) {
- QPixmap p = QPixmap(s).scaled(128,128, Qt::KeepAspectRatio);
+ QImage p = QImage(s).scaled(128,128, Qt::KeepAspectRatio);
SPixmap ret;
ret.first = s;
ret.second = p;
@@ -63,8 +64,9 @@ QVariant DivePictureModel::data(const QModelIndex &index, int role) const
QString key = stringPixmapCache.keys().at(index.row());
switch(role){
- case Qt::DisplayRole : ret = key; break;
+ case Qt::ToolTipRole : ret = key; break;
case Qt::DecorationRole : ret = stringPixmapCache[key]; break;
+ case Qt::DisplayRole : ret = QFileInfo(key).fileName();
}
return ret;
}