File: qfiledialog.sip

package info (click to toggle)
pyqt5 5.11.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 15,956 kB
  • sloc: python: 93,806; cpp: 21,390; xml: 285; makefile: 266; sh: 31
file content (352 lines) | stat: -rw-r--r-- 12,484 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
// qfiledialog.sip generated by MetaSIP
//
// This file is part of the QtWidgets Python extension module.
//
// Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
// 
// This file is part of PyQt5.
// 
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file.  Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
// 
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license.  For more information contact
// info@riverbankcomputing.com.
// 
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.


class QFileDialog : QDialog
{
%TypeHeaderCode
#include <qfiledialog.h>
%End

public:
    enum ViewMode
    {
        Detail,
        List,
    };

    enum FileMode
    {
        AnyFile,
        ExistingFile,
        Directory,
        ExistingFiles,
        DirectoryOnly,
    };

    enum AcceptMode
    {
        AcceptOpen,
        AcceptSave,
    };

    enum DialogLabel
    {
        LookIn,
        FileName,
        FileType,
        Accept,
        Reject,
    };

    enum Option
    {
        ShowDirsOnly,
        DontResolveSymlinks,
        DontConfirmOverwrite,
        DontUseSheet,
        DontUseNativeDialog,
        ReadOnly,
        HideNameFilterDetails,
%If (Qt_5_2_0 -)
        DontUseCustomDirectoryIcons,
%End
    };

    typedef QFlags<QFileDialog::Option> Options;
    QFileDialog(QWidget *parent /TransferThis/, Qt::WindowFlags f);
    QFileDialog(QWidget *parent /TransferThis/ = 0, const QString &caption = QString(), const QString &directory = QString(), const QString &filter = QString());
    virtual ~QFileDialog();
    void setDirectory(const QString &directory);
    void setDirectory(const QDir &adirectory);
    QDir directory() const;
    void selectFile(const QString &filename);
    QStringList selectedFiles() const;
    void setViewMode(QFileDialog::ViewMode mode);
    QFileDialog::ViewMode viewMode() const;
    void setFileMode(QFileDialog::FileMode mode);
    QFileDialog::FileMode fileMode() const;
    void setAcceptMode(QFileDialog::AcceptMode mode);
    QFileDialog::AcceptMode acceptMode() const;
    void setDefaultSuffix(const QString &suffix);
    QString defaultSuffix() const;
    void setHistory(const QStringList &paths);
    QStringList history() const;
    void setItemDelegate(QAbstractItemDelegate *delegate /KeepReference/);
    QAbstractItemDelegate *itemDelegate() const;
    void setIconProvider(QFileIconProvider *provider /KeepReference/);
    QFileIconProvider *iconProvider() const;
    void setLabelText(QFileDialog::DialogLabel label, const QString &text);
    QString labelText(QFileDialog::DialogLabel label) const;

signals:
    void currentChanged(const QString &path);
    void directoryEntered(const QString &directory);
    void filesSelected(const QStringList &files);
    void filterSelected(const QString &filter);
    void fileSelected(const QString &file);

public:
    static QString getExistingDirectory(QWidget *parent = 0, const QString &caption = QString(), const QString &directory = QString(), QFileDialog::Options options = QFileDialog::ShowDirsOnly) /ReleaseGIL/;
%If (Qt_5_2_0 -)
    static QUrl getExistingDirectoryUrl(QWidget *parent = 0, const QString &caption = QString(), const QUrl &directory = QUrl(), QFileDialog::Options options = QFileDialog::ShowDirsOnly, const QStringList &supportedSchemes = QStringList()) /ReleaseGIL/;
%End
    static SIP_PYTUPLE getOpenFileName(QWidget *parent = 0, const QString &caption = QString(), const QString &directory = QString(), const QString &filter = QString(), const QString &initialFilter = QString(), Options options = 0) /TypeHint="Tuple[QString, QString]", ReleaseGIL/;
%MethodCode
        QString *name;
        QString *filter = new QString(*a4);
        
        Py_BEGIN_ALLOW_THREADS
        
        name = new QString(QFileDialog::getOpenFileName(a0, *a1, *a2, *a3, filter, *a5));
        
        Py_END_ALLOW_THREADS
        
        PyObject *name_obj = sipConvertFromNewType(name, sipType_QString, NULL);
        PyObject *filter_obj = sipConvertFromNewType(filter, sipType_QString, NULL);
        
        if (name_obj && filter_obj)
            sipRes = PyTuple_Pack(2, name_obj, filter_obj);
        
