Cockatrice 2026-09-01-Development-3.1.0-beta.10
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
ReversedCompleterModel Class Reference

A completer model that can present its rows bottom-to-top. More...

#include <reversed_completer_model.h>

Inheritance diagram for ReversedCompleterModel:
[legend]
Collaboration diagram for ReversedCompleterModel:
[legend]

Public Member Functions

void setSourceModel (QAbstractItemModel *sourceModel) override
void setEnabled (bool enabled)
QModelIndex mapToSource (const QModelIndex &proxyIndex) const override
QModelIndex mapFromSource (const QModelIndex &sourceIndex) const override
QModelIndex index (int row, int column, const QModelIndex &parent={}) const override
QModelIndex parent (const QModelIndex &) const override
int rowCount (const QModelIndex &parent={}) const override
int columnCount (const QModelIndex &parent={}) const override
QVariant data (const QModelIndex &proxyIndex, int role=Qt::DisplayRole) const override
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override

Private Member Functions

int sourceRowCount () const
void invalidate ()

Private Attributes

bool isEnabled = false

Detailed Description

A completer model that can present its rows bottom-to-top.

The original row order is kept intact in the source model (row 0 is always the closest match). When enabled, the proxy maps the source rows in reverse so the popup shows the closest match in the row nearest to the text edit. Any change in the source model is forwarded as a full reset, which is all QCompleter needs to rebuild its completion list.

Member Function Documentation

◆ columnCount()

int ReversedCompleterModel::columnCount ( const QModelIndex & parent = {}) const
override
Here is the call graph for this function:
Here is the caller graph for this function:

◆ data()

QVariant ReversedCompleterModel::data ( const QModelIndex & proxyIndex,
int role = Qt::DisplayRole ) const
override
Here is the call graph for this function:

◆ headerData()

QVariant ReversedCompleterModel::headerData ( int section,
Qt::Orientation orientation,
int role = Qt::DisplayRole ) const
override

◆ index()

QModelIndex ReversedCompleterModel::index ( int row,
int column,
const QModelIndex & parent = {} ) const
override
Here is the call graph for this function:
Here is the caller graph for this function:

◆ invalidate()

void ReversedCompleterModel::invalidate ( )
private
Here is the caller graph for this function:

◆ mapFromSource()

QModelIndex ReversedCompleterModel::mapFromSource ( const QModelIndex & sourceIndex) const
override
Here is the call graph for this function:

◆ mapToSource()

QModelIndex ReversedCompleterModel::mapToSource ( const QModelIndex & proxyIndex) const
override
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parent()

QModelIndex ReversedCompleterModel::parent ( const QModelIndex & ) const
override
Here is the caller graph for this function:

◆ rowCount()

int ReversedCompleterModel::rowCount ( const QModelIndex & parent = {}) const
override
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setEnabled()

void ReversedCompleterModel::setEnabled ( bool enabled)
Here is the call graph for this function:

◆ setSourceModel()

void ReversedCompleterModel::setSourceModel ( QAbstractItemModel * sourceModel)
override
Here is the call graph for this function:

◆ sourceRowCount()

int ReversedCompleterModel::sourceRowCount ( ) const
private
Here is the caller graph for this function:

Member Data Documentation

◆ isEnabled

bool ReversedCompleterModel::isEnabled = false
private

The documentation for this class was generated from the following files: