Adapt to QQuickWindow::createTextureFromNativeObject being gone in Qt6

This commit is contained in:
Volker Krause 2022-03-12 12:46:22 +01:00
parent f31b4b36d7
commit b99c5f9a63

View file

@ -57,10 +57,16 @@ void ThumbnailTextureProvider::setTexture(const QSharedPointer<GLTexture> &nativ
if (m_nativeTexture != nativeTexture) {
const GLuint textureId = nativeTexture->texture();
m_nativeTexture = nativeTexture;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
m_texture.reset(m_window->createTextureFromNativeObject(QQuickWindow::NativeObjectTexture,
&textureId, 0,
nativeTexture->size(),
QQuickWindow::TextureHasAlphaChannel));
#else
m_texture.reset(QNativeInterface::QSGOpenGLTexture::fromNative(textureId, m_window,
nativeTexture->size(),
QQuickWindow::TextureHasAlphaChannel));
#endif
m_texture->setFiltering(QSGTexture::Linear);
m_texture->setHorizontalWrapMode(QSGTexture::ClampToEdge);
m_texture->setVerticalWrapMode(QSGTexture::ClampToEdge);