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
4#ifndef QQUICKFILENAMEFILTER_P_H
5#define QQUICKFILENAMEFILTER_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
18#include <QtCore/qobject.h>
19#include <QtCore/qsharedpointer.h>
20#include <QtCore/qstringlist.h>
21#include <QtGui/qpa/qplatformdialoghelper.h>
22
24
26
28{
29 Q_OBJECT
30 Q_PROPERTY(int index READ index WRITE setIndex NOTIFY indexChanged FINAL)
31 Q_PROPERTY(QString name READ name NOTIFY nameChanged FINAL)
32 Q_PROPERTY(QStringList extensions READ extensions NOTIFY extensionsChanged FINAL)
33 Q_PROPERTY(QStringList globs READ globs NOTIFY globsChanged FINAL)
34
35public:
36 explicit QQuickFileNameFilter(QObject *parent = nullptr);
37
38 int index() const;
39 void setIndex(int index);
40
41 QString name() const;
42 QStringList extensions() const;
43 QStringList globs() const;
44
45 QSharedPointer<QFileDialogOptions> options() const;
46 void setOptions(const QSharedPointer<QFileDialogOptions> &options);
47
48 void update(const QString &filter);
49
50Q_SIGNALS:
51 void indexChanged(int index);
52 void nameChanged(const QString &name);
53 void extensionsChanged(const QStringList &extensions);
54 void globsChanged(const QStringList &globs);
55
56private:
57 QStringList nameFilters() const;
58 QString nameFilter(int index) const;
59
60 int m_index;
61 QString m_name;
62 QStringList m_extensions;
63 QStringList m_globs;
64 QSharedPointer<QFileDialogOptions> m_options;
65};
66
67QT_END_NAMESPACE
68
69#endif // QQUICKFILENAMEFILTER_P_H
Combined button and popup list for selecting options.
static QString extractName(const QString &filter)
static QString extractExtension(QStringView filter)
static void extractExtensionsAndGlobs(QStringView filter, QStringList &extensions, QStringList &globs)