qfilesystemmodel.sip 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. // qfilesystemmodel.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtGui Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  8. //
  9. // This file may be used under the terms of the GNU General Public License
  10. // version 3.0 as published by the Free Software Foundation and appearing in
  11. // the file LICENSE included in the packaging of this file. Please review the
  12. // following information to ensure the GNU General Public License version 3.0
  13. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  14. //
  15. // If you do not wish to use this file under the terms of the GPL version 3.0
  16. // then you may purchase a commercial license. For more information contact
  17. // info@riverbankcomputing.com.
  18. //
  19. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  20. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21. class QFileSystemModel : public QAbstractItemModel
  22. {
  23. %TypeHeaderCode
  24. #include <qfilesystemmodel.h>
  25. %End
  26. public:
  27. enum Roles /BaseType=IntEnum/
  28. {
  29. FileIconRole,
  30. FilePathRole,
  31. FileNameRole,
  32. FilePermissions,
  33. %If (Qt_6_8_0 -)
  34. FileInfoRole,
  35. %End
  36. };
  37. explicit QFileSystemModel(QObject *parent /TransferThis/ = 0);
  38. virtual ~QFileSystemModel();
  39. virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
  40. QModelIndex index(const QString &path, int column = 0) const;
  41. virtual QModelIndex parent(const QModelIndex &child) const;
  42. virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
  43. virtual bool canFetchMore(const QModelIndex &parent) const;
  44. virtual void fetchMore(const QModelIndex &parent);
  45. virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
  46. virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
  47. QVariant myComputer(int role = Qt::DisplayRole) const;
  48. virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
  49. virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
  50. virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
  51. virtual Qt::ItemFlags flags(const QModelIndex &index) const;
  52. virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
  53. virtual QStringList mimeTypes() const;
  54. virtual QMimeData *mimeData(const QModelIndexList &indexes) const;
  55. virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
  56. virtual Qt::DropActions supportedDropActions() const;
  57. QModelIndex setRootPath(const QString &path);
  58. QString rootPath() const;
  59. QDir rootDirectory() const;
  60. void setIconProvider(QAbstractFileIconProvider *provider /KeepReference/);
  61. QAbstractFileIconProvider *iconProvider() const;
  62. void setFilter(QDir::Filters filters);
  63. QDir::Filters filter() const;
  64. void setResolveSymlinks(bool enable);
  65. bool resolveSymlinks() const;
  66. void setReadOnly(bool enable);
  67. bool isReadOnly() const;
  68. void setNameFilterDisables(bool enable);
  69. bool nameFilterDisables() const;
  70. void setNameFilters(const QStringList &filters);
  71. QStringList nameFilters() const;
  72. QString filePath(const QModelIndex &index) const;
  73. bool isDir(const QModelIndex &index) const;
  74. qint64 size(const QModelIndex &index) const;
  75. QString type(const QModelIndex &index) const;
  76. QDateTime lastModified(const QModelIndex &index) const;
  77. %If (Qt_6_6_0 -)
  78. QDateTime lastModified(const QModelIndex &index, const QTimeZone &tz) const;
  79. %End
  80. QModelIndex mkdir(const QModelIndex &parent, const QString &name);
  81. QFileDevice::Permissions permissions(const QModelIndex &index) const;
  82. bool rmdir(const QModelIndex &index);
  83. QString fileName(const QModelIndex &aindex) const;
  84. QIcon fileIcon(const QModelIndex &aindex) const;
  85. QFileInfo fileInfo(const QModelIndex &aindex) const;
  86. bool remove(const QModelIndex &index);
  87. signals:
  88. void fileRenamed(const QString &path, const QString &oldName, const QString &newName);
  89. void rootPathChanged(const QString &newPath);
  90. void directoryLoaded(const QString &path);
  91. protected:
  92. virtual bool event(QEvent *event);
  93. virtual void timerEvent(QTimerEvent *event);
  94. public:
  95. virtual QModelIndex sibling(int row, int column, const QModelIndex &idx) const;
  96. enum Option /BaseType=Flag/
  97. {
  98. DontWatchForChanges,
  99. DontResolveSymlinks,
  100. DontUseCustomDirectoryIcons,
  101. };
  102. typedef QFlags<QFileSystemModel::Option> Options;
  103. void setOption(QFileSystemModel::Option option, bool on = true);
  104. bool testOption(QFileSystemModel::Option option) const;
  105. void setOptions(QFileSystemModel::Options options);
  106. QFileSystemModel::Options options() const;
  107. virtual QHash<int, QByteArray> roleNames() const;
  108. };