Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QFileSystemModelPrivate Class Reference

#include <qfilesystemmodel_p.h>

+ Inheritance diagram for QFileSystemModelPrivate:
+ Collaboration diagram for QFileSystemModelPrivate:

Classes

struct  Fetching
 
class  QFileSystemNode
 

Public Types

enum  {
  NameColumn , SizeColumn , TypeColumn , TimeColumn ,
  NumColumns = 4
}
 
- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 
using ConnectionDataPointer = QExplicitlySharedDataPointer<ConnectionData>
 

Public Member Functions

 QFileSystemModelPrivate ()
 
 ~QFileSystemModelPrivate ()
 
void init ()
 
bool isHiddenByFilter (QFileSystemNode *indexNode, const QModelIndex &index) const
 
QFileSystemNodenode (const QModelIndex &index) const
 
QFileSystemNodenode (const QString &path, bool fetch=true) const
 
QModelIndex index (const QString &path, int column=0)
 
QModelIndex index (const QFileSystemNode *node, int column=0) const
 
bool filtersAcceptsNode (const QFileSystemNode *node) const
 
bool passNameFilters (const QFileSystemNode *node) const
 
void removeNode (QFileSystemNode *parentNode, const QString &name)
 
QFileSystemNodeaddNode (QFileSystemNode *parentNode, const QString &fileName, const QFileInfo &info)
 
void addVisibleFiles (QFileSystemNode *parentNode, const QStringList &newFiles)
 
void removeVisibleFile (QFileSystemNode *parentNode, int visibleLocation)
 
void sortChildren (int column, const QModelIndex &parent)
 
int translateVisibleLocation (QFileSystemNode *parent, int row) const
 
void delayedSort ()
 
QIcon icon (const QModelIndex &index) const
 
QString name (const QModelIndex &index) const
 
QString displayName (const QModelIndex &index) const
 
QString filePath (const QModelIndex &index) const
 
QString size (const QModelIndex &index) const
 
QString type (const QModelIndex &index) const
 
QString time (const QModelIndex &index) const
 
void directoryChanged (const QString &directory, const QStringList &list)
 
void performDelayedSort ()
 
void fileSystemChanged (const QString &path, const QList< std::pair< QString, QFileInfo > > &)
 
void resolvedName (const QString &fileName, const QString &resolvedName)
 
- Public Member Functions inherited from QAbstractItemModelPrivate
 QAbstractItemModelPrivate ()
 
 ~QAbstractItemModelPrivate ()
 
void removePersistentIndexData (QPersistentModelIndexData *data)
 
void movePersistentIndexes (const QList< QPersistentModelIndexData * > &indexes, int change, const QModelIndex &parent, Qt::Orientation orientation)
 
void rowsAboutToBeInserted (const QModelIndex &parent, int first, int last)
 
void rowsInserted (const QModelIndex &parent, int first, int last)
 
void rowsAboutToBeRemoved (const QModelIndex &parent, int first, int last)
 
void rowsRemoved (const QModelIndex &parent, int first, int last)
 
void columnsAboutToBeInserted (const QModelIndex &parent, int first, int last)
 
void columnsInserted (const QModelIndex &parent, int first, int last)
 
void columnsAboutToBeRemoved (const QModelIndex &parent, int first, int last)
 
void columnsRemoved (const QModelIndex &parent, int first, int last)
 
void itemsAboutToBeMoved (const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation)
 
void itemsMoved (const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation)
 
bool allowMove (const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation)
 Returns whether a move operation is valid.
 
virtual void executePendingOperations () const
 
QModelIndex createIndex (int row, int column, void *data=nullptr) const
 
QModelIndex createIndex (int row, int column, int id) const
 
bool indexValid (const QModelIndex &index) const
 
void invalidatePersistentIndexes ()
 
void invalidatePersistentIndex (const QModelIndex &index)
 
- Public Member Functions inherited from QObjectPrivate
void ensureExtraData ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
virtual ~QObjectPrivate ()
 
void deleteChildren ()
 
void clearBindingStorage ()
 
void checkForIncompatibleLibraryVersion (int version) const
 
void setParent_helper (QObject *)
 
void moveToThread_helper ()
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData, QBindingStatus *status)
 
QObjectList receiverList (const char *signal) const
 
void ensureConnectionData ()
 
void addConnection (int signal, Connection *c)
 
int signalIndex (const char *signalName, const QMetaObject **meta=nullptr) const
 
bool isSignalConnected (uint signalIdx, bool checkDeclarative=true) const
 
bool maybeSignalConnected (uint signalIndex) const
 
