KIO
kdirmodel.h
29 * Note that there are some cases when using QPersistentModelIndexes from this model will not give
30 * expected results. QPersistentIndexes will remain valid and updated if its siblings are added or
31 * removed. However, if the QPersistentIndex or one of its ancestors is moved, the QPersistentIndex will become
32 * invalid. For example, if a file or directory is renamed after storing a QPersistentModelIndex for it,
33 * the index (along with any stored children) will become invalid even though it is still in the model. The reason
34 * for this is that moves of files and directories are treated as separate insert and remove actions.
73 * Apart from the support for the ShowRoot flag, this is equivalent to dirLister()->openUrl(url, flags)
75 * Unless ShowRoot is set, the item for this directory will NOT be shown, the model starts at its children.
82 * Set the directory lister to use by this model, instead of the default KDirLister created internally.
108 * @short Lists subdirectories using fetchMore() as needed until the given @p url exists in the model.
112 * However if you want the tree to show a given URL (i.e. open the tree recursively until that URL),
126 * Note that for most things (renaming, changing size etc.), KDirLister's signals tell the model already.
160 FileItemRole = 0x07A263FF, ///< returns the KFileItem for a given index. roleName is "fileItem".
161 ChildCountRole = 0x2C4D0A40, ///< returns the number of items in a directory, or ChildCountUnknown. roleName is "childCount".
162 HasJobRole = 0x01E555A5, ///< returns whether or not there is a job on an item (file/directory). roleName is "hasJob".
172 DropOnLocalExecutable = 4, ///< allow drops on local executables, shell scripts and desktop files. Can be used with DropOnDirectory.
191 bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
199 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
201 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
214 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
225 * 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",
239 * @param sequenceIndex Index in the sequence. If it is zero, the standard icon will be assigned.
Subclass of KCoreDirLister which uses QWidgets to show error messages and to associate jobs with wind...
Definition kdirlister.h:25
QFlags< DropsAllowedFlag > DropsAllowed
Stores a combination of DropsAllowedFlag values.
Definition kdirmodel.h:177
void expand(const QModelIndex &index)
Emitted for each subdirectory that is a parent of a url passed to expandToUrl This allows to asynchro...
Q_INVOKABLE void itemChanged(const QModelIndex &index)
Notify the model that the item at this index has changed.
Definition kdirmodel.cpp:838
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Reimplemented from QAbstractItemModel.
Definition kdirmodel.cpp:857
@ DropOnLocalExecutable
allow drops on local executables, shell scripts and desktop files. Can be used with DropOnDirectory.
Definition kdirmodel.h:172
Q_INVOKABLE QModelIndex indexForItem(const KFileItem &) const
Return the index for a given kfileitem.
Definition kdirmodel.cpp:1201
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Reimplemented from QAbstractItemModel. O(1)
Definition kdirmodel.cpp:1217
Q_INVOKABLE void clearAllPreviews()
Forget all previews (optimization for turning previews off).
Definition kdirmodel.cpp:833
Q_INVOKABLE void openUrl(const QUrl &url, OpenUrlFlags flags=NoFlags)
Display the contents of url in the model.
Definition kdirmodel.cpp:482
QFlags< OpenUrlFlag > OpenUrlFlags
Stores a combination of OpenUrlFlag values.
Definition kdirmodel.h:68
@ FileItemRole
returns the KFileItem for a given index. roleName is "fileItem".
Definition kdirmodel.h:160
@ ChildCountRole
returns the number of items in a directory, or ChildCountUnknown. roleName is "childCount".
Definition kdirmodel.h:161
@ HasJobRole
returns whether or not there is a job on an item (file/directory). roleName is "hasJob".
Definition kdirmodel.h:162
void needSequenceIcon(const QModelIndex &index, int sequenceIndex)
Emitted when another icon sequence index is requested.
KDirLister * dirLister() const
Return the directory lister used by this model.
Definition kdirmodel.cpp:516
QModelIndex parent(const QModelIndex &index) const override
Reimplemented from QAbstractItemModel.
Definition kdirmodel.cpp:1066
void setJobTransfersVisible(bool show)
Enable/Disable the displaying of an animated overlay that is shown for any destination urls (in the v...
Definition kdirmodel.cpp:1102
bool jobTransfersVisible() const
Returns whether or not displaying job transfers has been enabled.
Definition kdirmodel.cpp:1120
void setDirLister(KDirLister *dirLister)
Set the directory lister to use by this model, instead of the default KDirLister created internally.
Definition kdirmodel.cpp:454
Q_INVOKABLE void setDropsAllowed(DropsAllowed dropsAllowed)
Set whether dropping onto items should be allowed, and for which kind of item Drops are disabled by d...
Definition kdirmodel.cpp:1388
@ Reload
Indicates whether to use the cache or to reread the directory from the disk.
Definition kdirmodel.h:59
KFileItem itemForIndex(const QModelIndex &index) const
Return the fileitem for a given index.
Definition kdirmodel.cpp:1189
Q_INVOKABLE void expandToUrl(const QUrl &url)
Lists subdirectories using fetchMore() as needed until the given url exists in the model.
Definition kdirmodel.cpp:1393
static QList< QUrl > simplifiedUrlList(const QList< QUrl > &urls)
Remove urls from the list if an ancestor is present on the list.
Definition kdirmodel.cpp:1125
Q_INVOKABLE QModelIndex indexForUrl(const QUrl &url) const
Return the index for a given url.
Definition kdirmodel.cpp:1207
void requestSequenceIcon(const QModelIndex &index, int sequenceIndex)
This emits the needSequenceIcon signal, requesting another sequence icon.
Definition kdirmodel.cpp:1097
Qt::ItemFlags flags(const QModelIndex &index) const override
Reimplemented from QAbstractItemModel.
Definition kdirmodel.cpp:1291
QAbstractItemModel(QObject *parent)
virtual bool canFetchMore(const QModelIndex &parent) const const
virtual int columnCount(const QModelIndex &parent) const const=0
virtual QVariant data(const QModelIndex &index, int role) const const=0
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
virtual void fetchMore(const QModelIndex &parent)
virtual Qt::ItemFlags flags(const QModelIndex &index) const const
virtual bool hasChildren(const QModelIndex &parent) const const
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const const
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const=0
virtual bool insertColumns(int column, int count, const QModelIndex &parent)
virtual bool insertRows(int row, int count, const QModelIndex &parent)
virtual QMimeData * mimeData(const QModelIndexList &indexes) const const
virtual QStringList mimeTypes() const const
virtual bool removeColumns(int column, int count, const QModelIndex &parent)
virtual bool removeRows(int row, int count, const QModelIndex &parent)
virtual QHash< int, QByteArray > roleNames() const const
virtual int rowCount(const QModelIndex &parent) const const=0
virtual bool setData(const QModelIndex &index, const QVariant &value, int role)
virtual QModelIndex sibling(int row, int column, const QModelIndex &index) const const
virtual void sort(int column, Qt::SortOrder order)
virtual Qt::DropActions supportedDropActions() const const
QObject(QObject *parent)
Q_FLAG(...)
Q_INVOKABLEQ_INVOKABLE
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
DropAction
DisplayRole
typedef ItemFlags
Orientation
SortOrder
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:49:37 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:49:37 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.