diff options
Diffstat (limited to 'src/corelib/plugin')
-rw-r--r-- | src/corelib/plugin/qfactoryinterface.h | 3 | ||||
-rw-r--r-- | src/corelib/plugin/qlibrary.cpp | 4 | ||||
-rw-r--r-- | src/corelib/plugin/qplugin.h | 26 | ||||
-rw-r--r-- | src/corelib/plugin/quuid.cpp | 2 |
4 files changed, 30 insertions, 5 deletions
diff --git a/src/corelib/plugin/qfactoryinterface.h b/src/corelib/plugin/qfactoryinterface.h index f306460690..3aec4ddd55 100644 --- a/src/corelib/plugin/qfactoryinterface.h +++ b/src/corelib/plugin/qfactoryinterface.h @@ -52,8 +52,9 @@ struct Q_CORE_EXPORT QFactoryInterface virtual QStringList keys() const = 0; }; - +#ifndef Q_CLANG_QDOC Q_DECLARE_INTERFACE(QFactoryInterface, "org.qt-project.Qt.QFactoryInterface") +#endif QT_END_NAMESPACE diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index aa63ed1a6b..6635286f76 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -133,8 +133,8 @@ QT_BEGIN_NAMESPACE The following code snippet loads a library, resolves the symbol "mysymbol", and calls the function if everything succeeded. If something goes wrong, e.g. the library file does not exist or the - symbol is not defined, the function pointer will be 0 and won't be - called. + symbol is not defined, the function pointer will be \nullptr and + won't be called. \snippet code/src_corelib_plugin_qlibrary.cpp 0 diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h index 5aca22497a..676b5047d6 100644 --- a/src/corelib/plugin/qplugin.h +++ b/src/corelib/plugin/qplugin.h @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -71,13 +72,27 @@ inline constexpr unsigned char qPluginArchRequirements() } typedef QObject *(*QtPluginInstanceFunction)(); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) typedef const char *(*QtPluginMetaDataFunction)(); +#else +typedef QPair<const uchar *, size_t> (*QtPluginMetaDataFunction)(); +#endif + struct Q_CORE_EXPORT QStaticPlugin { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +public: + constexpr QStaticPlugin(QtPluginInstanceFunction i, QtPluginMetaDataFunction m) + : instance(i), rawMetaData(m().first), rawMetaDataSize(m().second) + QtPluginInstanceFunction instance; +private: + // ### Qt 6: revise, as this is not standard-layout + const void *rawMetaData; + qsizetype rawMetaDataSize +#elif !defined(Q_QDOC) // Note: This struct is initialized using an initializer list. // As such, it cannot have any new constructors or variables. -#ifndef Q_QDOC QtPluginInstanceFunction instance; QtPluginMetaDataFunction rawMetaData; #else @@ -148,6 +163,15 @@ void Q_CORE_EXPORT qRegisterStaticPluginFunction(QStaticPlugin staticPlugin); return plugin; \ } +#elif QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + +# define QT_MOC_EXPORT_PLUGIN(PLUGINCLASS, PLUGINCLASSNAME) \ + Q_EXTERN_C Q_DECL_EXPORT \ + auto qt_plugin_query_metadata() \ + { return qMakePair<const void *, size_t>(qt_pluginMetaData, sizeof qt_pluginMetaData); } \ + Q_EXTERN_C Q_DECL_EXPORT QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance() \ + Q_PLUGIN_INSTANCE(PLUGINCLASS) + #else # define QT_MOC_EXPORT_PLUGIN(PLUGINCLASS, PLUGINCLASSNAME) \ diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index b113ca13ce..8bb5e1463a 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -112,7 +112,7 @@ static char *_q_uuidToHex(const QUuid &uuid, char *dst, QUuid::StringFormat mode Parses the string representation of a UUID (with optional surrounding "{}") by reading at most MaxStringUuidLength (38) characters from \a src, which - may be \c nullptr. Stops at the first invalid character (which includes a + may be \nullptr. Stops at the first invalid character (which includes a premature NUL). Returns the successfully parsed QUuid, or a null QUuid in case of failure. |