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
qquickvectorimagesource_p.h
Go to the documentation of this file.
1// Copyright (C) 2026 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 QQUICKVECTORIMAGESOURCE_P_H
5#define QQUICKVECTORIMAGESOURCE_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 <QtQuickVectorImageGenerator/qtquickvectorimagegeneratorexports.h>
19#include <QtQml/qqmlcontext.h>
20#include <QtQml/qqmlfile.h>
21#include <QtCore/qbytearray.h>
22#include <QtCore/qstring.h>
23
24#include <memory>
25
26QT_BEGIN_NAMESPACE
27
28class QDebug;
29class QIODevice;
30
31class Q_QUICKVECTORIMAGEGENERATOR_EXPORT QQuickVectorImageSource
32{
33public:
34 QQuickVectorImageSource() = default;
35 explicit QQuickVectorImageSource(const QString &fileName,
36 const QByteArray &data = QByteArray{});
37 QQuickVectorImageSource(const QQuickVectorImageSource &) = default;
38 ~QQuickVectorImageSource();
39 QQuickVectorImageSource &operator=(const QQuickVectorImageSource &) = default;
40
41 QString fileName() const
42 {
43 return m_fileName;
44 }
45
46 void resolveLocalFileName(QQmlContext *ctx)
47 {
48 if (!m_source.isEmpty()) {
49 QUrl resolvedUrl = ctx->resolvedUrl(m_source);
50 m_fileName = QQmlFile::urlToLocalFileOrQrc(resolvedUrl);
51 } else {
52 m_fileName.clear();
53 }
54 }
55
56 QUrl source() const
57 {
58 return m_source;
59 }
60
61 void setSource(const QUrl &source)
62 {
63 m_source = source;
64 }
65
66 QByteArray data() const
67 {
68 return m_data;
69 }
70
71 void setData(const QByteArray &data)
72 {
73 m_data = data;
74 }
75
76 bool isEmpty() const
77 {
78 return m_fileName.isEmpty() && m_data.isEmpty();
79 }
80
81 bool isFile() const
82 {
83 return m_data.isEmpty();
84 }
85
86private:
87 QUrl m_source;
88 QString m_fileName;
89 QByteArray m_data;
90};
91
92#ifndef QT_NO_DEBUG_STREAM
93Q_QUICKVECTORIMAGEGENERATOR_EXPORT QDebug operator<<(QDebug debug,
94 const QQuickVectorImageSource &source);
95#endif
96
97QT_END_NAMESPACE
98
99#endif // QQUICKVECTORIMAGESOURCE_P_H
Combined button and popup list for selecting options.
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
Definition qdir.cpp:2620