Another futile attempt to keep whitespace consistent

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-06-03 16:48:59 -07:00
parent 3e46b4862a
commit 1fec6453a2
2 changed files with 28 additions and 22 deletions

View file

@ -21,7 +21,8 @@ DivePictureModel::DivePictureModel()
typedef QPair<QString, QImage> SPixmap; typedef QPair<QString, QImage> SPixmap;
typedef QList<SPixmap> SPixmapList; typedef QList<SPixmap> SPixmapList;
SPixmap scaleImages(const QString& s) { SPixmap scaleImages(const QString &s)
{
QImage p = QImage(s).scaled(128, 128, Qt::KeepAspectRatio); QImage p = QImage(s).scaled(128, 128, Qt::KeepAspectRatio);
SPixmap ret; SPixmap ret;
ret.first = s; ret.first = s;
@ -73,14 +74,19 @@ QVariant DivePictureModel::data(const QModelIndex &index, int role) const
QString key = stringPixmapCache.keys().at(index.row()); QString key = stringPixmapCache.keys().at(index.row());
if (index.column() == 0) { if (index.column() == 0) {
switch (role) { switch (role) {
case Qt::ToolTipRole : ret = key; break; case Qt::ToolTipRole:
case Qt::DecorationRole : ret = stringPixmapCache[key].image; break; ret = key;
case Qt::DisplayRole : ret = QFileInfo(key).fileName(); break;
case Qt::DecorationRole:
ret = stringPixmapCache[key].image;
break;
case Qt::DisplayRole:
ret = QFileInfo(key).fileName();
} }
} } else if (index.column() == 1) {
else if (index.column() == 1){
switch (role) { switch (role) {
case Qt::UserRole : ret = QVariant::fromValue( (void*) stringPixmapCache[key].picture); case Qt::UserRole:
ret = QVariant::fromValue((void *)stringPixmapCache[key].picture);
} }
} }
return ret; return ret;

View file

@ -20,6 +20,7 @@ public:
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
void updateDivePictures(int divenr); void updateDivePictures(int divenr);
private: private:
DivePictureModel(); DivePictureModel();
int numberOfPictures; int numberOfPictures;
@ -40,7 +41,6 @@ public:
}; };
class DivePictureThumbnailThread : public QThread { class DivePictureThumbnailThread : public QThread {
}; };
#endif #endif