Move models to lib (#6274)

* Move models to own library.

Took 35 minutes


Took 22 minutes

* Adjust CMakeLists

Took 20 seconds

* Reformat CMakeLists.

Took 2 minutes

* Revert "Reformat CMakeLists."

This reverts commit db5982ad1c.


Took 55 seconds

* Lint an include

Took 17 minutes

Took 9 seconds

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2025-11-05 18:33:40 +01:00 committed by GitHub
parent d914667238
commit adff828415
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
74 changed files with 127 additions and 105 deletions

View file

@ -0,0 +1,36 @@
/**
* @file card_search_model.h
* @ingroup CardDatabaseModels
* @brief TODO: Document this.
*/
#ifndef CARD_SEARCH_MODEL_H
#define CARD_SEARCH_MODEL_H
#include "../card_database_display_model.h"
#include <QAbstractListModel>
class CardSearchModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit CardSearchModel(CardDatabaseDisplayModel *sourceModel, QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
void updateSearchResults(const QString &query); // Update results based on input
private:
struct SearchResult
{
CardInfoPtr card;
int distance;
};
CardDatabaseDisplayModel *sourceModel;
QList<SearchResult> searchResults;
};
#endif // CARD_SEARCH_MODEL_H