From a9318910a6d21747d7f8d85bdb08ec78611ca904 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Sun, 25 Sep 2022 19:05:48 -0400 Subject: Add sorting. --- qdeduper/imageitem.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'qdeduper/imageitem.cpp') diff --git a/qdeduper/imageitem.cpp b/qdeduper/imageitem.cpp index f53783a..cb1c76e 100644 --- a/qdeduper/imageitem.cpp +++ b/qdeduper/imageitem.cpp @@ -25,6 +25,7 @@ ImageItem::ImageItem(QString fn, QString dispn, QKeySequence hotkey, size_t dbid this->setData(pm, Qt::ItemDataRole::DecorationRole); this->setData(QVariant::fromValue(dbid), ImageItemRoles::database_id_role); this->setData(QVariant::fromValue(ord), ImageItemRoles::default_order_role); + this->setData(QVariant::fromValue(1ULL * pm.size().width() * pm.size().height()), ImageItemRoles::pixelcnt_role); } QString ImageItem::path() const @@ -47,6 +48,11 @@ QKeySequence ImageItem::hotkey() const return this->data(ImageItemRoles::hotkey_role).value(); } +void ImageItem::set_hotkey(QKeySequence hk) +{ + this->setData(hk, ImageItemRoles::hotkey_role); +} + void ImageItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { QRect imr = option.rect; -- cgit v1.2.3