Add platform native interface to headless backed

Used by fontconfigdatabase as of Qt 6.8.0
This commit is contained in:
Kovid Goyal 2024-10-15 09:29:38 +05:30
parent 01a7f72b71
commit 0796e12040
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 10 additions and 0 deletions

View File

@ -21,6 +21,7 @@ class QCoreTextFontEngine;
#include <qpa/qplatformwindow.h> #include <qpa/qplatformwindow.h>
#include <qpa/qplatformfontdatabase.h> #include <qpa/qplatformfontdatabase.h>
#include <qpa/qplatformtheme.h> #include <qpa/qplatformtheme.h>
#include <qpa/qplatformnativeinterface.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -122,6 +123,13 @@ QAbstractEventDispatcher *HeadlessIntegration::createEventDispatcher() const
#endif #endif
} }
QPlatformNativeInterface *HeadlessIntegration::nativeInterface() const
{
if (!m_nativeInterface)
m_nativeInterface.reset(new QPlatformNativeInterface);
return m_nativeInterface.get();
}
HeadlessIntegration *HeadlessIntegration::instance() HeadlessIntegration *HeadlessIntegration::instance()
{ {
return static_cast<HeadlessIntegration *>(QGuiApplicationPrivate::platformIntegration()); return static_cast<HeadlessIntegration *>(QGuiApplicationPrivate::platformIntegration());

View File

@ -41,6 +41,7 @@ public:
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override; QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override;
QStringList themeNames() const override; QStringList themeNames() const override;
QPlatformTheme *createPlatformTheme(const QString &name) const override; QPlatformTheme *createPlatformTheme(const QString &name) const override;
QPlatformNativeInterface *nativeInterface() const override;
unsigned options() const { return 0; } unsigned options() const { return 0; }
@ -51,6 +52,7 @@ public:
private: private:
QScopedPointer<QPlatformFontDatabase> m_fontDatabase; QScopedPointer<QPlatformFontDatabase> m_fontDatabase;
QScopedPointer<QPlatformServices> platform_services; QScopedPointer<QPlatformServices> platform_services;
mutable QScopedPointer<QPlatformNativeInterface> m_nativeInterface;
}; };
QT_END_NAMESPACE QT_END_NAMESPACE