45 #include <QtCore/qdir.h> 46 #include <QtCore/qstring.h> 47 #include <QtGui/qdialog.h> 55 #ifndef QT_NO_FILEDIALOG 76 bool confirmOverwrite;
78 bool nameFilterDetailsVisible;
83 enum FileMode { AnyFile, ExistingFile, Directory, ExistingFiles, DirectoryOnly };
85 enum DialogLabel { LookIn, FileName, FileType, Accept, Reject };
90 ShowDirsOnly = 0x00000001,
91 DontResolveSymlinks = 0x00000002,
92 DontConfirmOverwrite = 0x00000004,
93 DontUseSheet = 0x00000008,
94 DontUseNativeDialog = 0x00000010,
95 ReadOnly = 0x00000020,
96 HideNameFilterDetails = 0x00000040,
97 DontUseCustomDirectoryIcons = 0x00000080
108 void setDirectory(
const QString &directory);
109 inline void setDirectory(
const QDir &directory);
110 QDir directory()
const;
112 void selectFile(
const QString &filename);
122 void setNameFilterDetailsVisible(
bool enabled);
123 bool isNameFilterDetailsVisible()
const;
129 QString selectedNameFilter()
const;
131 QDir::Filters
filter()
const;
132 void setFilter(QDir::Filters
filters);
143 void setReadOnly(
bool enabled);
144 bool isReadOnly()
const;
146 void setResolveSymlinks(
bool enabled);
147 bool resolveSymlinks()
const;
155 void setConfirmOverwrite(
bool enabled);
156 bool confirmOverwrite()
const;
173 #ifndef QT_NO_PROXYMODEL 178 void setOption(
Option option,
bool on =
true);
179 bool testOption(
Option option)
const;
180 void setOptions(Options options);
181 Options options()
const;
183 #ifdef Q_NO_USING_KEYWORD 194 void fileSelected(
const QString &file);
196 void currentChanged(
const QString &path);
197 void directoryEntered(
const QString &directory);
203 inline QT3_SUPPORT
void setMode(
FileMode m) { setFileMode(m); }
204 inline QT3_SUPPORT
FileMode mode()
const {
return fileMode(); }
205 inline QT3_SUPPORT
void setDir(
const QString &directory) { setDirectory(directory); }
206 inline QT3_SUPPORT
void setDir(
const QDir &directory ) { setDirectory(directory); }
207 QT3_SUPPORT
QString selectedFile()
const;
215 Options options = 0);
222 Options options = 0);
227 Options options = ShowDirsOnly);
234 Options options = 0);
237 inline static QString QT3_SUPPORT getOpenFileName(
const QString &dir,
242 bool resolveSymlinks =
true)
244 return getOpenFileName(parent, caption, dir,
filter, selectedFilter,
245 resolveSymlinks ?
Option(0) : DontResolveSymlinks); }
247 inline static QString QT3_SUPPORT getSaveFileName(
const QString &dir,
252 bool resolveSymlinks =
true)
254 return getSaveFileName(parent, caption, dir,
filter, selectedFilter,
255 resolveSymlinks ?
Option(0) : DontResolveSymlinks); }
257 inline static QString QT3_SUPPORT getExistingDirectory(
const QString &dir,
259 const char*
name = 0,
262 bool resolveSymlinks =
true)
264 return getExistingDirectory(parent, caption, dir,
265 Options((resolveSymlinks ?
Option(0) : DontResolveSymlinks)
266 | (dirOnly ? ShowDirsOnly :
Option(0)))); }
271 const char*
name = 0,
274 bool resolveSymlinks =
true)
276 return getOpenFileNames(parent, caption, dir, filter, selectedFilter,
277 resolveSymlinks ?
Option(0) : DontResolveSymlinks); }
278 #endif // QT3_SUPPORT 282 void done(
int result);
315 #if defined(Q_WS_MAC) 325 #endif // QT_NO_FILEDIALOG 331 #endif // QFILEDIALOG_H The QDir class provides access to directory structures and their contents.
The QAbstractItemDelegate class is used to display and edit data items from a model.
void setDirectory(const QString &directory)
Sets the file dialog's current directory.
#define QT_END_NAMESPACE
This macro expands to.
#define Q_DECLARE_FLAGS(Flags, Enum)
The Q_DECLARE_FLAGS() macro expands to.
The QDialog class is the base class of dialog windows.
The QByteArray class provides an array of bytes.
virtual void accept()
Hides the modal dialog and sets the result code to Accepted.
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
#define Q_PRIVATE_SLOT(d, signature)
The QUrl class provides a convenient interface for working with URLs.
The QString class provides a Unicode character string.
The QObject class is the base class of all Qt objects.
The QFileDialog class provides a dialog that allow users to select files or directories.
ViewMode
This enum describes the view mode of the file dialog; i.
#define QT_BEGIN_NAMESPACE
This macro expands to.
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
The Q_DECLARE_OPERATORS_FOR_FLAGS() macro declares global operator|() functions for Flags...
QString absolutePath() const
Returns the absolute path (a path that starts with "/" or with a drive specification), which may contain symbolic links, but never contains redundant ".", ".." or multiple separators.
The QStringList class provides a list of strings.
The QFileIconProvider class provides file icons for the QDirModel and the QFileSystemModel classes...
The QAbstractProxyModel class provides a base class for proxy item models that can do sorting...
virtual void done(int)
Closes the dialog and sets its result code to r.
static const char *const filters[3]
FileMode
This enum is used to indicate what the user may select in the file dialog; i.
The QItemSelection class manages information about selected items in a model.
The QPoint class defines a point in the plane using integer precision.
The QModelIndex class is used to locate data in a data model.
QFuture< void > filter(Sequence &sequence, FilterFunction filterFunction)
void open()
Shows the dialog as a window modal dialog, returning immediately.
#define Q_DECLARE_PRIVATE(Class)
The QEvent class is the base class of all event classes.
void setVisible(bool visible)
Reimplemented Function
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
The QAction class provides an abstract user interface action that can be inserted into widgets...
Option
Some platforms allow the user to set a different icon.