6#ifndef COCKATRICE_SETTINGS_SEARCH_MODEL_H
7#define COCKATRICE_SETTINGS_SEARCH_MODEL_H
9#include <QAbstractListModel>
11#include <QRegularExpression>
57 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
58 QVariant
data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const override;
bool isFilterActive() const
Whether a non-empty filter is currently active.
Definition settings_search_model.cpp:34
QList< SettingsSearchEntry > sourceEntries
Complete unfiltered entry list.
Definition settings_search_model.h:64
Roles
Custom data role for accessing the full entry.
Definition settings_search_model.h:44
@ EntryRole
Full SettingsSearchEntry object.
Definition settings_search_model.h:45
void setSourceEntries(const QList< SettingsSearchEntry > &entries)
Replaces the source entries and rebuilds the filter.
Definition settings_search_model.cpp:15
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Definition settings_search_model.cpp:118
QString filterQuery
Current filter query string.
Definition settings_search_model.h:67
SettingsSearchEntry entryForIndex(const QModelIndex &index) const
Returns the full entry for a given model index.
Definition settings_search_model.cpp:139
SettingsSearchModel(QObject *parent=nullptr)
Definition settings_search_model.cpp:11
void setFilterString(const QString &text)
Sets the filter string and recalculates the results.
Definition settings_search_model.cpp:23
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition settings_search_model.cpp:110
QRegularExpression filterRegex
Compiled regex for the current filter.
Definition settings_search_model.h:66
void rebuildFilter()
Recalculates the filtered index list and ranking.
Definition settings_search_model.cpp:80
QList< int > filteredIndices
Indices into sourceEntries matching the filter.
Definition settings_search_model.h:65
bool filterActive
Whether filtering is active.
Definition settings_search_model.h:68
Represents a single searchable setting entry.
Definition settings_search_model.h:21
QWidget * widget
Pointer to the setting widget for focus/scrolling.
Definition settings_search_model.h:26
QString groupTitle
Title of the group/section within the page.
Definition settings_search_model.h:23
int pageIndex
Index of the settings page this entry belongs to.
Definition settings_search_model.h:22
QString widgetLabel
Display label for the setting widget.
Definition settings_search_model.h:24
QString fullSearchText
Extended search text (label, control text, tooltip) for full-text matching.
Definition settings_search_model.h:25