Show marked files in file list bold

This commit is contained in:
2022-06-04 15:59:51 +02:00
parent dbb533176c
commit c8a70d22f8
3 changed files with 31 additions and 3 deletions
+19 -1
View File
@@ -3,6 +3,7 @@
#include <QDir>
#include "loadrunable.h"
#include "rawimage.h"
#include "database.h"
using namespace std;
@@ -97,9 +98,10 @@ void Image::thumbnailLoadFinish(void *rawImage)
emit thumbnailLoaded(this);
}
ImageRingList::ImageRingList(QObject *parent) : QAbstractItemModel(parent)
ImageRingList::ImageRingList(Database *database, QObject *parent) : QAbstractItemModel(parent)
, m_liveMode(false)
, m_analyzeLevel(None)
, m_database(database)
{
connect(&m_fileSystemWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(dirChanged(QString)));
m_thumbPool = new QThreadPool(this);
@@ -273,6 +275,15 @@ QStringList ImageRingList::imageNames() const
return ret;
}
void ImageRingList::updateMark()
{
if(m_images.size())
{
QModelIndex idx = index(m_currImage - m_images.begin(), 0);
emit dataChanged(idx, idx, {Qt::FontRole});
}
}
QModelIndex ImageRingList::index(int row, int column, const QModelIndex &parent) const
{
return createIndex(row, column, m_images.at(row).get());
@@ -305,6 +316,13 @@ QVariant ImageRingList::data(const QModelIndex &index, int role) const
QFileInfo info(m_images.at(index.row())->name());
return info.fileName();
}
case Qt::FontRole:
{
bool marked = m_database->isMarked(m_images.at(index.row())->name());
QFont font;
font.setBold(marked);
return font;
}
default:
return QVariant();
}