        Py_XDECREF(name_obj);
        Py_XDECREF(filter_obj);
%End

    static SIP_PYTUPLE getOpenFileNames(QWidget *parent = 0, const QString &caption = QString(), const QString &directory = QString(), const QString &filter = QString(), const QString &initialFilter = QString(), Options options = 0) /TypeHint="Tuple[QStringList, QString]", ReleaseGIL/;
%MethodCode
        QStringList *names;
        QString *filter = new QString(*a4);
        
        Py_BEGIN_ALLOW_THREADS
        
        names = new QStringList(QFileDialog::getOpenFileNames(a0, *a1, *a2, *a3, filter, *a5));
        
        Py_END_ALLOW_THREADS
        
        PyObject *names_obj = sipConvertFromNewType(names, sipType_QStringList, NULL);
        PyObject *filter_obj = sipConvertFromNewType(filter, sipType_QString, NULL);
        
        if (names_obj && filter_obj)
            sipRes = PyTuple_Pack(2, names_obj, filter_obj);
        
        Py_XDECREF(names_obj);
        Py_XDECREF(filter_obj);
%End

    static SIP_PYTUPLE getSaveFileName(QWidget *parent = 0, const QString &caption = QString(), const QString &directory = QString(), const QString &filter = QString(), const QString &initialFilter = QString(), Options options = 0) /TypeHint="Tuple[QString, QString]", ReleaseGIL/;
%MethodCode
        QString *name;
        QString *filter = new QString(*a4);
        
        Py_BEGIN_ALLOW_THREADS
        
        name = new QString(QFileDialog::getSaveFileName(a0, *a1, *a2, *a3, filter, *a5));
        
        Py_END_ALLOW_THREADS
        
        PyObject *name_obj = sipConvertFromNewType(name, sipType_QString, NULL);
        PyObject *filter_obj = sipConvertFromNewType(filter, sipType_QString, NULL);
        
        if (name_obj && filter_obj)
            sipRes = PyTuple_Pack(2, name_obj, filter_obj);
        
        Py_XDECREF(name_obj);
        Py_XDECREF(filter_obj);
%End

protected:
    virtual void done(int result);
    virtual void accept();
    virtual void changeEvent(QEvent *e);

public:
    void setSidebarUrls(const QList<QUrl> &urls);
    QList<QUrl> sidebarUrls() const;
    QByteArray saveState() const;
    bool restoreState(const QByteArray &state);
    void setProxyModel(QAbstractProxyModel *model /Transfer/);
    QAbstractProxyModel *proxyModel() const;
    void setNameFilter(const QString &filter);
    void setNameFilters(const QStringList &filters);
    QStringList nameFilters() const;
    void selectNameFilter(const QString &filter);
    QString selectedNameFilter() const;
    QDir::Filters filter() const;
    void setFilter(QDir::Filters filters);
    void setOption(QFileDialog::Option option, bool on = true);
    bool testOption(QFileDialog::Option option) const;
    void setOptions(QFileDialog::Options options);
    QFileDialog::Options options() const;
    virtual void open();
    void open(SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/);
%MethodCode
        QObject *receiver;
        QByteArray slot_signature;
        
        if ((sipError = pyqt5_qtwidgets_get_connection_parts(a0, sipCpp, "()", false, &receiver, slot_signature)) == sipErrorNone)
        {
            sipCpp->open(receiver, slot_signature.constData());
        }
        else if (sipError == sipErrorContinue)
        {
            sipError = sipBadCallableArg(0, a0);
        }
%End

    virtual void setVisible(bool visible);
%If (Qt_5_2_0 -)
    void setDirectoryUrl(const QUrl &directory);
%End
%If (Qt_5_2_0 -)
    QUrl directoryUrl() const;
%End
%If (Qt_5_2_0 -)
    void selectUrl(const QUrl &url);
%End
%If (Qt_5_2_0 -)
    QList<QUrl> selectedUrls() const;
%End
%If (Qt_5_2_0 -)
    void setMimeTypeFilters(const QStringList &filters);
%End
%If (Qt_5_2_0 -)
    QStringList mimeTypeFilters() const;
%End
%If (Qt_5_2_0 -)
    void selectMimeTypeFilter(const QString &filter);
%End

signals:
%If (Qt_5_2_0 -)
    void urlSelected(const QUrl &url);
%End
%If (Qt_5_2_0 -)
    void urlsSelected(const QList<QUrl> &urls);
%End
%If (Qt_5_2_0 -)
    void currentUrlChanged(const QUrl &url);
%End
%If (Qt_5_2_0 -)
    void directoryUrlEntered(const QUrl &directory);
%End

public:
%If (Qt_5_2_0 -)
    static SIP_PYTUPLE getOpenFileUrl(QWidget *parent = 0, const QString &caption = QString(), const QString &directory = QString(), const QString &filter = QString(), const QString &initialFilter = QString(), Options options = 0, const QStringList &supportedSchemes = QStringList()) /TypeHint="Tuple[QUrl, QString]", ReleaseGIL/;
%MethodCode
        QUrl *url;
        QString *filter = new QString(*a4);
        