bool isDeclarativeSignalConnected (uint signalIdx) const
 
void connectNotify (const QMetaMethod &signal)
 
void disconnectNotify (const QMetaMethod &signal)
 
void reinitBindingStorageAfterThreadMove ()
 
virtual std::string flagsForDumping () const
 
virtual void writeToDebugStream (QDebug &) const
 
QtPrivate::QPropertyAdaptorSlotObjectgetPropertyAdaptorSlotObject (const QMetaProperty &property)
 
- Public Member Functions inherited from QObjectData
 QObjectData ()=default
 
virtual ~QObjectData ()=0
 
QMetaObjectdynamicMetaObject () const
 

Static Public Member Functions

static QString myComputer ()
 
static QString size (qint64 bytes)
 
- Static Public Member Functions inherited from QAbstractItemModelPrivate
static QAbstractItemModelstaticEmptyModel ()
 
static bool variantLessThan (const QVariant &v1, const QVariant &v2)
 
static const QHash< int, QByteArray > & defaultRoleNames ()
 
static bool isVariantLessThan (const QVariant &left, const QVariant &right, Qt::CaseSensitivity cs=Qt::CaseSensitive, bool isLocaleAware=false)
 
- Static Public Member Functions inherited from QObjectPrivate
static bool removeConnection (Connection *c)
 
static QObjectPrivateget (QObject *o)
 
static const QObjectPrivateget (const QObject *o)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot)
 
static QMetaObject::Connection connectImpl (const QObject *sender, int signal_index, const QObject *receiver, void **slot, QtPrivate::QSlotObjectBase *slotObj, int type, const int *types, const QMetaObject *senderMetaObject)
 
static QMetaObject::Connection connect (const QObject *sender, int signal_index, QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type)
 
static QMetaObject::Connection connect (const QObject *sender, int signal_index, const QObject *receiver, QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type)
 
static bool disconnect (const QObject *sender, int signal_index, void **slot)
 
static bool disconnect (const QObject *sender, int signal_index, const QObject *receiver, void **slot)
 

Public Attributes

QDir rootDir
 
QTimer delayedSortTimer
 
QHash< const QFileSystemNode *, bool > bypassFilters
 
QHash< QString, QStringresolvedSymLinks
 
QFileSystemNode root
 
QList< FetchingtoFetch
 
QBasicTimer fetchingTimer
 
QDir::Filters filters = QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs
 
int sortColumn = 0
 
Qt::SortOrder sortOrder = Qt::AscendingOrder
 
bool forceSort = true
 
bool readOnly = true
 
bool setRootPath = false
 
bool nameFilterDisables = true
 
bool disableRecursiveSort = false
 
- Public Attributes inherited from QAbstractItemModelPrivate
QStack< Changechanges
 
struct QAbstractItemModelPrivate::Persistent persistent
 
- Public Attributes inherited from QObjectPrivate
ExtraDataextraData
 
QAtomicPointer< QThreadDatathreadData
 
QAtomicPointer< ConnectionDataconnections
 
union { 
 
   QObject *   currentChildBeingDeleted 
 
   QAbstractDeclarativeData *   declarativeData 
 
};  
 
QAtomicPointer< QtSharedPointer::ExternalRefCountDatasharedRefcount
 
- Public Attributes inherited from QObjectData
QObjectq_ptr
 
QObjectparent
 
QObjectList children
 
uint isWidget: 1
 
uint blockSig: 1
 
uint wasDeleted: 1
 
uint isDeletingChildren: 1
 
uint sendChildEvents: 1
 
uint receiveChildEvents: 1
 
uint isWindow: 1
 
uint deleteLaterCalled: 1
 
uint isQuickItem: 1
 
uint willBeWidget: 1
 
uint wasWidget: 1
 
uint receiveParentEvents: 1
 
uint unused: 20
 
QAtomicInt postedEvents
 
QDynamicMetaObjectDatametaObject
 
QBindingStorage bindingStorage
 

Detailed Description

Definition at line 61 of file qfilesystemmodel_p.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
NameColumn 
SizeColumn 
TypeColumn 
TimeColumn 
NumColumns 

Definition at line 66 of file qfilesystemmodel_p.h.

Constructor & Destructor Documentation

◆ QFileSystemModelPrivate()

QFileSystemModelPrivate::QFileSystemModelPrivate ( )

Definition at line 2076 of file qfilesystemmodel.cpp.

◆ ~QFileSystemModelPrivate()

QFileSystemModelPrivate::~QFileSystemModelPrivate ( )

