Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
13b7b67e by Alexandre Janniaux at 2026-02-03T12:12:01+01:00
qt: guard QPlatformWindow access with QT_GUI_PRIVATE

QPlatformWindow is only fully defined when Qt GUI private headers are
available. Guard the access to nativeWindow->devicePixelRatio() with
the #ifdef QT_GUI_PRIVATE to fix compilation when private headers are
not available.

When QT_GUI_PRIVATE is not defined, fall back to using the Qt effective
DPR for both values, which makes the coordinate conversion a no-op.
This is correct for the case where no additional Qt scaling (like
QT_SCALE_FACTOR) is applied on top of native scaling.

On Macos with a Homebrew Qt installation, the private library's package
information doesn't seem to be provided so it is not found.

- - - - -
bd29f1b9 by Alexandre Janniaux at 2026-02-03T12:12:01+01:00
qt: mark VLCDuration and VLCTime as final

Mark VLCDuration and VLCTime as final to silence the warning about
non-virtual destructors in non-final classes with virtual functions.

- - - - -
2c3b293d by Alexandre Janniaux at 2026-02-03T12:12:01+01:00
qt: set Basic style on macOS for Qt Quick Controls

On macOS with dynamically linked Qt, the native style is used by
default, which doesn't support control customization. This causes
warnings like:
"The current style does not support customization of this control"

VLC's QML files customize control backgrounds, which requires a
non-native style. Set Basic style on macOS (and when statically
linked) to enable customization.

- - - - -
71883f0a by Alexandre Janniaux at 2026-02-03T12:12:01+01:00
qt: Add QQmlEngine and QJSEngine include

Add explicit QQmlEngine and QJSEngine includes to mainctx.cpp which is
currently relying on transitive includes. Next commits will remove those
transitive includes.

- - - - -
bb90bdf8 by Alexandre Janniaux at 2026-02-03T12:12:01+01:00
qt: meson: fix path to Darwin frameworks

This fixes "Missing QML.Element class info" runtime warnings and
MOC compile-time warnings about missing QML registration headers when
compiling the Qt interface for MacOSX, which are leading to the UI not
appearing on screen:

        [qt] main generic debug: no qtwindoweffects modules matched with name 
any
        [qt] qt generic debug: A module providing window effects capability 
could not be instantiated. Native background blur effect will not be available. 
The application may compensate this with a simulated effect on certain 
platform(s).
        [qt] qt generic warning: (default) Missing QML.Element class info for 
VLCDuration
        [qt] qt generic warning: (default) Missing QML.Element class info for 
VLCTime
        [qt] qt generic warning: (default) Missing QML.Element class info for 
CSDMenu
        [qt] qt generic warning: (default) Missing QML.Element class info for 
WheelToVLCConverter
        [qt] main generic debug: looking for qt theme provider module matching 
"any": 1 candidates
        ...
        main generic debug: using interface module "qt"
        [qt] qt generic warning: (qml) component is not ready: 
qrc:/qt/qml/VLC/MainInterface/MainDisplay.qml:194 Type BannerSources unavailable
        qrc:/qt/qml/VLC/MainInterface/BannerSources.qml:161 Type 
Widgets.BannerCone unavailable
        qrc:/qt/qml/VLC/Widgets/BannerCone.qml:60 CSDMenu is not a type

        [0000600001c06280] [qt] qt generic warning: (qml) unable to load view mc

Indeed, when we rely on QML_ELEMENT, QML_VALUE_TYPE, or QML_NAMED_ELEMENT,
the MOC must be able to find those defines. But on MacOS they can be
in a framework, that the Qt module from meson doesn't include properly
in the MOC commands.

- - - - -
9bedec23 by Alexandre Janniaux at 2026-02-03T12:12:01+01:00
qt: use QtQml/qqmlregistration.h for QML registration macros

Use <QtQml/qqmlregistration.h> instead of <QQmlEngine>. It's
possible to switch to his header now[^1] that we are using Qt >= 6.2.

[^1]: d8e9e1a2b6a00072ff9c2856762e65704831ebe6, qt: update to Qt 6

When we rely on QML_ELEMENT, QML_VALUE_TYPE, or QML_NAMED_ELEMENT, the
MOC must be able to find those defines.

The QtQmlIntegration header is the proper[^2] to include to add support
for those registration macros but only appears starting with Qt 6.9. The
qqmlintegration.h header is the one transitively included by QQmlEngine
that provides those features starting with Qt 6.2.

