Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickfilenamefilter_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKFILENAMEFILTER_P_H
6#define QQUICKFILENAMEFILTER_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtCore/qobject.h>
20#include <QtCore/qsharedpointer.h>
21#include <QtCore/qstringlist.h>
22#include <QtGui/qpa/qplatformdialoghelper.h>
23
25
27
29{
30 Q_OBJECT
31 Q_PROPERTY(int index READ index WRITE setIndex NOTIFY indexChanged FINAL)
32 Q_PROPERTY(QString name READ name NOTIFY nameChanged FINAL)
33 Q_PROPERTY(QStringList extensions READ extensions NOTIFY extensionsChanged FINAL)
34 Q_PROPERTY(QStringList globs READ globs NOTIFY globsChanged FINAL)
35
36public:
37 explicit QQuickFileNameFilter(QObject *parent = nullptr);
38
39 int index() const;
40 void setIndex(int index);
41
42 QString name() const;
43 QStringList extensions() const;
44 QStringList globs() const;
45
46 QSharedPointer<QFileDialogOptions> options() const;
47 void setOptions(const QSharedPointer<QFileDialogOptions> &options);
48
49 void update(const QString &filter);
50
51Q_SIGNALS:
52 void indexChanged(int index);
53 void nameChanged(const QString &name);
54 void extensionsChanged(const QStringList &extensions);
55 void globsChanged(const QStringList &globs);
56
57private:
58 QStringList nameFilters() const;
59 QString nameFilter(int index) const;
60
61 int m_index;
62 QString m_name;
63 QStringList m_extensions;
64 QStringList m_globs;
65 QSharedPointer<QFileDialogOptions> m_options;
66};
67
68QT_END_NAMESPACE
69
70#endif // QQUICKFILENAMEFILTER_P_H
static QString extractName(const QString &filter)
static QString extractExtension(QStringView filter)
static void extractExtensionsAndGlobs(QStringView filter, QStringList &extensions, QStringList &globs)