Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qmimetype.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// Copyright (C) 2015 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com>
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#ifndef QMIMETYPE_H
6#define QMIMETYPE_H
7
8#include <QtCore/qglobal.h>
9
11
12#include <QtCore/qobjectdefs.h>
13#include <QtCore/qshareddata.h>
14#include <QtCore/qstring.h>
15#include <QtCore/qstringlist.h>
16
18
20class QMimeType;
21
22Q_CORE_EXPORT size_t qHash(const QMimeType &key, size_t seed = 0) noexcept;
23
24class Q_CORE_EXPORT QMimeType
25{
27 Q_PROPERTY(bool valid READ isValid CONSTANT)
28 Q_PROPERTY(bool isDefault READ isDefault CONSTANT)
29 Q_PROPERTY(QString name READ name CONSTANT)
40
41public:
42 QMimeType();
44 QMimeType &operator=(const QMimeType &other);
45 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QMimeType)
46 void swap(QMimeType &other) noexcept
47 {
48 d.swap(other.d);
49 }
50 explicit QMimeType(const QMimeTypePrivate &dd);
51 ~QMimeType();
52#if QT_CORE_REMOVED_SINCE(6, 8)
53 bool operator==(const QMimeType &other) const;
54
55 inline bool operator!=(const QMimeType &other) const
56 {
57 return !operator==(other);
58 }
59#endif
60 bool isValid() const;
61
62 bool isDefault() const;
63
64 QString name() const;
65 QString comment() const;
67 QString iconName() const;
71 QStringList aliases() const;
72 QStringList suffixes() const;
74
75 Q_INVOKABLE bool inherits(const QString &mimeTypeName) const;
76
77 QString filterString() const;
78
79protected:
80 friend class QMimeTypeParserBase;
81 friend class MimeTypeMapEntry;
83 friend class QMimeXMLProvider;
84 friend class QMimeBinaryProvider;
85 friend class QMimeTypePrivate;
86 friend Q_CORE_EXPORT size_t qHash(const QMimeType &key, size_t seed) noexcept;
87
88 QExplicitlySharedDataPointer<QMimeTypePrivate> d;
89
90private:
91 friend Q_CORE_EXPORT bool comparesEqual(const QMimeType &lhs, const QMimeType &rhs) noexcept;
93};
94
95Q_DECLARE_SHARED(QMimeType)
96
97#ifndef QT_NO_DEBUG_STREAM
98class QDebug;
99Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QMimeType &mime);
100#endif
101
103
104#endif // QMIMETYPE_H
\inmodule QtCore
\inmodule QtCore
Definition qmimetype.h:25
bool isValid() const
QStringList globPatterns
the list of glob matching patterns
Definition qmimetype.h:33
QStringList parentMimeTypes
the names of parent MIME types
Definition qmimetype.h:34
QStringList allAncestors
the names of direct and indirect parent MIME types
Definition qmimetype.h:35
void swap(QMimeType &other) noexcept
Swaps QMimeType other with this QMimeType object.
Definition qmimetype.h:46
QStringList suffixes
the known suffixes for the MIME type
Definition qmimetype.h:37
QExplicitlySharedDataPointer< QMimeTypePrivate > d
Definition qmimetype.h:88
bool valid
true if the QMimeType object contains valid data, false otherwise
Definition qmimetype.h:27
QString comment
the description of the MIME type to be displayed on user interfaces
Definition qmimetype.h:30
QMimeType()
Constructs this QMimeType object initialized with default property values that indicate an invalid MI...
Definition qmimetype.cpp:59
QString preferredSuffix
the preferred suffix for the MIME type
Definition qmimetype.h:38
QString iconName
the file name of an icon image that represents the MIME type
Definition qmimetype.h:32
bool isDefault
true if this MIME type is the default MIME type which applies to all files: application/octet-stream.
Definition qmimetype.h:28
~QMimeType()
Destroys the QMimeType object, and releases the d pointer.
QString genericIconName
the file name of a generic icon that represents the MIME type
Definition qmimetype.h:31
QString filterString
a filter string usable for a file dialog
Definition qmimetype.h:39
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
#define Q_DECLARE_EQUALITY_COMPARABLE(...)
constexpr bool operator!=(const timespec &t1, const timespec &t2)
bool comparesEqual(const QDir &lhs, const QDir &rhs)
Definition qdir.cpp:1819
Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QMimeType &mime)
Q_CORE_EXPORT size_t qHash(const QMimeType &key, size_t seed=0) noexcept
GLuint64 key
GLuint name
static QStringList aliases(const QQmlJSScope::ConstPtr &scope)
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
Definition qrandom.cpp:196
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
Definition qrandom.cpp:1220
#define QT_REQUIRE_CONFIG(feature)
#define Q_PROPERTY(...)
#define Q_INVOKABLE
#define Q_GADGET
application x qt windows mime
[2]
timer inherits("QTimer")
QSharedPointer< T > other(t)
[5]
this swap(other)