From 777bf9f9f61c85bd560121ceb20bbffe9dbc0f1b Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Fri, 19 May 2023 22:05:14 +0200 Subject: Reimplement search for GridImageModel --- src/GridImagePackModel.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/GridImagePackModel.h') diff --git a/src/GridImagePackModel.h b/src/GridImagePackModel.h index 1345b103..06dfe734 100644 --- a/src/GridImagePackModel.h +++ b/src/GridImagePackModel.h @@ -5,11 +5,14 @@ #pragma once #include +#include #include #include #include +#include "CompletionProxyModel.h" + struct StickerImage { Q_GADGET @@ -41,6 +44,8 @@ public: class GridImagePackModel final : public QAbstractListModel { Q_OBJECT + Q_PROPERTY(QString searchString READ searchString WRITE setSearchString NOTIFY newSearchString) + public: enum Roles { @@ -53,6 +58,12 @@ public: int rowCount(const QModelIndex &parent = QModelIndex()) const override; QVariant data(const QModelIndex &index, int role) const override; + QString searchString() const { return searchString_; } + void setSearchString(QString newValue); + +signals: + void newSearchString(); + private: std::string room_id; @@ -69,4 +80,9 @@ private: std::vector packs; std::vector rowToPack; int columns = 3; + + QString searchString_; + trie> trie_; + std::vector> currentSearchResult; + std::vector rowToFirstRowEntryFromSearch; }; -- cgit 1.4.1