Qt 6.x
The Qt SDK
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)
30 Q_PROPERTY(QString comment READ comment CONSTANT)
32 Q_PROPERTY(QString iconName READ iconName CONSTANT)
40
41public:
42 QMimeType();
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
53 bool operator==(const QMimeType &other) const;
54
55 inline bool operator!=(const QMimeType &other) const
56 {
57 return !operator==(other);
58 }
59
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
89};
90
91Q_DECLARE_SHARED(QMimeType)
92
93#ifndef QT_NO_DEBUG_STREAM
94class QDebug;
95Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QMimeType &mime);
96#endif
97
99
100#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
QStringList aliases
the list of aliases of this mimetype
Definition qmimetype.h:36
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 & operator=(const QMimeType &other)
Move-assigns other to this QMimeType instance.
QMimeType()
Constructs this QMimeType object initialized with default property values that indicate an invalid MI...
Definition qmimetype.cpp:88
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
bool operator!=(const QMimeType &other) const
Returns true if other does not equal this QMimeType object, otherwise returns false.
Definition qmimetype.h:55
~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:127
Combined button and popup list for selecting options.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
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 Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
Definition qrandom.cpp:196
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
Definition qrandom.cpp:1219
#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]