diff --git a/src/model/danboorutablemodel.cpp b/src/model/danboorutablemodel.cpp index 0a43c08..7a7aedb 100644 --- a/src/model/danboorutablemodel.cpp +++ b/src/model/danboorutablemodel.cpp @@ -72,9 +72,13 @@ namespace Danbooru { return QVariant(); } - if (role == Qt::DisplayRole) { + DanbooruPost* post = m_posts.at(index.row()); - Danbooru::DanbooruPost* post = m_posts.at(index.row()); + if (!post) { + return QVariant(); + } + + if (role == Qt::DisplayRole) { QVariant variant; variant.setValue(post); @@ -83,11 +87,14 @@ namespace Danbooru { } if (role == Qt::DecorationRole) { - DanbooruPost* post = m_posts.at(index.row()); const QPixmap* pixmap = post->pixmap(); return *pixmap; } + if (role == Qt::ToolTipRole) { + return post->fileUrl().fileName(); + } + return QVariant(); }