Definition at line 2083 of file qfilesystemmodel.cpp.

Member Function Documentation

◆ addNode()

QFileSystemModelPrivate::QFileSystemNode * QFileSystemModelPrivate::addNode ( QFileSystemNode * parentNode,
const QString & fileName,
const QFileInfo & info )

Adds a new file to the children of parentNode

WARNING* this will change the count of children

Definition at line 1817 of file qfilesystemmodel.cpp.

References QFileSystemModelPrivate::QFileSystemNode::children, QFileSystemModelPrivate::QFileSystemNode::fileName, fileName, info, QString::isEmpty(), node(), QFileSystemModelPrivate::QFileSystemNode::populate(), Q_ASSERT, and Q_UNUSED.

Referenced by fileSystemChanged(), and node().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addVisibleFiles()

void QFileSystemModelPrivate::addVisibleFiles ( QFileSystemNode * parentNode,
const QStringList & newFiles )

File at parentNode->children(itemLocation) was not visible before, but now should be and emit signals if necessary.

WARNING* this will change the visible count

Definition at line 1871 of file qfilesystemmodel.cpp.

References QList< T >::append(), QFileSystemModelPrivate::QFileSystemNode::children, QFileSystemModelPrivate::QFileSystemNode::dirtyChildrenIndex, isHiddenByFilter(), QObjectData::parent, QList< T >::size(), and QFileSystemModelPrivate::QFileSystemNode::visibleChildren.

Referenced by fileSystemChanged(), and node().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delayedSort()

void QFileSystemModelPrivate::delayedSort ( )
inline

Definition at line 246 of file qfilesystemmodel_p.h.

Referenced by fileSystemChanged().

+ Here is the caller graph for this function:

◆ directoryChanged()

void QFileSystemModelPrivate::directoryChanged ( const QString & directory,
const QStringList & files )

Performed quick listing and see if any files have been added or removed, then fetch more information on visible files.

Definition at line 1772 of file qfilesystemmodel.cpp.

References QFileSystemModelPrivate::QFileSystemNode::children, directory, files, i, node(), and removeNode().

Referenced by init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ displayName()

QString QFileSystemModelPrivate::displayName ( const QModelIndex & index) const

Definition at line 835 of file qfilesystemmodel.cpp.

References node().

+ Here is the call graph for this function:

◆ filePath()

QString QFileSystemModelPrivate::filePath ( const QModelIndex & index) const

Definition at line 1395 of file qfilesystemmodel.cpp.

References QDir::fromNativeSeparators(), QModelIndex::isValid(), node(), QModelIndex::parent(), Q_ASSERT, Q_UNUSED, and QDir::separator().

Referenced by name().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fileSystemChanged()

void QFileSystemModelPrivate::fileSystemChanged ( const QString & path,
const QList< std::pair< QString, QFileInfo > > & updates )

The thread has received new information about files, update and emit dataChanged if it has actually changed.

Definition at line 1920 of file qfilesystemmodel.cpp.

References addNode(), addVisibleFiles(), QList< T >::at(), bypassFilters, Qt::CaseInsensitive, QFileSystemModelPrivate::QFileSystemNode::caseSensitive(), QFileSystemModelPrivate::QFileSystemNode::children, QString::compare(), delayedSort(), emit, QFileSystemModelPrivate::QFileSystemNode::fileName, fileName, filtersAcceptsNode(), QString::first(), forceSort, info, QFileSystemModelPrivate::QFileSystemNode::isVisible, NameColumn, node(), QFileSystemModelPrivate::QFileSystemNode::populate(), Q_ASSERT, Q_UNUSED, removeVisibleFile(), sortColumn, translateVisibleLocation(), QFileSystemModelPrivate::QFileSystemNode::visibleChildren, and QFileSystemModelPrivate::QFileSystemNode::visibleLocation().

Referenced by init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ filtersAcceptsNode()

◆ icon()

QIcon QFileSystemModelPrivate::icon ( const QModelIndex & index) const

Definition at line 848 of file qfilesystemmodel.cpp.

References QFileSystemModelPrivate::QFileSystemNode::icon(), and node().

+ Here is the call graph for this function:

◆ index() [1/2]

QModelIndex QFileSystemModelPrivate::index ( const QFileSystemNode * node,
int column = 0 ) const

Definition at line 596 of file qfilesystemmodel.cpp.

References QFileSystemModelPrivate::QFileSystemNode::fileName, QFileSystemModelPrivate::QFileSystemNode::isVisible, node(), QFileSystemModelPrivate::QFileSystemNode::parent, Q_ASSERT, root, translateVisibleLocation(), and QFileSystemModelPrivate::QFileSystemNode::visibleLocation().

