![]() |
CopperSpice API
1.8.1
|
Provides a dialog which allow the selection of files or directories. More...
Public Typedefs | |
using | FileDialogOptions = QFlags< FileDialogOption > |
![]() | |
using | RenderFlags = QFlags< RenderFlag > |
Public Types | |
enum | AcceptMode |
enum | DialogLabel |
enum | FileDialogOption |
enum | FileMode |
enum | ViewMode |
![]() | |
enum | DialogCode |
![]() | |
enum | RenderFlag |
![]() | |
enum | PaintDeviceMetric |
Public Signals | |
void | currentChanged (const QString &path) |
void | currentUrlChanged (const QUrl &url) |
void | directoryEntered (const QString &directory) |
void | directoryUrlEntered (const QUrl &directory) |
void | fileSelected (const QString &file) |
void | filesSelected (const QStringList &files) |
void | filterSelected (const QString &filter) |
void | urlSelected (const QUrl &url) |
void | urlsSelected (const QList< QUrl > &urls) |
![]() | |
void | accepted () |
void | finished (int result) |
void | rejected () |
![]() | |
void | customContextMenuRequested (const QPoint &pos) |
void | windowIconChanged (const QIcon &icon) |
void | windowIconTextChanged (const QString &iconText) |
void | windowTitleChanged (const QString &title) |
![]() | |
void | destroyed (QObject *obj=nullptr) |
void | objectNameChanged (const QString &objectName) |
Public Slots | |
virtual void | open () |
![]() | |
virtual void | accept () |
virtual void | done (int result) |
virtual int | exec () |
virtual void | open () |
virtual void | reject () |
void | showExtension (bool showExt) |
![]() | |
bool | close () |
void | hide () |
void | lower () |
void | raise () |
void | repaint () |
void | setDisabled (bool disable) |
void | setEnabled (bool enable) |
void | setFocus () |
void | setHidden (bool hidden) |
void | setStyleSheet (const QString &styleSheet) |
virtual void | setVisible (bool visible) |
void | setWindowModified (bool modified) |
void | setWindowTitle (const QString &title) |
void | show () |
void | showFullScreen () |
void | showMaximized () |
void | showMinimized () |
void | showNormal () |
void | update () |
![]() | |
void | deleteLater () |
Public Methods | |
QFileDialog (QWidget *parent, Qt::WindowFlags flags) | |
QFileDialog (QWidget *parent=nullptr, const QString &caption=QString (), const QString &directory=QString (), const QString &filter=QString ()) | |
~QFileDialog () | |
AcceptMode | acceptMode () const |
bool | confirmOverwrite () const |
QString | defaultSuffix () const |
QDir | directory () const |
QUrl | directoryUrl () const |
FileMode | fileMode () const |
QDir::Filters | filter () const |
QStringList | history () const |
QFileIconProvider * | iconProvider () const |
bool | isNameFilterDetailsVisible () const |
bool | isReadOnly () const |
QAbstractItemDelegate * | itemDelegate () const |
QString | labelText (DialogLabel label) const |
QStringList | mimeTypeFilters () const |
QStringList | nameFilters () const |
void | open (QObject *receiver, const QString &member) |
FileDialogOptions | options () const |
QAbstractProxyModel * | proxyModel () const |
bool | resolveSymlinks () const |
bool | restoreState (const QByteArray &state) |
QByteArray | saveState () const |
QStringList | selectedFiles () const |
QString | selectedNameFilter () const |
QList< QUrl > | selectedUrls () const |
void | selectFile (const QString &filename) |
void | selectMimeTypeFilter (const QString &filter) |
void | selectNameFilter (const QString &filter) |
void | selectUrl (const QUrl &url) |
void | setAcceptMode (AcceptMode mode) |
void | setConfirmOverwrite (bool enabled) |
void | setDefaultSuffix (const QString &suffix) |
void | setDirectory (const QDir &directory) |
void | setDirectory (const QString &directory) |
void | setDirectoryUrl (const QUrl &directory) |
void | setFileMode (FileMode mode) |
void | setFilter (QDir::Filters filters) |
void | setHistory (const QStringList &paths) |
void | setIconProvider (QFileIconProvider *provider) |
void | setItemDelegate (QAbstractItemDelegate *delegate) |
void | setLabelText (DialogLabel label, const QString &text) |
void | setMimeTypeFilters (const QStringList &filters) |
void | setNameFilter (const QString &filter) |
void | setNameFilterDetailsVisible (bool enabled) |
void | setNameFilters (const QStringList &filters) |
void | setOption (FileDialogOption option, bool on=true) |
void | setOptions (FileDialogOptions options) |
void | setProxyModel (QAbstractProxyModel *model) |
void | setReadOnly (bool enabled) |
void | setResolveSymlinks (bool enabled) |
void | setSidebarUrls (const QList< QUrl > &urls) |
void | setSupportedSchemes (const QStringList &schemes) |
void | setViewMode (ViewMode mode) |
void | setVisible (bool visible) override |
QList< QUrl > | sidebarUrls () const |
QStringList | supportedSchemes () const |
bool | testOption (FileDialogOption option) const |
ViewMode | viewMode () const |
![]() | |
QDialog (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag) | |
~QDialog () | |
QWidget * | extension () const |
bool | isSizeGripEnabled () const |
QSize | minimumSizeHint () const override |
Qt::Orientation | orientation () const |
int | result () const |
void | setExtension (QWidget *extension) |
void | setModal (bool modal) |
void | setOrientation (Qt::Orientation orientation) |
void | setResult (int result) |
void | setSizeGripEnabled (bool enabled) |
void | setVisible (bool visible) override |
QSize | sizeHint () const override |
![]() | |
QWidget (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag) | |
~QWidget () | |
bool | acceptDrops () const |
QString | accessibleDescription () const |
QString | accessibleName () const |
QList< QAction * > | actions () const |
void | activateWindow () |
void | addAction (QAction *action) |
void | addActions (const QList< QAction * > &actions) |
void | adjustSize () |
bool | autoFillBackground () const |
QPalette::ColorRole | backgroundRole () const |
QBackingStore * | backingStore () const |
QSize | baseSize () const |
QWidget * | childAt (const QPoint &position) const |
QWidget * | childAt (int x, int y) const |
QRect | childrenRect () const |
QRegion | childrenRegion () const |
void | clearFocus () |
void | clearMask () |
QMargins | contentsMargins () const |
QRect | contentsRect () const |
Qt::ContextMenuPolicy | contextMenuPolicy () const |
QCursor | cursor () const |
WId | effectiveWinId () const |
void | ensurePolished () const |
Qt::FocusPolicy | focusPolicy () const |
QWidget * | focusProxy () const |
QWidget * | focusWidget () const |
const QFont & | font () const |
QFontInfo | fontInfo () const |
QFontMetrics | fontMetrics () const |
QPalette::ColorRole | foregroundRole () const |
QRect | frameGeometry () const |
QSize | frameSize () const |
const QRect & | geometry () const |
void | getContentsMargins (int *left, int *top, int *right, int *bottom) const |
QPixmap | grab (const QRect &rectangle=QRect (QPoint (0, 0), QSize (-1,-1))) |
void | grabGesture (Qt::GestureType gestureType, Qt::GestureFlags flags=Qt::GestureFlags ()) |
void | grabKeyboard () |
void | grabMouse () |
void | grabMouse (const QCursor &cursor) |
int | grabShortcut (const QKeySequence &key, Qt::ShortcutContext context=Qt::WindowShortcut) |
QGraphicsEffect * | graphicsEffect () const |
QGraphicsProxyWidget * | graphicsProxyWidget () const |
bool | hasEditFocus () const |
bool | hasFocus () const |
virtual bool | hasHeightForWidth () const |
bool | hasMouseTracking () const |
int | height () const |
virtual int | heightForWidth (int width) const |
Qt::InputMethodHints | inputMethodHints () const |
virtual QVariant | inputMethodQuery (Qt::InputMethodQuery query) const |
void | insertAction (QAction *before, QAction *action) |
void | insertActions (QAction *before, QList< QAction * > actions) |
bool | isActiveWindow () const |
bool | isAncestorOf (const QWidget *child) const |
bool | isEnabled () const |
bool | isEnabledTo (const QWidget *parent) const |
bool | isEnabledToTLW () const |
bool | isFullScreen () const |
bool | isHidden () const |
bool | isMaximized () const |
bool | isMinimized () const |
bool | isModal () const |
bool | isTopLevel () const |
bool | isVisible () const |
bool | isVisibleTo (const QWidget *parent) const |
bool | isWindow () const |
bool | isWindowModified () const |
QLayout * | layout () const |
Qt::LayoutDirection | layoutDirection () const |
QLocale | locale () const |
QPoint | mapFrom (const QWidget *parent, const QPoint &pos) const |
QPoint | mapFromGlobal (const QPoint &pos) const |
QPoint | mapFromParent (const QPoint &pos) const |
QPoint | mapTo (const QWidget *parent, const QPoint &pos) const |
QPoint | mapToGlobal (const QPoint &pos) const |
QPoint | mapToParent (const QPoint &pos) const |
QRegion | mask () const |
int | maximumHeight () const |
QSize | maximumSize () const |
int | maximumWidth () const |
int | minimumHeight () const |
QSize | minimumSize () const |
int | minimumWidth () const |
void | move (const QPoint &point) |
void | move (int x, int y) |
QWidget * | nativeParentWidget () const |
QWidget * | nextInFocusChain () const |
QRect | normalGeometry () const |
void | overrideWindowFlags (Qt::WindowFlags flags) |
QPaintEngine * | paintEngine () const override |
const QPalette & | palette () const |
QWidget * | parentWidget () const |
QPoint | pos () const |
QWidget * | previousInFocusChain () const |
QRect | rect () const |
void | releaseKeyboard () |
void | releaseMouse () |
void | releaseShortcut (int id) |
void | removeAction (QAction *action) |
void | render (QPaintDevice *target, const QPoint &targetOffset=QPoint (), const QRegion &sourceRegion=QRegion (), RenderFlags renderFlags=RenderFlags (DrawWindowBackground|DrawChildren)) |
void | render (QPainter *painter, const QPoint &targetOffset=QPoint (), const QRegion &sourceRegion=QRegion (), RenderFlags renderFlags=RenderFlags (DrawWindowBackground|DrawChildren)) |
void | repaint (const QRect &rect) |
void | repaint (const QRegion ®ion) |
void | repaint (int x, int y, int w, int h) |
void | resize (const QSize &size) |
void | resize (int w, int h) |
bool | restoreGeometry (const QByteArray &geometry) |
QByteArray | saveGeometry () const |
void | scroll (int dx, int dy) |
void | scroll (int dx, int dy, const QRect &rect) |
void | setAcceptDrops (bool on) |
void | setAccessibleDescription (const QString &description) |
void | setAccessibleName (const QString &name) |
void | setAttribute (Qt::WidgetAttribute attribute, bool enable=true) |
void | setAutoFillBackground (bool enable) |
void | setBackgroundRole (QPalette::ColorRole role) |
void | setBaseSize (const QSize &size) |
void | setBaseSize (int basew, int baseh) |
void | setContentsMargins (const QMargins &margins) |
void | setContentsMargins (int left, int top, int right, int bottom) |
void | setContextMenuPolicy (Qt::ContextMenuPolicy policy) |
void | setCursor (const QCursor &cursor) |
void | setEditFocus (bool enable) |
void | setFixedHeight (int h) |
void | setFixedSize (const QSize &size) |
void | setFixedSize (int w, int h) |
void | setFixedWidth (int w) |
void | setFocus (Qt::FocusReason reason) |
void | setFocusPolicy (Qt::FocusPolicy policy) |
void | setFocusProxy (QWidget *widget) |
void | setFont (const QFont &font) |
void | setForegroundRole (QPalette::ColorRole role) |
void | setGeometry (const QRect &rect) |
void | setGeometry (int x, int y, int w, int h) |
void | setGraphicsEffect (QGraphicsEffect *effect) |
void | setInputMethodHints (Qt::InputMethodHints hints) |
void | setLayout (QLayout *layout) |
void | setLayoutDirection (Qt::LayoutDirection direction) |
void | setLocale (const QLocale &locale) |
void | setMask (const QBitmap &bitmap) |
void | setMask (const QRegion ®ion) |
void | setMaximumHeight (int maxh) |
void | setMaximumSize (const QSize &size) |
void | setMaximumSize (int maxw, int maxh) |
void | setMaximumWidth (int maxw) |
void | setMinimumHeight (int minh) |
void | setMinimumSize (const QSize &size) |
void | setMinimumSize (int minw, int minh) |
void | setMinimumWidth (int minw) |
void | setMouseTracking (bool enable) |
void | setPalette (const QPalette &palette) |
void | setParent (QWidget *parent) |
void | setParent (QWidget *parent, Qt::WindowFlags flags) |
void | setShortcutAutoRepeat (int id, bool enable=true) |
void | setShortcutEnabled (int id, bool enable=true) |
void | setSizeIncrement (const QSize &size) |
void | setSizeIncrement (int w, int h) |
void | setSizePolicy (QSizePolicy policy) |
void | setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical) |
void | setStatusTip (const QString &data) |
void | setStyle (QStyle *style) |
void | setToolTip (const QString &data) |
void | setToolTipDuration (int msec) |
void | setUpdatesEnabled (bool enable) |
void | setWhatsThis (const QString &str) |
void | setWindowFilePath (const QString &filePath) |
void | setWindowFlags (Qt::WindowFlags flags) |
void | setWindowIcon (const QIcon &icon) |
void | setWindowModality (Qt::WindowModality windowModality) |
void | setWindowOpacity (qreal level) |
void | setWindowRole (const QString &role) |
void | setWindowState (Qt::WindowStates windowState) |
QSize | size () const |
QSize | sizeIncrement () const |
QSizePolicy | sizePolicy () const |
void | stackUnder (QWidget *widget) |
QString | statusTip () const |
QStyle * | style () const |
QString | styleSheet () const |
bool | testAttribute (Qt::WidgetAttribute attribute) const |
QString | toolTip () const |
int | toolTipDuration () const |
QWidget * | topLevelWidget () const |
bool | underMouse () const |
void | ungrabGesture (Qt::GestureType gestureType) |
void | unsetCursor () |
void | unsetLayoutDirection () |
void | unsetLocale () |
void | update (const QRect &rect) |
void | update (const QRegion ®ion) |
void | update (int x, int y, int w, int h) |
void | updateGeometry () |
bool | updatesEnabled () const |
QRegion | visibleRegion () const |
QString | whatsThis () const |
int | width () const |
QWidget * | window () const |
QString | windowFilePath () const |
Qt::WindowFlags | windowFlags () const |
QWindow * | windowHandle () const |
QIcon | windowIcon () const |
Qt::WindowModality | windowModality () const |
qreal | windowOpacity () const |
QString | windowRole () const |
Qt::WindowStates | windowState () const |
QString | windowTitle () const |
Qt::WindowType | windowType () const |
WId | winId () const |
int | x () const |
int | y () const |
![]() | |
QObject (QObject *parent=nullptr) | |
~QObject () | |
bool | blockSignals (bool block) |
const QList< QObject * > & | children () const |
bool | connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
bool | connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
bool | disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const |
bool | disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const |
bool | disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QString > | dynamicPropertyNames () const |
virtual bool | event (QEvent *event) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
template<typename T > | |
T | findChild (const QString &childName=QString ()) const |
template<class T > | |
QList< T > | findChildren (const QRegularExpression ®Exp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
template<class T > | |
QList< T > | findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
bool | inherits (const QString &className) const |
void | installEventFilter (QObject *filterObj) |
bool | isWidgetType () const |
bool | isWindowType () const |
void | killTimer (int id) |
const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const |
QObject * | parent () const |
template<class T = QVariant> | |
T | property (const QString &name) const |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const QString &name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer) |
QThread * | thread () const |
![]() | |
virtual | ~QPaintDevice () |
int | colorCount () const |
int | depth () const |
int | devicePixelRatio () const |
qreal | devicePixelRatioF () const |
int | height () const |
int | heightMM () const |
int | logicalDpiX () const |
int | logicalDpiY () const |
bool | paintingActive () const |
int | physicalDpiX () const |
int | physicalDpiY () const |
int | width () const |
int | widthMM () const |
Static Public Methods | |
static QString | getExistingDirectory (QWidget *parent=nullptr, const QString &caption=QString (), const QString &dir=QString (), FileDialogOptions options=ShowDirsOnly) |
static QUrl | getExistingDirectoryUrl (QWidget *parent=nullptr, const QString &caption=QString (), const QUrl &dir=QUrl (), FileDialogOptions options=ShowDirsOnly, const QStringList &supportedSchemes=QStringList ()) |
static QString | getOpenFileName (QWidget *parent=nullptr, const QString &caption=QString (), const QString &dir=QString (), const QString &filter=QString (), QString *selectedFilter=nullptr, FileDialogOptions options=FileDialogOptions ()) |
static QStringList | getOpenFileNames (QWidget *parent=nullptr, const QString &caption=QString (), const QString &dir=QString (), const QString &filter=QString (), QString *selectedFilter=nullptr, FileDialogOptions options=FileDialogOptions ()) |
static QUrl | getOpenFileUrl (QWidget *parent=nullptr, const QString &caption=QString (), const QUrl &dir=QUrl (), const QString &filter=QString (), QString *selectedFilter=nullptr, FileDialogOptions options=FileDialogOptions (), const QStringList &supportedSchemes=QStringList ()) |
static QList< QUrl > | getOpenFileUrls (QWidget *parent=nullptr, const QString &caption=QString (), const QUrl &dir=QUrl (), const QString &filter=QString (), QString *selectedFilter=nullptr, FileDialogOptions options=FileDialogOptions (), const QStringList &supportedSchemes=QStringList ()) |
static QString | getSaveFileName (QWidget *parent=nullptr, const QString &caption=QString (), const QString &dir=QString (), const QString &filter=QString (), QString *selectedFilter=nullptr, FileDialogOptions options=FileDialogOptions ()) |
static QUrl | getSaveFileUrl (QWidget *parent=nullptr, const QString &caption=QString (), const QUrl &dir=QUrl (), const QString &filter=QString (), QString *selectedFilter=nullptr, FileDialogOptions options=FileDialogOptions (), const QStringList &supportedSchemes=QStringList ()) |
![]() | |
static QWidget * | createWindowContainer (QWindow *window, QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag) |
static QWidget * | find (WId id) |
static QWidget * | keyboardGrabber () |
static QWidget * | mouseGrabber () |
static void | setTabOrder (QWidget *firstWidget, QWidget *secondWidget) |
![]() | |
static bool | connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ()) |
static bool | connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn > | |
static bool | connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T > | |
static bool | connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod) |
static bool | disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod) |
static bool | disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod) |
static bool | disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...)) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod) |
static QMetaObject & | staticMetaObject () |
static QString | tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >()) |
Protected Methods | |
void | accept () override |
void | changeEvent (QEvent *event) override |
void | done (int result) override |
![]() | |
void | closeEvent (QCloseEvent *event) override |
void | contextMenuEvent (QContextMenuEvent *event) override |
bool | eventFilter (QObject *object, QEvent *event) override |
void | keyPressEvent (QKeyEvent *event) override |
void | resizeEvent (QResizeEvent *event) override |
void | showEvent (QShowEvent *event) override |
![]() | |
virtual void | actionEvent (QActionEvent *event) |
void | create (WId window=0, bool initializeWindow=true, bool destroyOldWindow=true) |
void | destroy (bool destroyWindow=true, bool destroySubWindows=true) |
virtual void | dragEnterEvent (QDragEnterEvent *event) |
virtual void | dragLeaveEvent (QDragLeaveEvent *event) |
virtual void | dragMoveEvent (QDragMoveEvent *event) |
virtual void | dropEvent (QDropEvent *event) |
virtual void | enterEvent (QEvent *event) |
bool | event (QEvent *event) override |
virtual void | focusInEvent (QFocusEvent *event) |
bool | focusNextChild () |
virtual bool | focusNextPrevChild (bool next) |
virtual void | focusOutEvent (QFocusEvent *event) |
bool | focusPreviousChild () |
virtual void | hideEvent (QHideEvent *event) |
void | initPainter (QPainter *painter) const override |
virtual void | inputMethodEvent (QInputMethodEvent *event) |
virtual void | keyReleaseEvent (QKeyEvent *event) |
virtual void | leaveEvent (QEvent *event) |
int | metric (PaintDeviceMetric metric) const override |
virtual void | mouseDoubleClickEvent (QMouseEvent *event) |
virtual void | mouseMoveEvent (QMouseEvent *event) |
virtual void | mousePressEvent (QMouseEvent *event) |
virtual void | mouseReleaseEvent (QMouseEvent *event) |
virtual void | moveEvent (QMoveEvent *event) |
virtual bool | nativeEvent (const QByteArray &eventType, void *message, long *result) |
virtual void | paintEvent (QPaintEvent *event) |
virtual void | tabletEvent (QTabletEvent *event) |
virtual void | wheelEvent (QWheelEvent *event) |
![]() | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signalMethod) const |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signalMethod) const |
bool | isSignalConnected (const QMetaMethod &signalMethod) const |
int | receivers (const QString &signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
![]() | |
QPaintDevice () | |
Friends | |
class | QPlatformDialogHelper |
Additional Inherited Members | |
![]() | |
void | updateMicroFocus () |
![]() | |
QWidgetList | |
WId | |
![]() | |
T | qobject_cast (QObject *object) |
QObjectList | |
The QFileDialog class provides a dialog which allows the selection of files or directories. It is generally easier to create a QFileDialog using the static methods. On Windows, OS X, KDE, and GNOME, these static methods will call the native file dialog when possible.
In the following example a modal dialog is created using a static method. The dialog will initially display the contents of the "/home/frank" directory and every file which matches the given filter. The parent of the file dialog will be this, the title is "Open Image", and the filter is "Image Files (*.png *.jpg *.bmp)".
To use multiple filters separate each one with two semicolons as shown below.
This example shows how to create a QFileDialog without using the static methods. The call to setFileMode() is used to specify what type of file or directory the user may select.
Use the setNameFilter() method to set the filter of what files will be displayed.
There are two different view modes.
The last method you will need when creating your own file dialog is selectedFiles(). When the user selects a file and then clicks OK, the file name is assigned to the variable fileNames
.
Typedef for QFlags<FileDialogOption>. Refer to QDir::SortFlag for documentation.
Constant | Value |
---|---|
QFileDialog::AcceptOpen | 0 |
QFileDialog::AcceptSave | 1 |
Constant | Value |
---|---|
QFileDialog::LookIn | 0 |
QFileDialog::FileName | 1 |
QFileDialog::FileType | 2 |
QFileDialog::Accept | 3 |
QFileDialog::Reject | 4 |
This enum indicates various settings for how the file dialog should be displayed.
Constant | Value | Description |
---|---|---|
QFileDialog::ShowDirsOnly | 0x00000001 | Only show directories in the file dialog. By default both files and directories are shown. (Valid only in the Directory file mode.) |
QFileDialog::DontResolveSymlinks | 0x00000002 | Do not resolve symlinks in the file dialog. By default symlinks are resolved. |
QFileDialog::DontConfirmOverwrite | 0x00000004 | Do not ask for confirmation if an existing file is selected. By default confirmation is requested. |
QFileDialog::DontUseSheet | 0x00000008 | The static functions will always be an application modal dialog. If you want to use sheets, use QFileDialog::open() instead. |
QFileDialog::DontUseNativeDialog | 0x00000010 | Do not use the native file dialog. By default, the native file dialog is used unless you use a subclass of QFileDialog that contains the CS_OBJECT macro, or the platform does not have a native dialog of the type that you require. |
QFileDialog::ReadOnly | 0x00000020 | Indicates that the model is readonly. |
QFileDialog::HideNameFilterDetails | 0x00000040 | Indicates if the file name filter details are hidden or not. |
QFileDialog::ForceInitialDir_Win7 | 0x00000080 | Force Windows 7 to honor initial path |
QFileDialog::DontUseCustomDirectoryIcons | 0x00000100 | Always use the default directory icon. Some platforms allow the user to set a different icon. Custom icon lookup cause a big performance impact over network or removable drives. Setting this will enable the QFileIconProvider::DontUseCustomDirectoryIcons option in the icon provider. |
This enum is used to indicate what the user may select in the file dialog. For example, what the dialog will return if the user clicks OK.
Constant | Value | Description |
---|---|---|
QFileDialog::AnyFile | 0 | The name of a file whether it exists or not. |
QFileDialog::ExistingFile | 1 | The name of a single existing file. |
QFileDialog::Directory | 2 | The name of a directory. Both files and directories are displayed. |
QFileDialog::ExistingFiles | 3 | The names of zero or more existing files. |
The following value is obsolete.
Constant | Value | Description |
---|---|---|
QFileDialog::DirectoryOnly | 4 | Use Directory and setOption(ShowDirsOnly, true) instead. |
This enum describes the view mode of the file dialog; for example what information about each file will be displayed.
Constant | Value | Description |
---|---|---|
QFileDialog::Detail | 0 | Displays an icon, a name, and details for each item in the directory. |
QFileDialog::List | 1 | Displays only an icon and a name for each item in the directory. |
|
deprecated |
Constructs a file dialog with the given parent and flags.
|
explicit |
Constructs a file dialog with the given parent and caption that initially displays the contents of the specified directory. The contents of the directory are filtered before being shown in the dialog, using a semicolon-separated list of filters specified by filter.
QFileDialog::~QFileDialog | ( | ) |
Destroys the file dialog.
|
overrideprotected |
Reimplemented from QDialog::accept()
AcceptMode QFileDialog::acceptMode | ( | ) | const |
Returns the value of the property.
|
overrideprotectedvirtual |
Reimplemented from QWidget::changeEvent()
bool QFileDialog::confirmOverwrite | ( | ) | const |
Returns the value of the property.
|
signal |
When the current file changes this signal is emitted with the new file name as the path parameter.
|
signal |
When the current file changes this signal is emitted with the new file URL as the url parameter.
QString QFileDialog::defaultSuffix | ( | ) | const |
Returns the value of the property.
QDir QFileDialog::directory | ( | ) | const |
Returns the directory currently being displayed in the dialog.
|
signal |
This signal is emitted when the user enters a directory.
QUrl QFileDialog::directoryUrl | ( | ) | const |
Returns the url of the directory currently being displayed in the dialog.
|
signal |
This signal is emitted when the user enters a directory.
|
overrideprotected |
Reimplemented from QDialog::done()
FileMode QFileDialog::fileMode | ( | ) | const |
Returns the value of the property.
|
signal |
When the selection changes and the dialog is accepted this signal is emitted with the (possibly empty) selected file.
|
signal |
When the selection changes and the dialog is accepted this signal is emitted with the (possibly empty) list of files.
QDir::Filters QFileDialog::filter | ( | ) | const |
Returns the filter that is used when displaying files.
|
signal |
This signal is emitted when the user selects a filter.
|
static |
This is a convenience method which will return an existing directory selected by the user.
This method creates a modal file dialog with the given parent. If parent is not a nullptr, the dialog will be shown centered over the parent widget. The dialog's working directory is set to dir, and the title is set to caption. Either of these may be an empty string in which case the current directory and a default caption will be used.
The options argument holds various options about how to run the dialog. Refer to the FileDialogOption enum for more information on the flags which can be passed. To ensure a native file dialog, ShowDirsOnly must be set.
On Windows and Mac OS X this static method will use a native file dialog and not one created by this class. On Windows the dialog will run a blocking modal event loop that will not dispatch any QTimers, and if parent is not a nullptr then it will position the dialog just below the parent's title bar.
On Unix/X11, the normal behavior of the file dialog is to resolve and follow symlinks. For example, if /usr/tmp
is a symlink to /var/tmp
, the file dialog will change to /var/tmp
after entering /usr/tmp
. If options includes DontResolveSymlinks, the file dialog will treat symlinks as regular directories.
|
static |
This is a convenience method which will return an existing directory selected by the user. If the user presses Cancel an empty url is returned.
The method is used similarly to QFileDialog::getExistingDirectory(). In particular parent, caption, dir and options are used in the exact same way. The main difference between this method and QFileDialog::getExistingDirectory(), is this method allows the user to select a remote directory.
The supportedSchemes argument allows to restrict the type of URLs the user will be able to select. It is a way for the application to declare the protocols it will support to fetch the file content. An empty list means that no restriction is applied (the default). Supported for local files ("file" scheme) is implicit and always enabled. it is not necessary to include in the restriction.
When possible this method will use a native file dialog and not one created by this class. On platforms which do not support selecting remote files this method will allow the user to select only local files.
|
static |
This is a convenience method which returns an existing file selected by the user. If the user presses Cancel an empty string is returned.
The method creates a modal file dialog with the given parent. If parent is not a nullptr, the dialog will be shown centered over the parent widget.
The file dialog's working directory will be set to dir. If dir includes a file name, the file will be selected. Only files that match the given filter are shown. The filter selected is set to selectedFilter. The parameters dir, selectedFilter, and filter may be empty strings. If you want multiple filters separate them with ';;'.
The options argument holds various options about how to run the dialog. Refer to the FileDialogOption enum for more information on the flags which can be passed. The dialog's title is set to caption. If caption is not specified then a default caption will be used.
On Windows and Mac OS X this static method will use a native file dialog and not one created by this class. On Windows the dialog will run a blocking modal event loop that will not dispatch any QTimers, and if parent is not a nullptr then it will position the dialog just below the parent's title bar.
On Unix/X11, the normal behavior of the file dialog is to resolve and follow symlinks. For example, if /usr/tmp
is a symlink to /var/tmp
, the file dialog will change to /var/tmp
after entering /usr/tmp
. If options includes DontResolveSymlinks, the file dialog will treat symlinks as regular directories.
|
static |
This is a convenience method which returns one or more existing files selected by the user.
This method creates a modal file dialog with the given parent. If parent is not a nullptr the dialog will be shown centered over the parent widget.
The file dialog's working directory will be set to dir. If dir includes a file name, the file will be selected. The filter is set to filter so that only those files which match the filter are shown. The filter selected is set to selectedFilter. The parameters dir, selectedFilter, and filter may be empty strings. If you need multiple filters separate them with ';;'.
The dialog's title is set to caption. If caption is not specified then a default caption will be used.
On Windows and Mac OS X this static method will use a native file dialog and not created by this class. On Windows the dialog will run a blocking modal event loop that will not dispatch any QTimers, and if parent is not a nullptr then it will position the dialog just below the parent's title bar.
On Unix/X11, the normal behavior of the file dialog is to resolve and follow symlinks. For example, if /usr/tmp
is a symlink to /var/tmp
, the file dialog will change to /var/tmp
after entering /usr/tmp
. The options argument holds various options about how to run the dialog, see the QFileDialog::Option enum for more information on the flags you can pass.
|
static |
This is a convenience method which returns an existing file selected by the user. If the user presses Cancel an empty url is returned.
The method is used similarly to QFileDialog::getOpenFileName(). The values for parent, caption, dir, filter, selectedFilter, and options are used in the exact same way. The main difference between this method and QFileDialog::getOpenFileName(), is this method allows the user to select a remote file.
The supportedSchemes argument allows to restrict the type of URLs the user will be able to select. It is a way for the application to declare the protocols it will support to fetch the file content. An empty list means that no restriction is applied (the default). Supported for local files ("file" scheme) is implicit and always enabled, it is not necessary to include it in the restriction.
When possible this method will use the native file dialog and not a QFileDialog. On platforms which do not support selecting remote files the user will only be allowed to select local files.
|
static |
This is a convenience method which will return one or more existing files selected by the user. If the user presses Cancel an empty list is returned.
The method is used similarly to QFileDialog::getOpenFileNames(). In values for parent, caption, dir, filter, selectedFilter, and options are used in the exact same way. The main difference between this method and QFileDialog::getOpenFileName(), is this method allows the user to select a remote file.
The supportedSchemes argument allows to restrict the type of URLs the user will be able to select. It is a way for the application to declare the protocols it will support to fetch the file content. An empty list means that no restriction is applied (the default). Supported for local files ("file" scheme) is implicit and always enabled; it is not necessary to include it in the restriction.
When possible this static method will use the native file dialog and not a QFileDialog. On platforms which do not support selecting remote files the user will only be allowed to select local files.
|
static |
This is a convenience method which will return a file selected by the user. The file does not have to exist.
It creates a modal file dialog with the given parent. If parent is not a nullptr the dialog will be shown centered over the parent widget.
The file dialog's working directory will be set to dir. If dir includes a file name, the file will be selected. Only files that match the filter are shown. The filter selected is set to selectedFilter. The parameters dir, selectedFilter, and filter may be empty strings. Multiple filters are separated with ';;'.
The options argument holds various options about how to display the dialog. Refer to the FileDialogOption enum for more information on the flags which can be passed. The default filter can be chosen by setting selectedFilter to the desired value. The dialog's caption is set to caption. If caption is not specified a default caption will be used.
On Windows and OS X this static method will use a native file dialog and not one created by this class. On Windows the dialog will run a blocking modal event loop that will not dispatch any QTimers, and if parent is not a nullptr then it will position the dialog just below the parent's title bar. On Mac OS X with its native file dialog, the filter argument is ignored.
On Unix/X11, the normal behavior of the file dialog is to resolve and follow symlinks. For example, if /usr/tmp
is a symlink to /var/tmp
, the file dialog will change to /var/tmp
after entering /usr/tmp
. If options includes DontResolveSymlinks the file dialog will treat symlinks as regular directories.
|
static |
This is a convenience method which returns a file selected by the user. The file does not have to exist. If the user presses Cancel an empty url is returned.
The method is used similarly to QFileDialog::getSaveFileName(). The values for parent, caption, dir, filter, selectedFilter and options are used in the exact same way. The main difference between this method and QFileDialog::getSaveFileName(), is this method allows the user to select a remote file.
The supportedSchemes argument allows to restrict the type of URLs the user will be able to select. It is a way for the application to declare the protocols it will support to save the file content. An empty list means that no restriction is applied (the default). Supported for local files ("file" scheme) is implicit and always enabled. it is not necessary to include in the restriction.
When possible this method will use a native file dialog and not one created by this class. On platforms which do not support selecting remote files this method will allow the user to select only local files.
QStringList QFileDialog::history | ( | ) | const |
Returns the browsing history of the QFileDialog as a list of paths.
QFileIconProvider * QFileDialog::iconProvider | ( | ) | const |
Returns the icon provider used by the QFileDialog.
bool QFileDialog::isNameFilterDetailsVisible | ( | ) | const |
Returns the value of the property.
bool QFileDialog::isReadOnly | ( | ) | const |
Returns the value of the property.
QAbstractItemDelegate * QFileDialog::itemDelegate | ( | ) | const |
Returns the item delegate used to render the items in the views in the QFileDialog.
QString QFileDialog::labelText | ( | DialogLabel | label | ) | const |
Returns the text shown in the QFileDialog in the specified label.
QStringList QFileDialog::mimeTypeFilters | ( | ) | const |
Returns the MIME type filters that are in operation on this QFileDialog.
QStringList QFileDialog::nameFilters | ( | ) | const |
Returns the file type filters that are in operation on this QFileDialog.
|
usingslot |
Shows the dialog as a window modal dialog, returning immediately.
This method connects one of its signals to the slot specified by receiver and member. The specific signal depends is filesSelected() if fileMode is ExistingFiles and fileSelected() if fileMode is anything else.
The signal will be disconnected from the slot when the dialog is closed.
FileDialogOptions QFileDialog::options | ( | ) | const |
Returns the value of the property.
QAbstractProxyModel * QFileDialog::proxyModel | ( | ) | const |
Returns the proxy model used by the file dialog. By default no proxy is set.
bool QFileDialog::resolveSymlinks | ( | ) | const |
Returns the value of the property.
bool QFileDialog::restoreState | ( | const QByteArray & | state | ) |
Restores the dialog's layout, history and current directory to the state specified. Typically this is used in conjunction with QSettings to restore the size from a past session.
Returns false if there are errors
QByteArray QFileDialog::saveState | ( | ) | const |
Saves the state of the dialog's layout, history and current directory. Typically this is used in conjunction with QSettings to remember the size for a future session. A version number is stored as part of the data.
QStringList QFileDialog::selectedFiles | ( | ) | const |
Returns a list of strings containing the absolute paths of the selected files in the dialog. If no files are selected, or the mode is not ExistingFiles or ExistingFile, selectedFiles() contains the current path in the viewport.
QString QFileDialog::selectedNameFilter | ( | ) | const |
Returns the filter that the user selected in the file dialog.
Returns a list of urls containing the selected files in the dialog. If no files are selected, or the mode is not ExistingFiles or ExistingFile, selectedUrls() contains the current path in the viewport.
void QFileDialog::selectFile | ( | const QString & | filename | ) |
Selects the given filename in the file dialog.
void QFileDialog::selectMimeTypeFilter | ( | const QString & | filter | ) |
Sets the current MIME type to filter.
void QFileDialog::selectNameFilter | ( | const QString & | filter | ) |
Sets the current file type filter. Multiple filters can be passed in filter by separating them with semicolons or spaces.
void QFileDialog::selectUrl | ( | const QUrl & | url | ) |
Selects the given url in the file dialog.
void QFileDialog::setAcceptMode | ( | AcceptMode | mode | ) |
Sets the value of the property to mode.
void QFileDialog::setConfirmOverwrite | ( | bool | enabled | ) |
Sets the value of the property to enabled.
void QFileDialog::setDefaultSuffix | ( | const QString & | suffix | ) |
Sets the value of the property to suffix.
|
inline |
Sets the file dialog's current directory to directory.
void QFileDialog::setDirectory | ( | const QString & | directory | ) |
Sets the file dialog's current directory to directory.
void QFileDialog::setDirectoryUrl | ( | const QUrl & | directory | ) |
Sets the file dialog's current directory to directory.
For Windows it is possible to pass URLs representing one of the virtual folders, such as "Computer" or "Network". This is done by passing a QUrl using the scheme clsid followed by the CLSID value with the curly braces removed. For example the URL clsid:374DE290-123F-4565-9164-39C4925E467B denotes the download location. For a complete list of possible values, see the MSDN documentation on KNOWNFOLDERID.
void QFileDialog::setFileMode | ( | FileMode | mode | ) |
This method will set the labels for the FileName and Accept DialogLabels based on the given mode. It is possible to set custom text after the call to defilement().
void QFileDialog::setFilter | ( | QDir::Filters | filters | ) |
Sets the filter used by the model to filters. The filter is used to specify the kind of files which are displayed.
void QFileDialog::setHistory | ( | const QStringList & | paths | ) |
Sets the browsing history of the QFileDialog to contain the given paths.
void QFileDialog::setIconProvider | ( | QFileIconProvider * | provider | ) |
Sets the icon provider used by the QFileDialog to the specified provider.
void QFileDialog::setItemDelegate | ( | QAbstractItemDelegate * | delegate | ) |
The item delegate is used when displaying file names and directories. It is set to the given delegate.
Delegate are used in conjunction with a model. For QFileDialog the model is the QFileSystemModel which has custom data roles specific to files.
Refer to QFileIconProvider if you only want custom icons.
void QFileDialog::setLabelText | ( | DialogLabel | label, |
const QString & | text | ||
) |
Sets the text shown in the QFileDialog for the specified label.
void QFileDialog::setMimeTypeFilters | ( | const QStringList & | filters | ) |
This is a convenience method for setNameFilters().
Sets the filters used in the file dialog from a list of MIME types. Uses QMimeType to create a name filter from the glob patterns and description defined in each MIME type. Use application/octet-stream for the "All files (*)" filter, since that is the base MIME type for all files.
Calling setMimeTypeFilters overrides any previously set name filters, and changes the return value of nameFilters().
void QFileDialog::setNameFilter | ( | const QString & | filter | ) |
Sets the filter used in the file dialog to the given filter. If filter contains a pair of parentheses containing one or more of anything*something, separated by spaces, then only the text contained in the parentheses is used as the filter. This means the follow calls are equivalent.
void QFileDialog::setNameFilterDetailsVisible | ( | bool | enabled | ) |
Sets the value of the property to enables.
void QFileDialog::setNameFilters | ( | const QStringList & | filters | ) |
Sets the filters used in the file dialog.
void QFileDialog::setOption | ( | FileDialogOption | option, |
bool | on = true |
||
) |
Sets the given option to be enabled if on is true, otherwise clears the given option.
void QFileDialog::setOptions | ( | FileDialogOptions | options | ) |
Sets the value of the property to options.
void QFileDialog::setProxyModel | ( | QAbstractProxyModel * | model | ) |
Sets the model for the views to the given model. This is useful if you want to modify the underlying model. For example, to add columns, filter data, or add drives. Any existing proxy model will be removed, but not deleted. The file dialog will take ownership of the proxyModel.
void QFileDialog::setReadOnly | ( | bool | enabled | ) |
Sets the value of the property to enabled.
void QFileDialog::setResolveSymlinks | ( | bool | enabled | ) |
Sets the value of the property to enabled.
Sets the urls that are located in the sidebar.
The file dialog will then look like this:
void QFileDialog::setSupportedSchemes | ( | const QStringList & | schemes | ) |
Sets the value of the property to schemes.
void QFileDialog::setViewMode | ( | ViewMode | mode | ) |
Sets the value of the property to mode.
|
override |
Sets the value of the property to visible.
Returns a list of urls that are currently in the sidebar.
QStringList QFileDialog::supportedSchemes | ( | ) | const |
Returns the value of the property.
bool QFileDialog::testOption | ( | FileDialogOption | option | ) | const |
Returns true if the given option is enabled, otherwise returns false.
|
signal |
When the selection changes and the dialog is accepted, this signal is emitted with the (possibly empty) selected url.
When the selection changes and the dialog is accepted, this signal is emitted with the (possibly empty) list of selected urls.
ViewMode QFileDialog::viewMode | ( | ) | const |
Returns the value of the property.
|
This property holds the accept mode of the dialog. The action mode defines whether the dialog is for opening or saving files. By default, this property is set to AcceptOpen.
Properties | Class Methods |
---|---|
read | acceptMode |
write | setAcceptMode |
|
deprecated |
Use setOption(DontConfirmOverwrite, !enabled) or !testOption(DontConfirmOverwrite) instead.
Properties | Class Methods |
---|---|
read | confirmOverwrite |
write | setConfirmOverwrite |
designable | true |
|
This property holds the suffix added to the filename if no other suffix was specified.
This property specifies a string that will be added to the filename if it has no suffix already. The suffix is typically used to indicate the file type. For example "txt" indicates a text file.
If the first character is a dot ('.'), it is removed.
Properties | Class Methods |
---|---|
read | defaultSuffix |
write | setDefaultSuffix |
|
This property holds the file mode of the dialog.
The file mode defines the number and type of items that the user is expected to select in the dialog. By default, this property is set to AnyFile.
Properties | Class Methods |
---|---|
read | fileMode |
write | setFileMode |
|
deprecated |
When this property is true (the default), the filter details are shown in the combo box. When the property is set to false, these are hidden.
Use setOption(HideNameFilterDetails, !enabled) or !testOption(HideNameFilterDetails).
Properties | Class Methods |
---|---|
read | isNameFilterDetailsVisible |
write | setNameFilterDetailsVisible |
designable | true |
|
This property holds the various options that affect the look and feel of the dialog. By default, all options are disabled.
Options should be set before showing the dialog. Setting them while the dialog is visible is not guaranteed to have an immediate effect on the dialog (depending on the option and on the platform).
Properties | Class Methods |
---|---|
read | options |
write | setOptions |
|
deprecated |
If this property is set to false, the file dialog will allow renaming, and deleting of files and directories and creating directories.
Use setOption(ReadOnly, enabled) or testOption(ReadOnly) instead.
Properties | Class Methods |
---|---|
read | isReadOnly |
write | setReadOnly |
designable | true |
|
deprecated |
If this property is set to true, the file dialog will resolve shortcuts or symbolic links.
Use setOption(DontResolveSymlinks, !enabled) or !testOption(DontResolveSymlinks).
Properties | Class Methods |
---|---|
read | resolveSymlinks |
write | setResolveSymlinks |
designable | true |
|
This property holds the URL schemes that the file dialog should allow navigating to.
Setting this property allows to restrict the type of URLs the user will be able to select. It is a way for the application to declare the protocols it will support to fetch the file content. An empty list means that no restriction is applied (the default). Supported for local files ("file" scheme) is implicit and always enabled; it is not necessary to include it in the restriction.
Properties | Class Methods |
---|---|
read | supportedSchemes |
write | setSupportedSchemes |
|
This property holds the way files and directories are displayed in the dialog. By default, the Detail
mode is used to display information about files and directories.
Properties | Class Methods |
---|---|
read | viewMode |
write | setViewMode |