KDirModel

Search for usage in LXR

#include <KDirModel>

Inheritance diagram for KDirModel:

Public Types

enum  { ChildCountUnknown = -1 }
 
enum  AdditionalRoles { FileItemRole = 0x07A263FF, ChildCountRole = 0x2C4D0A40, HasJobRole = 0x01E555A5 }
 
typedef QFlags< DropsAllowedFlagDropsAllowed
 
enum  DropsAllowedFlag { NoDrops = 0, DropOnDirectory = 1, DropOnAnyFile = 2, DropOnLocalExecutable = 4 }
 
enum  ModelColumns {
  Name = 0, Size, ModifiedTime, Permissions,
  Owner, Group, Type, ColumnCount
}
 
enum  OpenUrlFlag { NoFlags = 0x0, Reload = 0x1, ShowRoot = 0x2 }
 
typedef QFlags< OpenUrlFlagOpenUrlFlags
 
- Public Types inherited from QAbstractItemModel
enum  CheckIndexOption
 
enum  LayoutChangeHint
 

Signals

void expand (const QModelIndex &index)
 
void needSequenceIcon (const QModelIndex &index, int sequenceIndex)
 

Public Member Functions

 KDirModel (QObject *parent=nullptr)
 
bool canFetchMore (const QModelIndex &parent) const override
 
Q_INVOKABLE void clearAllPreviews ()
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
KDirListerdirLister () const
 
bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
 
Q_INVOKABLE void expandToUrl (const QUrl &url)
 
void fetchMore (const QModelIndex &parent) override
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 
bool hasChildren (const QModelIndex &parent=QModelIndex()) const override
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const override
 
Q_INVOKABLE QModelIndex indexForItem (const KFileItem &) const
 
QModelIndex indexForItem (const KFileItem *) const
 
Q_INVOKABLE QModelIndex indexForUrl (const QUrl &url) const
 
Q_INVOKABLE void itemChanged (const QModelIndex &index)
 
KFileItem itemForIndex (const QModelIndex &index) const
 
bool jobTransfersVisible () const
 
QMimeDatamimeData (const QModelIndexList &indexes) const override
 
QStringList mimeTypes () const override
 
Q_INVOKABLE void openUrl (const QUrl &url, OpenUrlFlags flags=NoFlags)
 
QModelIndex parent (const QModelIndex &index) const override
 
void requestSequenceIcon (const QModelIndex &index, int sequenceIndex)
 
QHash< int, QByteArrayroleNames () const override
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 
void setDirLister (KDirLister *dirLister)
 
Q_INVOKABLE void setDropsAllowed (DropsAllowed dropsAllowed)
 
void setJobTransfersVisible (bool show)
 
QModelIndex sibling (int row, int column, const QModelIndex &index) const override
 
void sort (int column, Qt::SortOrder order=Qt::AscendingOrder) override
 
Qt::DropActions supportedDropActions () const override
 
- Public Member Functions inherited from QAbstractItemModel
 QAbstractItemModel (QObject *parent)
 
virtual QModelIndex buddy (const QModelIndex &index) const const
 
virtual bool canDropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const const
 
bool checkIndex (const QModelIndex &index, QAbstractItemModel::CheckIndexOptions options) const const
 
void columnsAboutToBeInserted (const QModelIndex &parent, int first, int last)
 
void columnsAboutToBeMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn)
 
void columnsAboutToBeRemoved (const QModelIndex &parent, int first, int last)
 
void columnsInserted (const QModelIndex &parent, int first, int last)
 
void columnsMoved (const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column)
 
void columnsRemoved (const QModelIndex &parent, int first, int last)
 
void dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles)
 
bool hasIndex (int row, int column, const QModelIndex &parent) const const
 
void headerDataChanged (Qt::Orientation orientation, int first, int last)
 
bool insertColumn (int column, const QModelIndex &parent)
 
bool insertRow (int row, const QModelIndex &parent)
 
virtual QMap< int, QVariantitemData (const QModelIndex &index) const const
 
void layoutAboutToBeChanged (const QList< QPersistentModelIndex > &parents, QAbstractItemModel::LayoutChangeHint hint)
 
void layoutChanged (const QList< QPersistentModelIndex > &parents, QAbstractItemModel::LayoutChangeHint hint)
 
