diff --git a/ext/qt/gstqtglutility.cc b/ext/qt/gstqtglutility.cc
index 7c7e8e1d2e14a9a2609c607df488fa725ad557ec..acb89b6e1e3b3050f590a3d5d22f2693278a9eae 100644
--- a/ext/qt/gstqtglutility.cc
+++ b/ext/qt/gstqtglutility.cc
@@ -34,7 +34,7 @@
 #if GST_GL_HAVE_PLATFORM_EGL && (defined (HAVE_QT_WAYLAND) || defined (HAVE_QT_EGLFS) || defined (HAVE_QT_ANDROID))
 #include <gst/gl/egl/gstegl.h>
 #ifdef HAVE_QT_QPA_HEADER
-#include <qpa/qplatformnativeinterface.h>
+#include QT_QPA_HEADER
 #endif
 #include <QtPlatformHeaders/QEGLNativeContext>
 #include <gst/gl/egl/gstgldisplay_egl.h>
diff --git a/ext/qt/meson.build b/ext/qt/meson.build
index 38b8a25908b8e00d1d7c42076f2893c883622bc3..e342f645485ba69f7150347e347f3e9c50cbb4ef 100644
--- a/ext/qt/meson.build
+++ b/ext/qt/meson.build
@@ -63,40 +63,14 @@ qt_defines = []
 have_qpa_include = false
 have_qt_windowing = false
 
-# Attempt to find the QPA header either through pkg-config (preferred) or qmake
-# This semi-matches what meson does internally with the qt5 module
-# FIXME Add a way to get some of this information out of the qt5 module
-if not have_qpa_include
-  # FIXME: automagic
-  qt5core_dep = dependency('Qt5Core', required: false)
-  if qt5core_dep.found() and qt5core_dep.type_name() == 'pkgconfig'
-    qt_version = qt5core_dep.version()
-    qt_include_dir = qt5core_dep.get_pkgconfig_variable('includedir')
-    qpa_include_path = join_paths(qt_include_dir, 'QtGui', qt_version, 'QtGui')
-    if cxx.has_header('qpa/qplatformnativeinterface.h',
-            dependencies : qt5core_dep,
-            args : '-I' + qpa_include_path)
-      qt_defines += '-DHAVE_QT_QPA_HEADER'
-      qt_defines += '-I' + qpa_include_path
-      have_qpa_include = true
-      message('Found QPA header using pkg-config')
-    endif
-  endif
-endif
-if not have_qpa_include
-  qmake = find_program('qmake-qt5', 'qmake')
-  if qmake.found()
-    qt_version = run_command(qmake, '-query', 'QT_VERSION').stdout().strip()
-    qt_include_dir = run_command(qmake, '-query', 'QT_INSTALL_HEADERS').stdout().strip()
-    qpa_include_path = join_paths(qt_include_dir, 'QtGui', qt_version, 'QtGui')
-    if cxx.has_header('qpa/qplatformnativeinterface.h',
-            args : '-I' + qpa_include_path)
-      qt_defines += '-DHAVE_QT_QPA_HEADER'
-      qt_defines += '-I' + qpa_include_path
-      have_qpa_include = true
-      message('Found QPA header using qmake')
-    endif
-  endif
+# Look for the QPA platform native interface header
+qpa_header_path = join_paths(qt5qml_dep.version(), 'QtGui')
+qpa_header = join_paths(qpa_header_path, 'qpa/qplatformnativeinterface.h')
+if cxx.has_header(qpa_header, dependencies : qt5qml_dep)
+  qt_defines += '-DHAVE_QT_QPA_HEADER'
+  qt_defines += '-DQT_QPA_HEADER=' + '<@0@>'.format(qpa_header)
+  have_qpa_include = true
+  message('Found QtGui QPA header in ' + qpa_header_path)
 endif
 
 # Try to come up with all the platform/winsys combinations that will work