diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-08-21 12:15:06 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-09-14 10:09:03 +0000 |
commit | 4730221dbce520e6884cd07346ba89c80ec2c466 (patch) | |
tree | 0fab1d1ab5afd70c95496538b7aba1152b71058a /src/imports/platform/plugins.qmltypes | |
parent | 658b0f610a71fab8c103b913d2cfd11c3c7c6bef (diff) |
Fix FileDialog::selectedNameFilter review findings
FileDialog::nameFilters contains an array of name filter strings that
combine the name and extensions. For example:
- "Text files (*.txt)"
- "HTML files (*.html *.htm)"
When dealing with multiple name filters, it is quite clumsy to use
a string type of 'selectedNameFilter' which is one of the above full
file name filter string values. Make it possible to read/write the
index of the selected name filter, and provide the filter's name and
extensions separately.
Change-Id: Ie416cc4ab3dcde93c10769b6f7ac44915307f194
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports/platform/plugins.qmltypes')
-rw-r--r-- | src/imports/platform/plugins.qmltypes | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/imports/platform/plugins.qmltypes b/src/imports/platform/plugins.qmltypes index 2bee7276..01d8eb94 100644 --- a/src/imports/platform/plugins.qmltypes +++ b/src/imports/platform/plugins.qmltypes @@ -130,12 +130,36 @@ Module { Property { name: "folder"; type: "QUrl" } Property { name: "options"; type: "QFileDialogOptions::FileDialogOptions" } Property { name: "nameFilters"; type: "QStringList" } - Property { name: "selectedNameFilter"; type: "string" } + Property { + name: "selectedNameFilter" + type: "QQuickPlatformFileNameFilter" + isReadonly: true + isPointer: true + } Property { name: "defaultSuffix"; type: "string" } Property { name: "acceptLabel"; type: "string" } Property { name: "rejectLabel"; type: "string" } } Component { + name: "QQuickPlatformFileNameFilter" + prototype: "QObject" + Property { name: "index"; type: "int" } + Property { name: "name"; type: "string"; isReadonly: true } + Property { name: "extensions"; type: "QStringList"; isReadonly: true } + Signal { + name: "indexChanged" + Parameter { name: "index"; type: "int" } + } + Signal { + name: "nameChanged" + Parameter { name: "name"; type: "string" } + } + Signal { + name: "extensionsChanged" + Parameter { name: "extensions"; type: "QStringList" } + } + } + Component { name: "QQuickPlatformFolderDialog" defaultProperty: "data" prototype: "QQuickPlatformDialog" |