mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-14 19:18:55 -07:00
* 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>
36 lines
865 B
C++
36 lines
865 B
C++
/**
|
|
* @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
|