79 Q_DECLARE_PUBLIC(QFileDialog)
82 using PersistentModelIndexList = QList<QPersistentModelIndex>;
87 PersistentModelIndexList selection;
92 QPlatformFileDialogHelper *platformFileDialogHelper()
const
93 {
return static_cast<QPlatformFileDialogHelper *>(platformHelper()); }
95 void createToolButtons();
96 void createMenuActions();
99 void init(
const QFileDialogArgs &args);
100 bool itemViewKeyboardEvent(QKeyEvent *event);
101 QString getEnvironmentVariable(
const QString &string);
102 QStringList typedFiles()
const;
103 QList<QUrl> userSelectedFiles()
const;
104 QStringList addDefaultSuffixToFiles(
const QStringList &filesToFix)
const;
105 QList<QUrl> addDefaultSuffixToUrls(
const QList<QUrl> &urlsToFix)
const;
106 bool removeDirectory(
const QString &path);
107 void setLabelTextControl(QFileDialog::DialogLabel label,
const QString &text);
108 inline void updateLookInLabel();
109 inline void updateFileNameLabel();
110 inline void updateFileTypeLabel();
111 void updateOkButtonText(
bool saveAsOnFolder =
false);
112 void updateCancelButtonText();
114 inline QModelIndex mapToSource(
const QModelIndex &index)
const;
115 inline QModelIndex mapFromSource(
const QModelIndex &index)
const;
116 inline QModelIndex rootIndex()
const;
117 inline void setRootIndex(
const QModelIndex &index)
const;
118 inline QModelIndex select(
const QModelIndex &index)
const;
119 inline QString rootPath()
const;
121 QLineEdit *lineEdit()
const;
123 static long maxNameLength(
const QString &path);
125 QString basename(
const QString &path)
const
127 const qsizetype separator = QDir::toNativeSeparators(path).lastIndexOf(QDir::separator());
129 return path.mid(separator + 1);
133 QDir::Filters filterForMode(QDir::Filters filters)
const
135 filters |= QDir::Drives | QDir::AllDirs | QDir::Dirs | QDir::Files;
136 if (q_func()->testOption(QFileDialog::ShowDirsOnly))
137 filters &= ~QDir::Files;
141 QAbstractItemView *currentView()
const;
143 static inline QString toInternal(
const QString &path)
147 n.replace(u'\\', u'/');
154#if QT_CONFIG(settings)
156 bool restoreFromSettings();
159 bool restoreWidgetState(QStringList &history,
int splitterPosition);
160 static void setLastVisitedDirectory(
const QUrl &dir);
161 void retranslateWindowTitle();
162 void retranslateStrings();
163 void emitFilesSelected(
const QStringList &files);
164 void saveHistorySelection();
167 void pathChanged(
const QString &);
168 void navigate(HistoryItem &);
169 void navigateBackward();
170 void navigateForward();
171 void navigateToParent();
172 void createDirectory();
174 void showDetailsView();
175 void showContextMenu(
const QPoint &position);
176 void renameCurrent();
177 void deleteCurrent();
179 void showHeader(QAction *);
180 void updateOkButton();
181 void currentChanged(
const QModelIndex &index);
182 void enterDirectory(
const QModelIndex &index);
183 void emitUrlSelected(
const QUrl &file);
184 void emitUrlsSelected(
const QList<QUrl> &files);
185 void nativeCurrentChanged(
const QUrl &file);
186 void nativeEnterDirectory(
const QUrl &directory);
187 void goToDirectory(
const QString &);
188 void useNameFilter(
int index);
189 void selectionChanged();
190 void goToUrl(
const QUrl &url);
191 void autoCompleteFileName(
const QString &);
192 void rowsInserted(
const QModelIndex & parent);
193 void fileRenamed(
const QString &path,
const QString &oldName,
const QString &newName);
196#if QT_CONFIG(proxymodel)
197 QAbstractProxyModel *proxyModel;
201 QStringList watching;
202 QFileSystemModel *model;
204#if QT_CONFIG(fscompleter)
205 QFSCompleter *completer;
208 QString setWindowTitle;
210 QList<HistoryItem> currentHistory;
211 int currentHistoryLocation;
213 QAction *renameAction;
214 QAction *deleteAction;
215 QAction *showHiddenAction;
216 QAction *newFolderAction;
218 bool useDefaultCaption;
223 bool canBeNativeDialog()
const override;
224 void setVisible(
bool visible) override;
225 inline bool usingWidgets()
const;
227 inline void setDirectory_sys(
const QUrl &directory);
228 inline QUrl directory_sys()
const;
229 inline void selectFile_sys(
const QUrl &filename);
230 inline QList<QUrl> selectedFiles_sys()
const;
231 inline void setFilter_sys();
232 inline void selectMimeTypeFilter_sys(
const QString &filter);
233 inline QString selectedMimeTypeFilter_sys()
const;
234 inline void selectNameFilter_sys(
const QString &filter);
235 inline QString selectedNameFilter_sys()
const;
238 QScopedPointer<Ui_QFileDialog> qFileDialogUi;
242 QPointer<QObject> receiverToDisconnectOnClose;
243 QByteArray memberToDisconnectOnClose;
244 QByteArray signalToDisconnectOnClose;
246 QSharedPointer<QFileDialogOptions> options;
249 QByteArray splitterState;
250 QByteArray headerData;
251 QList<QUrl> sidebarUrls;
252 QFileIconProvider defaultIconProvider;
254 ~QFileDialogPrivate();
257 virtual void initHelper(QPlatformDialogHelper *) override;
258 virtual void helperPrepareShow(QPlatformDialogHelper *) override;
259 virtual void helperDone(QDialog::DialogCode, QPlatformDialogHelper *) override;
261 void itemNotFound(
const QString &fileName, QFileDialog::FileMode mode);
262 bool itemAlreadyExists(
const QString &fileName);
263 Q_DISABLE_COPY_MOVE(QFileDialogPrivate)