virtual QModelIndexList match (const QModelIndex &start, int role, const QVariant &value, int hits, Qt::MatchFlags flags) const const
 
void modelAboutToBeReset ()
 
void modelReset ()
 
bool moveColumn (const QModelIndex &sourceParent, int sourceColumn, const QModelIndex &destinationParent, int destinationChild)
 
virtual bool moveColumns (const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild)
 
bool moveRow (const QModelIndex &sourceParent, int sourceRow, const QModelIndex &destinationParent, int destinationChild)
 
virtual bool moveRows (const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild)
 
bool removeColumn (int column, const QModelIndex &parent)
 
bool removeRow (int row, const QModelIndex &parent)
 
virtual void revert ()
 
void rowsAboutToBeInserted (const QModelIndex &parent, int start, int end)
 
void rowsAboutToBeMoved (const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow)
 
void rowsAboutToBeRemoved (const QModelIndex &parent, int first, int last)
 
void rowsInserted (const QModelIndex &parent, int first, int last)
 
void rowsMoved (const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row)
 
void rowsRemoved (const QModelIndex &parent, int first, int last)
 
virtual bool setHeaderData (int section, Qt::Orientation orientation, const QVariant &value, int role)
 
virtual bool setItemData (const QModelIndex &index, const QMap< int, QVariant > &roles)
 
void setSupportedDragActions (Qt::DropActions actions)
 
virtual QSize span (const QModelIndex &index) const const
 
virtual bool submit ()
 
virtual Qt::DropActions supportedDragActions () const const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Static Public Member Functions

static QList< QUrlsimplifiedUrlList (const QList< QUrl > &urls)
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Public Attributes inherited from QAbstractItemModel
typedef CheckIndexOptions
 
 DoNotUseParent
 
 HorizontalSortHint
 
 IndexIsValid
 
 NoLayoutChangeHint
 
 NoOption
 
 ParentIsInvalid
 
 VerticalSortHint
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from QAbstractItemModel
void beginInsertColumns (const QModelIndex &parent, int first, int last)
 
void beginInsertRows (const QModelIndex &parent, int first, int last)
 
bool beginMoveColumns (const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild)
 
bool beginMoveRows (const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild)
 
void beginRemoveColumns (const QModelIndex &parent, int first, int last)
 
void beginRemoveRows (const QModelIndex &parent, int first, int last)
 
void beginResetModel ()
 
void changePersistentIndex (const QModelIndex &from, const QModelIndex &to)
 
void changePersistentIndexList (const QModelIndexList &from, const QModelIndexList &to)
 
QModelIndex createIndex (int row, int column, quintptr id) const const
 
QModelIndex createIndex (int row, int column, void *ptr) const const
 
void endInsertColumns ()
 
void endInsertRows ()
 
void endMoveColumns ()
 
void endMoveRows ()
 
void endRemoveColumns ()
 
void endRemoveRows ()
 
void endResetModel ()
 
QModelIndexList persistentIndexList () const const
 
void reset ()
 
void resetInternalData ()
 
void setRoleNames (const QHash< int, QByteArray > &roleNames)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

A model for a KIO-based directory tree.

