6#ifndef COCKATRICE_SETTINGS_SEARCH_MODEL_H
7#define COCKATRICE_SETTINGS_SEARCH_MODEL_H
9#include <QAbstractListModel>
14#include <QRegularExpression>
16#include <qnamespace.h>
17#include <qtmetamacros.h>
65 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
66 QVariant
data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const override;
Definition remote_connection_controller.h:20
bool isFilterActive() const
Whether a non-empty filter is currently active.
Definition settings_search_model.cpp:41
QList< SettingsSearchEntry > sourceEntries
Complete unfiltered entry list.
Definition settings_search_model.h:72
Roles
Custom data role for accessing the full entry.
Definition settings_search_model.h:52
@ EntryRole
Full SettingsSearchEntry object.
Definition settings_search_model.h:53
void setSourceEntries(const QList< SettingsSearchEntry > &entries)
Replaces the source entries and rebuilds the filter.
Definition settings_search_model.cpp:22
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Definition settings_search_model.cpp:125
QString filterQuery
Current filter query string.
Definition settings_search_model.h:75
SettingsSearchEntry entryForIndex(const QModelIndex &index) const
Returns the full entry for a given model index.
Definition settings_search_model.cpp:146
SettingsSearchModel(QObject *parent=nullptr)
Definition settings_search_model.cpp:18
void setFilterString(const QString &text)
Sets the filter string and recalculates the results.
Definition settings_search_model.cpp:30
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition settings_search_model.cpp:117
QRegularExpression filterRegex
Compiled regex for the current filter.
Definition settings_search_model.h:74
void rebuildFilter()
Recalculates the filtered index list and ranking.
Definition settings_search_model.cpp:87
QList< int > filteredIndices
Indices into sourceEntries matching the filter.
Definition settings_search_model.h:73
bool filterActive
Whether filtering is active.
Definition settings_search_model.h:76
Represents a single searchable setting entry.
Definition settings_search_model.h:29
QWidget * widget
Pointer to the setting widget for focus/scrolling.
Definition settings_search_model.h:34
QString groupTitle
Title of the group/section within the page.
Definition settings_search_model.h:31
int pageIndex
Index of the settings page this entry belongs to.
Definition settings_search_model.h:30
QString widgetLabel
Display label for the setting widget.
Definition settings_search_model.h:32
QString fullSearchText
Extended search text (label, control text, tooltip) for full-text matching.
Definition settings_search_model.h:33