KanoopGuiQt 1.3.0
Qt GUI utility library
Loading...
Searching...
No Matches
ListView Class Reference

QListView subclass that integrates with AbstractItemModel and adds UUID-based navigation. More...

#include <listview.h>

+ Inheritance diagram for ListView:
+ Collaboration diagram for ListView:

Signals

void currentSelectionChanged ()
 Emitted when the current selection changes.
 
void currentIndexChanged (const QModelIndex &index)
 Emitted when the current index changes.
 

Public Member Functions

 ListView (QWidget *parent=nullptr)
 Construct with an optional parent.
 
virtual void setModel (QAbstractItemModel *model) override
 Set the model, wrapping it in an internal sort/filter proxy.
 
virtual QModelIndex firstIndexOfEntityUuid (const QUuid &uuid) const
 Return the first index whose item UUID matches.
 
virtual QModelIndexList indexesOfUuid (const QUuid &uuid) const
 Return all indexes whose item UUID matches.
 
virtual void setCurrentUuid (const QUuid &uuid, ScrollHint scrollHint=EnsureVisible)
 Select the item with the given UUID and optionally scroll to it.
 
AbstractItemModelsourceModel () const
 Return the underlying AbstractItemModel (without the proxy).
 
QSortFilterProxyModel * proxyModel () const
 Return the internal sort/filter proxy model.
 

Detailed Description

QListView subclass that integrates with AbstractItemModel and adds UUID-based navigation.

ListView automatically wraps the source model in a QSortFilterProxyModel and provides helpers for locating and selecting items by UUID.

Definition at line 17 of file listview.h.

Constructor & Destructor Documentation

◆ ListView()

ListView::ListView ( QWidget *  parent = nullptr)
explicit

Construct with an optional parent.

Parameters
parentOptional QWidget parent

Member Function Documentation

◆ currentIndexChanged

void ListView::currentIndexChanged ( const QModelIndex &  index)
signal

Emitted when the current index changes.

Parameters
indexThe newly current index

◆ firstIndexOfEntityUuid()

virtual QModelIndex ListView::firstIndexOfEntityUuid ( const QUuid &  uuid) const
virtual

Return the first index whose item UUID matches.

Parameters
uuidUUID to search for
Returns
First matching index, or invalid index if not found

◆ indexesOfUuid()

virtual QModelIndexList ListView::indexesOfUuid ( const QUuid &  uuid) const
virtual

Return all indexes whose item UUID matches.

Parameters
uuidUUID to search for
Returns
List of matching indexes

◆ proxyModel()

QSortFilterProxyModel * ListView::proxyModel ( ) const
inline

Return the internal sort/filter proxy model.

Returns
Pointer to the proxy model

Definition at line 65 of file listview.h.

◆ setCurrentUuid()

virtual void ListView::setCurrentUuid ( const QUuid &  uuid,
ScrollHint  scrollHint = EnsureVisible 
)
virtual

Select the item with the given UUID and optionally scroll to it.

Parameters
uuidUUID of the item to select
scrollHintHow to scroll to make the item visible

◆ setModel()

virtual void ListView::setModel ( QAbstractItemModel *  model)
overridevirtual

Set the model, wrapping it in an internal sort/filter proxy.

Parameters
modelModel to display (should derive from AbstractItemModel)

◆ sourceModel()

AbstractItemModel * ListView::sourceModel ( ) const
inline

Return the underlying AbstractItemModel (without the proxy).

Returns
Pointer to the source model

Definition at line 59 of file listview.h.


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