KDirModel implements the QAbstractItemModel interface (for use with Qt's model/view widgets) around the directory listing for one directory or a tree of directories.

Note that there are some cases when using QPersistentModelIndexes from this model will not give expected results. QPersistentIndexes will remain valid and updated if its siblings are added or removed. However, if the QPersistentIndex or one of its ancestors is moved, the QPersistentIndex will become invalid. For example, if a file or directory is renamed after storing a QPersistentModelIndex for it, the index (along with any stored children) will become invalid even though it is still in the model. The reason for this is that moves of files and directories are treated as separate insert and remove actions.

See also
KDirSortFilterProxyModel
Author
David Faure Based on work by Hamish Rodda and Pascal Letourneau

Definition at line 41 of file kdirmodel.h.

Member Typedef Documentation

◆ DropsAllowed

Stores a combination of DropsAllowedFlag values.

Definition at line 184 of file kdirmodel.h.

◆ OpenUrlFlags

Stores a combination of OpenUrlFlag values.

Definition at line 68 of file kdirmodel.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Possible return value for data(ChildCountRole), meaning the item isn't a directory, or we haven't calculated its child count yet.

Definition at line 162 of file kdirmodel.h.

◆ AdditionalRoles

Enumerator
FileItemRole 

returns the KFileItem for a given index. roleName is "fileItem".

ChildCountRole 

returns the number of items in a directory, or ChildCountUnknown. roleName is "childCount".

HasJobRole 

returns whether or not there is a job on an item (file/directory). roleName is "hasJob".

Definition at line 164 of file kdirmodel.h.

◆ DropsAllowedFlag

See also
DropsAllowed
Enumerator
DropOnDirectory 

allow drops on any directory

DropOnAnyFile 

allow drops on any file

DropOnLocalExecutable 

allow drops on local executables, shell scripts and desktop files. Can be used with DropOnDirectory.

Definition at line 175 of file kdirmodel.h.

◆ ModelColumns

Useful "default" columns.

Views can use a proxy to have more control over this.

Definition at line 149 of file kdirmodel.h.

◆ OpenUrlFlag

Flags for the openUrl() method.

See also
OpenUrlFlags
Since
5.69
Enumerator
NoFlags 

No additional flags specified.

Reload 

Indicates whether to use the cache or to reread the directory from the disk.

Use only when opening a dir not yet listed by our dirLister() without using the cache. Otherwise use dirLister()->updateDirectory().

ShowRoot 

Display a root node for the URL being opened.

Definition at line 57 of file kdirmodel.h.

Constructor & Destructor Documentation

◆ KDirModel()

KDirModel::KDirModel ( QObject parent = nullptr)
explicit
Parameters
parentparent qobject

Definition at line 420 of file kdirmodel.cpp.

Member Function Documentation

◆ canFetchMore()

bool KDirModel::canFetchMore ( const QModelIndex parent) const
overridevirtual

Reimplemented from QAbstractItemModel. Returns true for empty directories.

Reimplemented from QAbstractItemModel.

Definition at line 1307 of file kdirmodel.cpp.

◆ clearAllPreviews()

void KDirModel::clearAllPreviews ( )

Forget all previews (optimization for turning previews off).

The items will again have their default appearance (not controlled by the model).

Since
5.28

Definition at line 799 of file kdirmodel.cpp.

◆ columnCount()

int KDirModel::columnCount ( const QModelIndex parent = QModelIndex()) const
overridevirtual

Reimplemented from QAbstractItemModel. Returns ColumnCount.

Implements QAbstractItemModel.

Definition at line 818 of file kdirmodel.cpp.

◆ data()

QVariant KDirModel::data ( const QModelIndex index,
int  role = Qt::DisplayRole 
) const
overridevirtual

Reimplemented from QAbstractItemModel.

Implements QAbstractItemModel.

Definition at line 823 of file kdirmodel.cpp.

◆ dirLister()

KDirLister * KDirModel::dirLister ( ) const

Return the directory lister used by this model.

Definition at line 491 of file kdirmodel.cpp.

◆ dropMimeData()

bool KDirModel::dropMimeData ( const QMimeData data,
Qt::DropAction  action,
int  row,
int  column,
const QModelIndex parent 
)
overridevirtual

Reimplemented from QAbstractItemModel. Not implemented yet.

Reimplemented from QAbstractItemModel.

Definition at line 1346 of file kdirmodel.cpp.

◆ expand

void KDirModel::expand ( const QModelIndex index)
signal

Emitted for each subdirectory that is a parent of a url passed to expandToUrl This allows to asynchronously open a tree view down to a given directory.

Also emitted for the final file, if expandToUrl is called with a file (for instance so that it can be selected).

◆ expandToUrl()

void KDirModel::expandToUrl ( const QUrl url)

Lists subdirectories using fetchMore() as needed until the given url exists in the model.

When the model is used by a treeview, call KDirLister::openUrl with the base url of the tree, then the treeview will take care of calling fetchMore() when the user opens directories. However if you want the tree to show a given URL (i.e. open the tree recursively until that URL), call expandToUrl(). Note that this is asynchronous; the necessary listing of subdirectories will take time so the model will not immediately have this url available. The model emits the signal expand() when an index has become available; this can be connected to the treeview in order to let it open that index.

Parameters
urlthe url of a subdirectory of the directory model (or a file in a subdirectory)

Definition at line 1363 of file kdirmodel.cpp.

◆ fetchMore()

void KDirModel::fetchMore ( const QModelIndex parent)
overridevirtual

Reimplemented from QAbstractItemModel. Lists the subdirectory.

Reimplemented from QAbstractItemModel.

Definition at line 1323 of file kdirmodel.cpp.

◆ flags()

Qt::ItemFlags KDirModel::flags ( const QModelIndex index) const
overridevirtual

Reimplemented from QAbstractItemModel.

Reimplemented from QAbstractItemModel.

Definition at line 1261 of file kdirmodel.cpp.

◆ hasChildren()

bool KDirModel::hasChildren ( const QModelIndex parent = QModelIndex()) const
overridevirtual

Reimplemented from QAbstractItemModel. Returns true for directories.

Reimplemented from QAbstractItemModel.

Definition at line 1226 of file kdirmodel.cpp.

◆ headerData()

QVariant KDirModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
overridevirtual

Reimplemented from QAbstractItemModel. Returns the column titles.

Reimplemented from QAbstractItemModel.

Definition at line 1200 of file kdirmodel.cpp.

◆ index()

QModelIndex KDirModel::index ( int  row,
int  column,
const QModelIndex parent = QModelIndex() 
) const
overridevirtual

Reimplemented from QAbstractItemModel. O(1)

Implements QAbstractItemModel.

Definition at line 1187 of file kdirmodel.cpp.

◆ indexForItem() [1/2]

QModelIndex KDirModel::indexForItem ( const KFileItem item) const

Return the index for a given kfileitem.

This can be slow.

Definition at line 1171 of file kdirmodel.cpp.

◆ indexForItem() [2/2]

QModelIndex KDirModel::indexForItem ( const KFileItem item) const

Return the index for a given kfileitem.

This can be slow.

Deprecated:
Since 4.0, use the method that takes a KFileItem by value

Definition at line 1163 of file kdirmodel.cpp.

◆ indexForUrl()

QModelIndex KDirModel::indexForUrl ( const QUrl url) const

Return the index for a given url.

This can be slow.

Definition at line 1177 of file kdirmodel.cpp.

◆ itemChanged()

void KDirModel::itemChanged ( const QModelIndex index)

Notify the model that the item at this index has changed.

For instance because KMimeTypeResolver called determineMimeType on it. This makes the model emit its dataChanged signal at this index, so that views repaint. Note that for most things (renaming, changing size etc.), KDirLister's signals tell the model already.

Definition at line 804 of file kdirmodel.cpp.

◆ itemForIndex()

KFileItem KDirModel::itemForIndex ( const QModelIndex index) const

Return the fileitem for a given index.

This is O(1), i.e. fast.

Definition at line 1150 of file kdirmodel.cpp.

◆ jobTransfersVisible()

bool KDirModel::jobTransfersVisible ( ) const

Returns whether or not displaying job transfers has been enabled.

Since
4.5

Definition at line 1081 of file kdirmodel.cpp.

◆ mimeData()

QMimeData * KDirModel::mimeData ( const QModelIndexList &  indexes) const
overridevirtual

Reimplemented from QAbstractItemModel.

Reimplemented from QAbstractItemModel.

Definition at line 1120 of file kdirmodel.cpp.

◆ mimeTypes()

QStringList KDirModel::mimeTypes ( ) const
overridevirtual

Reimplemented from QAbstractItemModel.

Reimplemented from QAbstractItemModel.

Definition at line 1115 of file kdirmodel.cpp.

◆ needSequenceIcon

void KDirModel::needSequenceIcon ( const QModelIndex index,
int  sequenceIndex 
)
signal

Emitted when another icon sequence index is requested.

Parameters
indexIndex of the item that should get another icon
sequenceIndexIndex in the sequence. If it is zero, the standard icon should be assigned. For higher indices, arbitrary different meaningful icons should be generated. This is usually slowly counted up while the user hovers the icon. If no meaningful alternative icons can be generated, this should be ignored.
Since
4.3

◆ openUrl()

void KDirModel::openUrl ( const QUrl url,
OpenUrlFlags  flags = NoFlags 
)

Display the contents of url in the model.

Apart from the support for the ShowRoot flag, this is equivalent to dirLister()->openUrl(url, flags)

Parameters
urlthe URL of the directory whose contents should be listed. Unless ShowRoot is set, the item for this directory will NOT be shown, the model starts at its children.
flagssee OpenUrlFlag
Since
5.69

Definition at line 457 of file kdirmodel.cpp.

◆ parent()

QModelIndex KDirModel::parent ( const QModelIndex index) const
overridevirtual

Reimplemented from QAbstractItemModel.

Implements QAbstractItemModel.

Definition at line 1027 of file kdirmodel.cpp.

◆ requestSequenceIcon()

void KDirModel::requestSequenceIcon ( const QModelIndex index,
int  sequenceIndex 
)

This emits the needSequenceIcon signal, requesting another sequence icon.

If there is a KFilePreviewGenerator attached to this model, that generator will care about creating another preview.

Parameters
indexIndex of the item that should get another icon
sequenceIndexIndex in the sequence. If it is zero, the standard icon will be assigned. For higher indices, arbitrary different meaningful icons will be generated.
Since
4.3

Definition at line 1058 of file kdirmodel.cpp.

◆ roleNames()

QHash< int, QByteArray > KDirModel::roleNames ( ) const
overridevirtual

Reimplemented from QAbstractItemModel.

See also
AdditionalRoles

Reimplemented from QAbstractItemModel.

Definition at line 1414 of file kdirmodel.cpp.

◆ rowCount()

int KDirModel::rowCount ( const QModelIndex parent = QModelIndex()) const
overridevirtual

Reimplemented from QAbstractItemModel.

Implements QAbstractItemModel.

Definition at line 1004 of file kdirmodel.cpp.

◆ setData()

bool KDirModel::setData ( const QModelIndex index,
const QVariant value,
int  role = Qt::EditRole 
)
overridevirtual

Reimplemented from QAbstractItemModel.

Call this to set a new icon, e.g. a preview

Reimplemented from QAbstractItemModel.

Definition at line 960 of file kdirmodel.cpp.

◆ setDirLister()

void KDirModel::setDirLister ( KDirLister dirLister)

Set the directory lister to use by this model, instead of the default KDirLister created internally.

The model takes ownership.

Definition at line 429 of file kdirmodel.cpp.

◆ setDropsAllowed()

void KDirModel::setDropsAllowed ( DropsAllowed  dropsAllowed)

Set whether dropping onto items should be allowed, and for which kind of item Drops are disabled by default.

Definition at line 1358 of file kdirmodel.cpp.

◆ setJobTransfersVisible()

void KDirModel::setJobTransfersVisible ( bool  show)

Enable/Disable the displaying of an animated overlay that is shown for any destination urls (in the view).

When enabled, the animations (if any) will be drawn automatically.

Only the files/folders that are visible and have jobs associated with them will display the animation. You would likely not want this enabled if you perform some kind of custom painting that takes up a whole item, and will just make this(and what you paint) look funky.

Default is disabled.

Note: KFileItemDelegate needs to have it's method called with the same value, when you make the call to this method.

Since
4.5

Definition at line 1063 of file kdirmodel.cpp.

◆ sibling()

QModelIndex KDirModel::sibling ( int  row,
int  column,
const QModelIndex index 
) const
overridevirtual

Reimplemented from QAbstractItemModel.

Reimplemented from QAbstractItemModel.

Definition at line 1041 of file kdirmodel.cpp.

◆ simplifiedUrlList()

QList< QUrl > KDirModel::simplifiedUrlList ( const QList< QUrl > &  urls)
static

Remove urls from the list if an ancestor is present on the list.

This can be used to delete only the ancestor url and skip a potential error of a non-existent url.

For example, for a list of "/home/foo/a", "/home/foo/a/a.txt", "/home/foo/a/a/a.txt", "/home/foo/a/b/b.txt", "home/foo/b/b.txt", this method will return the list "/home/foo/a", "/home/foo/b/b.txt".

Returns
the list urls without parented urls inside.
Since
4.2

Definition at line 1086 of file kdirmodel.cpp.

◆ sort()

void KDirModel::sort ( int  column,
Qt::SortOrder  order = Qt::AscendingOrder 
)
overridevirtual

Reimplemented from QAbstractItemModel. Not implemented.

See also
KDirSortFilterProxyModel

Reimplemented from QAbstractItemModel.

Definition at line 954 of file kdirmodel.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Tue Dec 6 2022 03:56:07 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.