81 Q_DECLARE_PUBLIC(QFileDialog)
84 using PersistentModelIndexList = QList<QPersistentModelIndex>;
89 PersistentModelIndexList selection;
94 QPlatformFileDialogHelper *platformFileDialogHelper()
const
95 {
return static_cast<QPlatformFileDialogHelper *>(platformHelper()); }
97 void createToolButtons();
98 void createMenuActions();
101 void init(
const QFileDialogArgs &args);
102 bool itemViewKeyboardEvent(QKeyEvent *event);
103 QString getEnvironmentVariable(
const QString &string);
104 QStringList typedFiles()
const;
105 QList<QUrl> userSelectedFiles()
const;
106 QStringList addDefaultSuffixToFiles(
const QStringList &filesToFix)
const;
107 QList<QUrl> addDefaultSuffixToUrls(
const QList<QUrl> &urlsToFix)
const;
108 bool removeDirectory(
const QString &path);
109 void setLabelTextControl(QFileDialog::DialogLabel label,
const QString &text);
110 inline void updateLookInLabel();
111 inline void updateFileNameLabel();
112 inline void updateFileTypeLabel();
113 void updateOkButtonText(
bool saveAsOnFolder =
false);
114 void updateCancelButtonText();
116 inline QModelIndex mapToSource(
const QModelIndex &index)
const;
117 inline QModelIndex mapFromSource(
const QModelIndex &index)
const;
118 inline QModelIndex rootIndex()
const;
119 inline void setRootIndex(
const QModelIndex &index)
const;
120 inline QModelIndex select(
const QModelIndex &index)
const;
121 inline QString rootPath()
const;
123 QLineEdit *lineEdit()
const;
125 static long maxNameLength(
const QString &path);
127 QString basename(
const QString &path)
const
129 const qsizetype separator = QDir::toNativeSeparators(path).lastIndexOf(QDir::separator());
131 return path.mid(separator + 1);
135 QDir::Filters filterForMode(QDir::Filters filters)
const
137 filters |= QDir::Drives | QDir::AllDirs | QDir::Dirs | QDir::Files;
138 if (q_func()->testOption(QFileDialog::ShowDirsOnly))
139 filters &= ~QDir::Files;
143 QAbstractItemView *currentView()
const;
145 static inline QString toInternal(
const QString &path)
149 n.replace(u'\\', u'/');
156#if QT_CONFIG(settings)
158 bool restoreFromSettings();
161 bool restoreWidgetState(QStringList &history,
int splitterPosition);
162 static void setLastVisitedDirectory(
const QUrl &dir);
163 void retranslateWindowTitle();
164 void retranslateStrings();
165 void emitFilesSelected(
const QStringList &files);
166 void saveHistorySelection();
169 void pathChanged(
const QString &);
170 void navigate(HistoryItem &);
171 void navigateBackward();
172 void navigateForward();
173 void navigateToParent();
174 void createDirectory();
176 void showDetailsView();
177 void showContextMenu(
const QPoint &position);
178 void renameCurrent();
179 void deleteCurrent();
181 void showHeader(QAction *);
182 void updateOkButton();
183 void currentChanged(
const QModelIndex &index);
184 void enterDirectory(
const QModelIndex &index);
185 void emitUrlSelected(
const QUrl &file);
186 void emitUrlsSelected(
const QList<QUrl> &files);
187 void nativeCurrentChanged(
const QUrl &file);
188 void nativeEnterDirectory(
const QUrl &directory);
189 void goToDirectory(
const QString &);
190 void useNameFilter(
int index);
191 void selectionChanged();
192 void goToUrl(
const QUrl &url);
193 void autoCompleteFileName(
const QString &);
194 void rowsInserted(
const QModelIndex & parent);
195 void fileRenamed(
const QString &path,
const QString &oldName,
const QString &newName);
198#if QT_CONFIG(proxymodel)
199 QAbstractProxyModel *proxyModel;
203 QStringList watching;
204 QFileSystemModel *model;
206#if QT_CONFIG(fscompleter)
207 QFSCompleter *completer;
210 QString setWindowTitle;
212 QList<HistoryItem> currentHistory;
213 int currentHistoryLocation;
215 QAction *renameAction;
216 QAction *deleteAction;
217 QAction *showHiddenAction;
218 QAction *newFolderAction;
220 bool useDefaultCaption;
225 bool canBeNativeDialog()
const override;
226 void setVisible(
bool visible) override;
227 inline bool usingWidgets()
const;
229 inline void setDirectory_sys(
const QUrl &directory);
230 inline QUrl directory_sys()
const;
231 inline void selectFile_sys(
const QUrl &filename);
232 inline QList<QUrl> selectedFiles_sys()
const;
233 inline void setFilter_sys();
234 inline void selectMimeTypeFilter_sys(
const QString &filter);
235 inline QString selectedMimeTypeFilter_sys()
const;
236 inline void selectNameFilter_sys(
const QString &filter);
237 inline QString selectedNameFilter_sys()
const;
240 std::unique_ptr<Ui_QFileDialog> qFileDialogUi;
244 QPointer<QObject> receiverToDisconnectOnClose;
245 QByteArray memberToDisconnectOnClose;
246 QByteArray signalToDisconnectOnClose;
248 QSharedPointer<QFileDialogOptions> options;
251 QByteArray splitterState;
252 QByteArray headerData;
253 QList<QUrl> sidebarUrls;
254 QFileIconProvider defaultIconProvider;
256 ~QFileDialogPrivate();
259 virtual void initHelper(QPlatformDialogHelper *) override;
260 virtual void helperPrepareShow(QPlatformDialogHelper *) override;
261 virtual void helperDone(QDialog::DialogCode, QPlatformDialogHelper *) override;
263 void itemNotFound(
const QString &fileName, QFileDialog::FileMode mode);
264 bool itemAlreadyExists(
const QString &fileName);
265 Q_DISABLE_COPY_MOVE(QFileDialogPrivate)