Skip to content

Class LocalFilesModel

ClassList > LocalFilesModel

Inherits the following classes: QAbstractListModel

Public Types

Type Name
enum ItemMetaType
enum ItemType
enum Role

Public Properties

Type Name
property int currentDepth
property QString currentPath
property QString currentTitle
property bool inSelectionMode
property bool isDeletedAllowedInCurrentPath

Public Signals

Type Name
signal void currentPathChanged
signal void inSelectionModeChanged

Public Functions

Type Name
LocalFilesModel (QObject * parent=nullptr)
Q_INVOKABLE void addToFavorites (const QString & path)
Adds the path to the favorites list.
Q_INVOKABLE void clearSelection ()
Set checked state of all items to false.
int currentDepth () const
Returns the current navigation history depth.
QString currentPath () const
Returns the current path.
QString currentTitle () const
Returns the current title derived from the current path.
QVariant data (const QModelIndex & index, int role) override const
Q_INVOKABLE LocalFileItem get (int index) const
Returns the LocalFileItem at the given__index .
bool inSelectionMode ()
Returns whether list is in multi-selection mode or not.
bool isDeletedAllowedInCurrentPath () const
Q_INVOKABLE bool isPathFavoriteEditable (const QString & path)
Returns whether path's favorite state is editable.
Q_INVOKABLE void moveUp ()
Walks the navigation history back up on step.
Q_INVOKABLE void removeFromFavorites (const QString & path)
Removes the path to the favorites list.
Q_INVOKABLE void resetToPath (const QString & path)
Resets the model and sets the first navigation history item to the provided path .
Q_INVOKABLE void resetToRoot ()
Resets the model and sets the first navigation history item to root.
QHash< int, QByteArray > roleNames () override const
int rowCount (const QModelIndex & parent) override const
Q_INVOKABLE void setChecked (const int & mIdx, const bool & checked)
Set checked state of an item in list.
void setCurrentPath (const QString & path)
Appends the provided path to the navigation history.

Public Types Documentation

enum ItemMetaType

enum LocalFilesModel::ItemMetaType {
    Favorite,
    Folder,
    File,
    Project,
    Dataset
};

enum ItemType

enum LocalFilesModel::ItemType {
    ApplicationFolder,
    ExternalStorage,
    SimpleFolder,
    ProjectFile,
    VectorDataset,
    RasterDataset,
    OtherFile
};

enum Role

enum LocalFilesModel::Role {
    ItemMetaTypeRole = Qt::UserRole,
    ItemTypeRole,
    ItemTitleRole,
    ItemFormatRole,
    ItemPathRole,
    ItemSizeRole,
    ItemHasThumbnailRole,
    ItemIsFavoriteRole,
    ItemHasWebdavConfigurationRole,
    ItemCheckedRole
};

Public Properties Documentation

property currentDepth [1/2]

int LocalFilesModel::currentDepth;

property currentPath [1/2]

QString LocalFilesModel::currentPath;

property currentTitle [1/2]

QString LocalFilesModel::currentTitle;

property inSelectionMode [1/2]

bool LocalFilesModel::inSelectionMode;

property isDeletedAllowedInCurrentPath [1/2]

bool LocalFilesModel::isDeletedAllowedInCurrentPath;

Public Signals Documentation

signal currentPathChanged

void LocalFilesModel::currentPathChanged;

signal inSelectionModeChanged

void LocalFilesModel::inSelectionModeChanged;

Public Functions Documentation

function LocalFilesModel

explicit LocalFilesModel::LocalFilesModel (
    QObject * parent=nullptr
) 

function addToFavorites

Adds the path to the favorites list.

Q_INVOKABLE void LocalFilesModel::addToFavorites (
    const QString & path
) 

function clearSelection

Set checked state of all items to false.

Q_INVOKABLE void LocalFilesModel::clearSelection () 

function currentDepth [2/2]

Returns the current navigation history depth.

inline int LocalFilesModel::currentDepth () const

function currentPath [2/2]

Returns the current path.

QString LocalFilesModel::currentPath () const

function currentTitle [2/2]

Returns the current title derived from the current path.

QString LocalFilesModel::currentTitle () const

function data

QVariant LocalFilesModel::data (
    const QModelIndex & index,
    int role
) override const

function get

Returns the LocalFileItem at the given__index .

Q_INVOKABLE LocalFileItem LocalFilesModel::get (
    int index
) const

function inSelectionMode [2/2]

Returns whether list is in multi-selection mode or not.

bool LocalFilesModel::inSelectionMode () 

function isDeletedAllowedInCurrentPath [2/2]

bool LocalFilesModel::isDeletedAllowedInCurrentPath () const

Returns TRUE if deletation of files and folders is allow in the current path

Note:

Currently, deletion is only allowed when the path is a sub-child of an application directory


function isPathFavoriteEditable

Returns whether path's favorite state is editable.

Q_INVOKABLE bool LocalFilesModel::isPathFavoriteEditable (
    const QString & path
) 

function moveUp

Walks the navigation history back up on step.

Q_INVOKABLE void LocalFilesModel::moveUp () 

function removeFromFavorites

Removes the path to the favorites list.

Q_INVOKABLE void LocalFilesModel::removeFromFavorites (
    const QString & path
) 

function resetToPath

Resets the model and sets the first navigation history item to the provided path .

Q_INVOKABLE void LocalFilesModel::resetToPath (
    const QString & path
) 

function resetToRoot

Resets the model and sets the first navigation history item to root.

Q_INVOKABLE void LocalFilesModel::resetToRoot () 

function roleNames

QHash< int, QByteArray > LocalFilesModel::roleNames () override const

function rowCount

int LocalFilesModel::rowCount (
    const QModelIndex & parent
) override const

function setChecked

Set checked state of an item in list.

Q_INVOKABLE void LocalFilesModel::setChecked (
    const int & mIdx,
    const bool & checked
) 

function setCurrentPath

Appends the provided path to the navigation history.

void LocalFilesModel::setCurrentPath (
    const QString & path
) 


The documentation for this class was generated from the following file src/core/localfilesmodel.h