+ Here is the call graph for this function:

◆ index() [2/2]

QModelIndex QFileSystemModelPrivate::index ( const QString & path,
int column = 0 )
inline

Definition at line 212 of file qfilesystemmodel_p.h.

References index().

Referenced by index().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init()

void QFileSystemModelPrivate::init ( )

◆ isHiddenByFilter()

bool QFileSystemModelPrivate::isHiddenByFilter ( QFileSystemNode * indexNode,
const QModelIndex & index ) const
inline

Definition at line 206 of file qfilesystemmodel_p.h.

Referenced by addVisibleFiles(), removeNode(), and removeVisibleFile().

+ Here is the caller graph for this function:

◆ myComputer()

static QString QFileSystemModelPrivate::myComputer ( )
inlinestatic

Definition at line 234 of file qfilesystemmodel_p.h.

Referenced by QFileSystemModel::myComputer(), node(), and QFileSystemModel::setRootPath().

+ Here is the caller graph for this function:

◆ name()

QString QFileSystemModelPrivate::name ( const QModelIndex & index) const

Definition at line 816 of file qfilesystemmodel.cpp.

References filePath(), QDir::fromNativeSeparators(), QHash< Key, T >::isEmpty(), node(), QT_CONFIG, resolvedSymLinks, and QHash< Key, T >::value().

+ Here is the call graph for this function:

◆ node() [1/2]

QFileSystemModelPrivate::QFileSystemNode * QFileSystemModelPrivate::node ( const QModelIndex & index) const

Return the QFileSystemNode that goes to index.

Definition at line 271 of file qfilesystemmodel.cpp.

References Q_ASSERT, and root.

Referenced by addNode(), directoryChanged(), displayName(), filePath(), fileSystemChanged(), filtersAcceptsNode(), icon(), index(), name(), node(), passNameFilters(), removeNode(), size(), sortChildren(), time(), and type().

+ Here is the caller graph for this function:

◆ node() [2/2]

◆ passNameFilters()

bool QFileSystemModelPrivate::passNameFilters ( const QFileSystemNode * node) const

Definition at line 2183 of file qfilesystemmodel.cpp.

References QDir::AllDirs, QString::contains(), QFileSystemModelPrivate::QFileSystemNode::fileName, filters, QFileSystemModelPrivate::QFileSystemNode::isDir(), node(), and Q_UNUSED.

Referenced by filtersAcceptsNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ performDelayedSort()

void QFileSystemModelPrivate::performDelayedSort ( )

Definition at line 1004 of file qfilesystemmodel.cpp.

References sortColumn, and sortOrder.

Referenced by init().

+ Here is the caller graph for this function:

◆ removeNode()

void QFileSystemModelPrivate::removeNode ( QFileSystemModelPrivate::QFileSystemNode * parentNode,
const QString & name )

File at parentNode->children(itemLocation) has been removed, remove from the lists and emit signals if necessary

WARNING* this will change the count of children and could change visibleChildren

Definition at line 1844 of file qfilesystemmodel.cpp.

References QFileSystemModelPrivate::QFileSystemNode::children, isHiddenByFilter(), node(), QObjectData::parent, QList< T >::removeAt(), translateVisibleLocation(), QFileSystemModelPrivate::QFileSystemNode::visibleChildren, and QFileSystemModelPrivate::QFileSystemNode::visibleLocation().

Referenced by directoryChanged().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeVisibleFile()

void QFileSystemModelPrivate::removeVisibleFile ( QFileSystemNode * parentNode,
int vLocation )

File was visible before, but now should NOT be

WARNING* this will change the visible count

Definition at line 1898 of file qfilesystemmodel.cpp.

References QList< T >::at(), QFileSystemModelPrivate::QFileSystemNode::children, isHiddenByFilter(), QObjectData::parent, QList< T >::removeAt(), translateVisibleLocation(), and QFileSystemModelPrivate::QFileSystemNode::visibleChildren.

Referenced by fileSystemChanged().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resolvedName()

void QFileSystemModelPrivate::resolvedName ( const QString & fileName,
const QString & resolvedName )

Definition at line 2031 of file qfilesystemmodel.cpp.

References fileName, resolvedName(), and resolvedSymLinks.

Referenced by init(), and resolvedName().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ size() [1/2]

QString QFileSystemModelPrivate::size ( const QModelIndex & index) const

Definition at line 764 of file qfilesystemmodel.cpp.

References node().

+ Here is the call graph for this function:

◆ size() [2/2]