        Py_BEGIN_ALLOW_THREADS
        
        url = new QUrl(QFileDialog::getOpenFileUrl(a0, *a1, *a2, *a3, filter, *a5, *a6));
        
        Py_END_ALLOW_THREADS
        
        PyObject *url_obj = sipConvertFromNewType(url, sipType_QUrl, NULL);
        PyObject *filter_obj = sipConvertFromNewType(filter, sipType_QString, NULL);
        
        if (url_obj && filter_obj)
            sipRes = PyTuple_Pack(2, url_obj, filter_obj);
        
        Py_XDECREF(url_obj);
        Py_XDECREF(filter_obj);
%End

%End
%If (Qt_5_2_0 -)
    static SIP_PYTUPLE getOpenFileUrls(QWidget *parent = 0, const QString &caption = QString(), const QString &directory = QString(), const QString &filter = QString(), const QString &initialFilter = QString(), Options options = 0, const QStringList &supportedSchemes = QStringList()) /TypeHint="Tuple[List[QUrl], QString]", ReleaseGIL/;
%MethodCode
        QList<QUrl> url_list;
        QString *filter = new QString(*a4);
        
        Py_BEGIN_ALLOW_THREADS
        
        url_list = QFileDialog::getOpenFileUrls(a0, *a1, *a2, *a3, filter, *a5, *a6);
        
        Py_END_ALLOW_THREADS
        
        PyObject *url_list_obj = PyList_New(url_list.size());
        
        if (url_list_obj)
        {
            for (int i = 0; i < url_list.size(); ++i)
            {
                QUrl *url = new QUrl(url_list.at(i));
                PyObject *url_obj = sipConvertFromNewType(url, sipType_QUrl, NULL);
                
                if (!url_obj)
                {
                    delete url;
                    Py_DECREF(url_list_obj);
                    url_list_obj = 0;
                    break;
                }
                
                PyList_SetItem(url_list_obj, i, url_obj);
            }
        }
        
        PyObject *filter_obj = sipConvertFromNewType(filter, sipType_QString, NULL);
        
        if (url_list_obj && filter_obj)
            sipRes = PyTuple_Pack(2, url_list_obj, filter_obj);
        
        Py_XDECREF(url_list_obj);
        Py_XDECREF(filter_obj);
%End

%End
%If (Qt_5_2_0 -)
    static SIP_PYTUPLE getSaveFileUrl(QWidget *parent = 0, const QString &caption = QString(), const QString &directory = QString(), const QString &filter = QString(), const QString &initialFilter = QString(), Options options = 0, const QStringList &supportedSchemes = QStringList()) /TypeHint="Tuple[QUrl, QString]", ReleaseGIL/;
%MethodCode
        QUrl *url;
        QString *filter = new QString(*a4);
        
        Py_BEGIN_ALLOW_THREADS
        
        url = new QUrl(QFileDialog::getSaveFileUrl(a0, *a1, *a2, *a3, filter, *a5, *a6));
        
        Py_END_ALLOW_THREADS
        
        PyObject *url_obj = sipConvertFromNewType(url, sipType_QUrl, NULL);
        PyObject *filter_obj = sipConvertFromNewType(filter, sipType_QString, NULL);
        
        if (url_obj && filter_obj)
            sipRes = PyTuple_Pack(2, url_obj, filter_obj);
        
        Py_XDECREF(url_obj);
        Py_XDECREF(filter_obj);
%End

%End
%If (Qt_5_6_0 -)
    void setSupportedSchemes(const QStringList &schemes);
%End
%If (Qt_5_6_0 -)
    QStringList supportedSchemes() const;
%End
%If (Qt_5_9_0 -)
    QString selectedMimeTypeFilter() const;
%End
};

QFlags<QFileDialog::Option> operator|(QFileDialog::Option f1, QFlags<QFileDialog::Option> f2);