VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtRecursiveFileModel Class Reference

Detailed Description

DtRecursiveFileModel is a Qt model class that provides a list of files to QML list views. It manages a collection of file entries and exposes them through the Qt model-view framework, making them accessible to the UI.

#include <vreStartPage.h>

Inheritance diagram for makVre::DtRecursiveFileModel:
[legend]

Public Types

enum  FileModelRoles { FileNameRole = Qt::UserRole + 1 , FilePathRole }
 

Public Member Functions

 DtRecursiveFileModel (QObject *parent=0)
 
virtual void addFile (const DtFileEntry &entry)
 
virtual void clear ()
 
virtual void sort (int column, Qt::SortOrder order=Qt::AscendingOrder) override
 
virtual bool removeRows (int row, int column=0, const QModelIndex &parent=QModelIndex()) override
 
virtual int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
virtual QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
virtual bool setData (const QModelIndex &index, const QVariant &value, int role) override
 

Protected Member Functions

virtual QHash< int, QByteArray > roleNames () const override
 

Protected Attributes

QList< DtFileEntrymyFiles
 

Member Enumeration Documentation

◆ FileModelRoles

Enumeration of data roles for the model.

Defines the custom roles used to access different aspects of the file entries.

Enumerator
FileNameRole 

Role for accessing the file name.

FilePathRole 

Role for accessing the file path.

Constructor & Destructor Documentation

◆ DtRecursiveFileModel()

makVre::DtRecursiveFileModel::DtRecursiveFileModel ( QObject * parent = 0)

Constructor.

Parameters
parentOptional parent QObject for memory management

Creates a new empty file model.

Member Function Documentation

◆ addFile()

virtual void makVre::DtRecursiveFileModel::addFile ( const DtFileEntry & entry)
virtual

Adds a file entry to the model.

Parameters
entryFile entry to add

Adds a new file entry to the end of the model's file list.

◆ clear()

virtual void makVre::DtRecursiveFileModel::clear ( )
virtual

Clears all file entries from the model.

Removes all file entries from the model, leaving it empty.

◆ sort()

virtual void makVre::DtRecursiveFileModel::sort ( int column,
Qt::SortOrder order = Qt::AscendingOrder )
overridevirtual

Sorts the file entries.

Parameters
columnColumn index to sort by (ignored in this implementation)
orderSort order (ascending or descending)

Sorts the file entries case-insensitively using QCollator. This ensures proper alphabetical sorting regardless of locale.

◆ removeRows()

virtual bool makVre::DtRecursiveFileModel::removeRows ( int row,
int column = 0,
const QModelIndex & parent = QModelIndex() )
overridevirtual

Removes rows from the model.

Parameters
rowStarting row index
columnNumber of columns to remove (ignored in this implementation)
parentParent model index (ignored in this implementation)
Returns
True if rows were successfully removed

Implementation of QAbstractItemModel::removeRows for removing file entries.

◆ rowCount()

virtual int makVre::DtRecursiveFileModel::rowCount ( const QModelIndex & parent = QModelIndex()) const
overridevirtual

Gets the number of rows in the model.

Parameters
parentParent model index (ignored in this implementation)
Returns
Number of file entries in the model

Implementation of QAbstractItemModel::rowCount that returns the number of file entries.

◆ data()

virtual QVariant makVre::DtRecursiveFileModel::data ( const QModelIndex & index,
int role = Qt::DisplayRole ) const
overridevirtual

Gets data for a specific index and role.

Parameters
indexModel index to get data for
roleData role to retrieve
Returns
Requested data as a QVariant

Implementation of QAbstractItemModel::data that provides access to file entry data.

◆ setData()

virtual bool makVre::DtRecursiveFileModel::setData ( const QModelIndex & index,
const QVariant & value,
int role )
overridevirtual

Sets data for a specific index and role.

Parameters
indexModel index to set data for
valueNew value to set
roleData role to set
Returns
True if data was successfully set

Implementation of QAbstractItemModel::setData for updating file entry data.

◆ roleNames()

virtual QHash< int, QByteArray > makVre::DtRecursiveFileModel::roleNames ( ) const
overrideprotectedvirtual

Gets the mapping from role IDs to role names.

Returns
Hash mapping role IDs to their name strings

Implementation of QAbstractItemModel::roleNames that provides the mapping from role enum values to the string names used in QML.

Member Data Documentation

◆ myFiles

QList<DtFileEntry> makVre::DtRecursiveFileModel::myFiles
protected

List of file entries in the model.

Storage for all the file entries managed by this model.


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