Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquicklabsplatformfiledialog_p.h
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQUICKLABSPLATFORMFILEDIALOG_P_H
5#define QQUICKLABSPLATFORMFILEDIALOG_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
19#include <QtCore/qurl.h>
20#include <QtQml/qqml.h>
21
23
25
27{
32 Q_PROPERTY(QUrl file READ file WRITE setFile NOTIFY fileChanged FINAL)
37 Q_PROPERTY(QFileDialogOptions::FileDialogOptions options READ options WRITE setOptions RESET resetOptions NOTIFY optionsChanged FINAL)
43
44public:
46
53
54 FileMode fileMode() const;
56
57 QUrl file() const;
58 void setFile(const QUrl &file);
59
60 QList<QUrl> files() const;
61 void setFiles(const QList<QUrl> &files);
62
63 QUrl currentFile() const;
64 void setCurrentFile(const QUrl &file);
65
66 QList<QUrl> currentFiles() const;
67 void setCurrentFiles(const QList<QUrl> &files);
68
69 QUrl folder() const;
70 void setFolder(const QUrl &folder);
71
72 QFileDialogOptions::FileDialogOptions options() const;
73 void setOptions(QFileDialogOptions::FileDialogOptions options);
74 void resetOptions();
75
78 void resetNameFilters();
79
81
82 QString defaultSuffix() const;
83 void setDefaultSuffix(const QString &suffix);
84 void resetDefaultSuffix();
85
86 QString acceptLabel() const;
87 void setAcceptLabel(const QString &label);
88 void resetAcceptLabel();
89
90 QString rejectLabel() const;
91 void setRejectLabel(const QString &label);
92 void resetRejectLabel();
93
106
107protected:
108 bool useNativeDialog() const override;
109 void onCreate(QPlatformDialogHelper *dialog) override;
110 void onShow(QPlatformDialogHelper *dialog) override;
111 void onHide(QPlatformDialogHelper *dialog) override;
112 void accept() override;
113
114private:
115 QUrl addDefaultSuffix(const QUrl &file) const;
116 QList<QUrl> addDefaultSuffixes(const QList<QUrl> &files) const;
117
118 FileMode m_fileMode;
119 QList<QUrl> m_files;
120 bool m_firstShow = true;
121 QSharedPointer<QFileDialogOptions> m_options;
122 mutable QQuickLabsPlatformFileNameFilter *m_selectedNameFilter;
123};
124
126{
129 Q_PROPERTY(int index READ index WRITE setIndex NOTIFY indexChanged FINAL)
132
133public:
135
136 int index() const;
137 void setIndex(int index);
138
139 QString name() const;
140 QStringList extensions() const;
141
144
145 void update(const QString &filter);
146
151
152private:
153 QStringList nameFilters() const;
154 QString nameFilter(int index) const;
155
156 int m_index;
157 QString m_name;
158 QStringList m_extensions;
160};
161
163
164#endif // QQUICKLABSPLATFORMFILEDIALOG_P_H
Definition qlist.h:75
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
The QPlatformDialogHelper class allows for platform-specific customization of dialogs.
void setFiles(const QList< QUrl > &files)
void setOptions(QFileDialogOptions::FileDialogOptions options)
QFileDialogOptions::FileDialogOptions options
void onShow(QPlatformDialogHelper *dialog) override
void setDefaultSuffix(const QString &suffix)
void setNameFilters(const QStringList &filters)
void accept() override
\qmlmethod void Qt.labs.platform::Dialog::accept()
QQuickLabsPlatformFileNameFilter * selectedNameFilter
void onCreate(QPlatformDialogHelper *dialog) override
void onHide(QPlatformDialogHelper *dialog) override
void setCurrentFiles(const QList< QUrl > &files)
void extensionsChanged(const QStringList &extensions)
void setOptions(const QSharedPointer< QFileDialogOptions > &options)
void nameChanged(const QString &name)
QSharedPointer< QFileDialogOptions > options() const
\inmodule QtCore
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qurl.h:94
Combined button and popup list for selecting options.
GLuint index
[2]
GLuint GLsizei const GLchar * label
[43]
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLuint name
#define QML_ANONYMOUS
#define QML_NAMED_ELEMENT(NAME)
#define QML_EXTENDED_NAMESPACE(EXTENDED_NAMESPACE)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SIGNALS
#define explicit
QFileDialog dialog(this)
[1]
const QStringList filters({"Image files (*.png *.xpm *.jpg)", "Text files (*.txt)", "Any files (*)" })
[6]