-
Notifications
You must be signed in to change notification settings - Fork 7
/
fileopendialog.h
86 lines (67 loc) · 2.27 KB
/
fileopendialog.h
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
/* Copyright 2013–2017 Kullo GmbH. All rights reserved. */
#pragma once
#include <QQuickItem>
#include <QFileDialog>
#include <QUrl>
#include <private/qguiapplication_p.h>
#include <QtGui/qpa/qplatformdialoghelper.h>
#include <QtGui/qpa/qplatformtheme.h>
class FileOpenDialog : public QQuickItem
{
Q_OBJECT
public:
explicit FileOpenDialog(QQuickItem *parent = 0);
~FileOpenDialog();
Q_PROPERTY(bool valid READ valid NOTIFY validChanged)
bool valid() const;
Q_PROPERTY(QUrl fileUrl READ fileUrl NOTIFY fileUrlChanged)
QUrl fileUrl() const;
Q_PROPERTY(QList<QUrl> fileUrls READ fileUrls NOTIFY fileUrlsChanged)
QList<QUrl> fileUrls() const;
Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged)
QString filename() const;
void setFilename(QString filename);
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
QString title() const;
void setTitle(QString title);
Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters NOTIFY nameFiltersChanged)
QStringList nameFilters() const;
void setNameFilters(QStringList nameFilters);
Q_PROPERTY(bool selectMultiple READ selectMultiple WRITE setSelectMultiple NOTIFY selectMultipleChanged)
bool selectMultiple() const;
void setSelectMultiple(bool selectMultiple);
Q_INVOKABLE void open();
Q_INVOKABLE void close();
signals:
void fileUrlChanged();
void fileUrlsChanged();
void filenameChanged();
void titleChanged();
void nameFiltersChanged();
void accepted();
void rejected();
void selectMultipleChanged();
// unused
void validChanged();
protected:
QPlatformFileDialogHelper* init_helper();
protected:
QPlatformFileDialogHelper *m_dlgHelper;
QQuickWindow *m_parentWindow;
Qt::WindowModality m_modality;
bool m_visible;
QSharedPointer<QFileDialogOptions> m_options;
protected Q_SLOTS:
virtual void accept();
virtual void reject();
private:
void setFileUrl(QUrl fileUrl = QUrl());
void setFileUrls(QList<QUrl> fileUrls = QList<QUrl>());
QUrl fileUrl_;
QList<QUrl> fileUrls_;
QString filename_;
QString title_;
QStringList nameFilters_;
bool selectMultiple_ = false;
Q_DISABLE_COPY(FileOpenDialog)
};