[^2]: https://doc.qt.io/qt-6/qqmlintegration-h.html

- - - - -


7 changed files:

- modules/gui/qt/maininterface/mainctx.cpp
- modules/gui/qt/meson.build
- modules/gui/qt/qt.cpp
- modules/gui/qt/util/csdmenu.cpp
- modules/gui/qt/util/csdmenu.hpp
- modules/gui/qt/util/vlchotkeyconverter.hpp
- modules/gui/qt/util/vlctick.hpp


Changes:

=====================================
modules/gui/qt/maininterface/mainctx.cpp
=====================================
@@ -28,6 +28,9 @@
 
 #include "qt.hpp"
 
+#include <QQmlEngine>
+#include <QJSEngine>
+
 #include "mainctx.hpp"
 #include "mainctx_submodels.hpp"
 #include "medialibrary/mlhelper.hpp"


=====================================
modules/gui/qt/meson.build
=====================================
@@ -21,6 +21,13 @@ qt6_dep = dependency('qt6',
     private_headers: true,
     required: get_option('qt'))
 
+# Qt module doesn't provide the framework path to moc executable, so we
+# need to help moc find them. It's needed for QtQml/ module registration.
+if host_machine.system() == 'darwin'
+    qt_libdir = qt6_dep.get_variable(pkgconfig: 'libdir', configtool: '-query 
QT_INSTALL_LIBS')
+    qt_extra_flags += '-F' + qt_libdir
+endif
+
 moc_headers = files(
     'dialogs/bookmarks/bookmarks.hpp',
     'dialogs/dialogs/dialogmodel.hpp',


=====================================
modules/gui/qt/qt.cpp
=====================================
@@ -878,7 +878,7 @@ static void *Thread( void *obj )
     QApplication::setAttribute( Qt::AA_DontCheckOpenGLContextThreadAffinity );
     QQuickWindow::setDefaultAlphaBuffer(true);
 
-#ifdef QT_STATIC
+#if defined(QT_STATIC) || defined(__APPLE__)
     QQuickStyle::setStyle(QLatin1String("Basic"));
 #endif
 


=====================================
modules/gui/qt/util/csdmenu.cpp
=====================================
@@ -277,8 +277,11 @@ void CSDMenu::popup(const QPoint &pos)
         assert(d->m_systemMenu);
 
         qreal qtDpr = window->devicePixelRatio();
-        QPlatformWindow* nativeWindow = window->handle();
-        qreal nativeDpr = nativeWindow->devicePixelRatio();
+        qreal nativeDpr = qtDpr;
+#ifdef QT_GUI_PRIVATE
+        if (QPlatformWindow* nativeWindow = window->handle())
+            nativeDpr = nativeWindow->devicePixelRatio();
+#endif
 
         qt_csd_menu_event event = {};
         event.platform = QT_CSD_PLATFORM_UNKNOWN;


=====================================
modules/gui/qt/util/csdmenu.hpp
=====================================
@@ -18,7 +18,7 @@
 #ifndef CSDMENU_HPP
 #define CSDMENU_HPP
 
-#include <QQmlEngine>
+#include <QtQml/qqmlregistration.h>
 #include <QMenu>
 
 Q_MOC_INCLUDE("maininterface/mainctx.hpp")


=====================================
modules/gui/qt/util/vlchotkeyconverter.hpp
=====================================
@@ -3,7 +3,7 @@
 
 #include <QObject>
 #include <QPoint>
-#include <QQmlEngine>
+#include <QtQml/qqmlregistration.h>
 
 /* VLC Key/Wheel hotkeys interactions */
 


=====================================
modules/gui/qt/util/vlctick.hpp
=====================================
@@ -94,7 +94,7 @@ protected:
     vlc_tick_t m_ticks;
 };
 
-class VLCDuration : public VLCTick
+class VLCDuration final : public VLCTick
 {
     Q_GADGET
     QML_VALUE_TYPE(vlcDuration)
@@ -125,7 +125,7 @@ private:
     bool m_valid;
 };
 
-class VLCTime : public VLCTick
+class VLCTime final : public VLCTick
 {
     Q_GADGET
     QML_VALUE_TYPE(vlcTime)



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/5fe2c1c37ad989127f95d0404a62bdbe1babc92d...9bedec23b85e57dcd76b815cd97c81fee2d8d5a2

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/5fe2c1c37ad989127f95d0404a62bdbe1babc92d...9bedec23b85e57dcd76b815cd97c81fee2d8d5a2
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to