QString QFileSystemModelPrivate::size ( qint64 bytes)
static

Definition at line 783 of file qfilesystemmodel.cpp.

References QLocale::system().

+ Here is the call graph for this function:

◆ sortChildren()

void QFileSystemModelPrivate::sortChildren ( int column,
const QModelIndex & parent )

Definition at line 1091 of file qfilesystemmodel.cpp.

References disableRecursiveSort, QFileSystemModelPrivate::QFileSystemNode::fileName, filtersAcceptsNode(), i, QFileSystemModelPrivate::QFileSystemNode::isVisible, node(), QObjectData::parent, and sortChildren().

Referenced by sortChildren().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ time()

QString QFileSystemModelPrivate::time ( const QModelIndex & index) const

Definition at line 791 of file qfilesystemmodel.cpp.

References QTimeZone::LocalTime, node(), Q_UNUSED, QLocale::ShortFormat, and QLocale::system().

+ Here is the call graph for this function:

◆ translateVisibleLocation()

int QFileSystemModelPrivate::translateVisibleLocation ( QFileSystemNode * parent,
int row ) const
inline

Definition at line 222 of file qfilesystemmodel_p.h.

References Qt::AscendingOrder, QFileSystemModelPrivate::QFileSystemNode::dirtyChildrenIndex, QList< T >::size(), and QFileSystemModelPrivate::QFileSystemNode::visibleChildren.

Referenced by fileSystemChanged(), index(), node(), removeNode(), and removeVisibleFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ type()

QString QFileSystemModelPrivate::type ( const QModelIndex & index) const

Definition at line 806 of file qfilesystemmodel.cpp.

References node(), and QFileSystemModelPrivate::QFileSystemNode::type().

+ Here is the call graph for this function:

Member Data Documentation

◆ bypassFilters

QHash<const QFileSystemNode*, bool> QFileSystemModelPrivate::bypassFilters

Definition at line 274 of file qfilesystemmodel_p.h.

Referenced by fileSystemChanged(), and filtersAcceptsNode().

◆ delayedSortTimer

QTimer QFileSystemModelPrivate::delayedSortTimer

Definition at line 273 of file qfilesystemmodel_p.h.

Referenced by init().

◆ disableRecursiveSort

bool QFileSystemModelPrivate::disableRecursiveSort = false

Definition at line 302 of file qfilesystemmodel_p.h.

Referenced by sortChildren().

◆ fetchingTimer

QBasicTimer QFileSystemModelPrivate::fetchingTimer

Definition at line 291 of file qfilesystemmodel_p.h.

◆ filters

QDir::Filters QFileSystemModelPrivate::filters = QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs

Definition at line 293 of file qfilesystemmodel_p.h.

Referenced by filtersAcceptsNode(), and passNameFilters().

◆ forceSort

bool QFileSystemModelPrivate::forceSort = true

Definition at line 296 of file qfilesystemmodel_p.h.

Referenced by fileSystemChanged().

◆ nameFilterDisables

bool QFileSystemModelPrivate::nameFilterDisables = true

Definition at line 299 of file qfilesystemmodel_p.h.

Referenced by filtersAcceptsNode().

◆ readOnly

bool QFileSystemModelPrivate::readOnly = true

Definition at line 297 of file qfilesystemmodel_p.h.

◆ resolvedSymLinks

QHash<QString, QString> QFileSystemModelPrivate::resolvedSymLinks

Definition at line 280 of file qfilesystemmodel_p.h.

Referenced by name(), and resolvedName().

◆ root

QFileSystemNode QFileSystemModelPrivate::root

Definition at line 282 of file qfilesystemmodel_p.h.

Referenced by filtersAcceptsNode(), index(), node(), and node().

◆ rootDir

QDir QFileSystemModelPrivate::rootDir

Definition at line 265 of file qfilesystemmodel_p.h.

Referenced by node().

◆ setRootPath

bool QFileSystemModelPrivate::setRootPath = false

Definition at line 298 of file qfilesystemmodel_p.h.

◆ sortColumn

int QFileSystemModelPrivate::sortColumn = 0

Definition at line 294 of file qfilesystemmodel_p.h.

Referenced by fileSystemChanged(), and performDelayedSort().

◆ sortOrder

Qt::SortOrder QFileSystemModelPrivate::sortOrder = Qt::AscendingOrder

Definition at line 295 of file qfilesystemmodel_p.h.

Referenced by performDelayedSort().

◆ toFetch

QList<Fetching> QFileSystemModelPrivate::toFetch

Definition at line 289 of file qfilesystemmodel_p.h.


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