| 1 | // Copyright (C) 2016 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 QTQUICKGLOBAL_P_H |
| 5 | #define QTQUICKGLOBAL_P_H |
| 6 | |
| 7 | #include <QtQml/private/qtqmlglobal_p.h> |
| 8 | #include <QtGui/private/qtguiglobal_p.h> |
| 9 | #include <QtQuick/private/qtquick-config_p.h> |
| 10 | |
| 11 | #include <QtCore/qloggingcategory.h> |
| 12 | |
| 13 | // |
| 14 | // W A R N I N G |
| 15 | // ------------- |
| 16 | // |
| 17 | // This file is not part of the Qt API. It exists purely as an |
| 18 | // implementation detail. This header file may change from version to |
| 19 | // version without notice, or even be removed. |
| 20 | // |
| 21 | // We mean it. |
| 22 | // |
| 23 | |
| 24 | #include "qtquickglobal.h" |
| 25 | #include <QtQuick/qtquickexports.h> |
| 26 | |
| 27 | QT_BEGIN_NAMESPACE |
| 28 | |
| 29 | void Q_QUICK_EXPORT qml_register_types_QtQuick(); |
| 30 | |
| 31 | void Q_QUICK_EXPORT QQuick_initializeModule(); |
| 32 | |
| 33 | Q_DECLARE_LOGGING_CATEGORY(lcTouch) |
| 34 | Q_DECLARE_LOGGING_CATEGORY(lcMouse) |
| 35 | Q_DECLARE_LOGGING_CATEGORY(lcFocus) |
| 36 | Q_DECLARE_LOGGING_CATEGORY(lcDirty) |
| 37 | |
| 38 | /* |
| 39 | This is needed for QuickTestUtils. Q_AUTOTEST_EXPORT checks QT_BUILDING_QT |
| 40 | (amongst others) to see if it should export symbols. Until QuickTestUtils |
| 41 | was introduced, this was enough, as there weren't any intermediate test |
| 42 | helper libraries that used a Qt library and were in turn used by tests. |
| 43 | |
| 44 | Taking QQuickItemViewPrivate as an example: previously it was using |
| 45 | Q_AUTOTEST_EXPORT. Since QuickTestUtils is a Qt library (albeit a private |
| 46 | one), QT_BUILDING_QT was true and so Q_AUTOTEST_EXPORT evaluated to an |
| 47 | export. However, QQuickItemViewPrivate was already exported by the Quick |
| 48 | library, so we would get errors like this: |
| 49 | |
| 50 | Qt6Quickd.lib(Qt6Quickd.dll) : error LNK2005: "public: static class |
| 51 | QQuickItemViewPrivate * __cdecl QQuickItemViewPrivate::get(class QQuickItemView *)" |
| 52 | (?get@QQuickItemViewPrivate@@SAPEAV1@PEAVQQuickItemView@@@Z) already defined |
| 53 | in Qt6QuickTestUtilsd.lib(viewtestutils.cpp.obj) |
| 54 | |
| 55 | So, to account for the special case of QuickTestUtils, we need to be more |
| 56 | specific about which part of Qt we're building; instead of checking if we're |
| 57 | building any Qt library at all, check if we're building the Quick library, |
| 58 | and only then export. |
| 59 | */ |
| 60 | #if defined(QT_BUILD_INTERNAL) && defined(QT_BUILD_QUICK_LIB) && defined(QT_SHARED) |
| 61 | # define Q_QUICK_AUTOTEST_EXPORT Q_DECL_EXPORT |
| 62 | #elif defined(QT_BUILD_INTERNAL) && defined(QT_SHARED) |
| 63 | # define Q_QUICK_AUTOTEST_EXPORT Q_DECL_IMPORT |
| 64 | #else |
| 65 | # define Q_QUICK_AUTOTEST_EXPORT |
| 66 | #endif |
| 67 | |
| 68 | QT_END_NAMESPACE |
| 69 | |
| 70 | #endif // QTQUICKGLOBAL_P_H |
| 71 | |