[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: add AccessibleCompat class
Steve Lhomme (@robUx4)
gitlab at videolan.org
Mon Jul 27 13:31:22 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
6a4656dd by Wassim Lalaoui at 2026-07-27T12:51:33+00:00
qt: add AccessibleCompat class
- - - - -
466a8172 by Wassim Lalaoui at 2026-07-27T12:51:33+00:00
qt: add Accessible ID to the medialib category
- - - - -
6 changed files:
- modules/gui/qt/Makefile.am
- modules/gui/qt/dialogs/preferences/simple_preferences.cpp
- modules/gui/qt/maininterface/mainui.cpp
- modules/gui/qt/meson.build
- + modules/gui/qt/util/accessible_compat_attached.cpp
- + modules/gui/qt/util/accessible_compat_attached.hpp
Changes:
=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -305,6 +305,7 @@ libqt_plugin_la_SOURCES = \
playlist/playlist_model.hpp \
playlist/playlist_model_p.hpp \
util/asynctask.hpp \
+ util/accessible_compat_attached.cpp util/accessible_compat_attached.hpp \
util/audio_device_model.cpp \
util/audio_device_model.hpp \
util/workerthreadset.hpp util/workerthreadset.cpp \
@@ -498,6 +499,7 @@ nodist_libqt_plugin_la_SOURCES = \
playlist/playlist_item.moc.cpp \
playlist/playlist_model.moc.cpp \
util/asynctask.moc.cpp \
+ util/accessible_compat_attached.moc.cpp \
util/audio_device_model.moc.cpp \
util/workerthreadset.moc.cpp \
util/base_model.moc.cpp \
=====================================
modules/gui/qt/dialogs/preferences/simple_preferences.cpp
=====================================
@@ -30,6 +30,7 @@
#include "preferences_widgets.hpp"
#include "dialogs/dialogs_provider.hpp"
#include "maininterface/mainctx.hpp"
+#include "util/accessible_compat_attached.hpp"
#include "util/color_scheme_model.hpp"
#include "util/proxycolumnmodel.hpp"
#include "medialibrary/mlrecentmediamodel.hpp"
@@ -1028,6 +1029,7 @@ SPrefsPanel::SPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
if ( vlc_ml_instance_get( p_intf ) != NULL )
{
+ AccessibleCompatAttached::setId( ui.mlGroupBox, "ml-groupbox" );
auto foldersModel = new MLFoldersModel( this );
foldersModel->setCtx( p_intf->p_mi );
ui.entryPoints->setMLFoldersModel( foldersModel );
=====================================
modules/gui/qt/maininterface/mainui.cpp
=====================================
@@ -56,6 +56,7 @@
#include "util/textureproviderindirection.hpp"
#include "util/sgmanipulator.hpp"
#include "util/pointingtooltipattached.hpp"
+#include "util/accessible_compat_attached.hpp"
#include "dialogs/help/aboutmodel.hpp"
#include "dialogs/dialogs_provider.hpp"
@@ -421,6 +422,7 @@ void MainUI::registerQMLTypes()
qmlRegisterType<TextureProviderObserver>( uri, versionMajor, versionMinor, "TextureProviderObserver" );
qmlRegisterType<TextureProviderIndirection>( uri, versionMajor, versionMinor, "TextureProviderIndirection" );
qmlRegisterType<SGManipulator>( uri, versionMajor, versionMinor, "SGManipulator" );
+ qmlRegisterTypesAndRevisions<AccessibleCompatAttached>( uri, versionMajor );
qmlRegisterModule(uri, versionMajor, versionMinor);
qmlProtectModule(uri, versionMajor);
=====================================
modules/gui/qt/meson.build
=====================================
@@ -128,6 +128,7 @@ moc_headers = files(
'playlist/playlist_item.hpp',
'playlist/playlist_model.hpp',
'util/asynctask.hpp',
+ 'util/accessible_compat_attached.hpp',
'util/audio_device_model.hpp',
'util/workerthreadset.hpp',
'util/base_model.hpp',
@@ -433,6 +434,8 @@ qt_plugin_sources = files(
'playlist/playlist_model.hpp',
'playlist/playlist_model_p.hpp',
'util/asynctask.hpp',
+ 'util/accessible_compat_attached.cpp',
+ 'util/accessible_compat_attached.hpp',
'util/audio_device_model.cpp',
'util/audio_device_model.hpp',
'util/workerthreadset.cpp',
=====================================
modules/gui/qt/util/accessible_compat_attached.cpp
=====================================
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ * Copyright (C) 2026 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * ( at your option ) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#include "accessible_compat_attached.hpp"
+
+#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0) && defined(QT_DECLARATIVE_PRIVATE)
+#include <private/qquickaccessibleattached_p.h>
+#define ACCESSIBLE_COMPAT_OK
+#endif
+
+AccessibleCompatAttached::AccessibleCompatAttached(QObject* parent)
+ : QObject(parent)
+{
+}
+
+void AccessibleCompatAttached::setId(const QString& id) {
+#ifdef ACCESSIBLE_COMPAT_OK
+ QQuickAccessibleAttached* accessible = qobject_cast<QQuickAccessibleAttached*>(
+ qmlAttachedPropertiesObject<QQuickAccessibleAttached>(parent()));
+ accessible->setId(id);
+ emit IdChanged();
+#endif
+}
+
+QString AccessibleCompatAttached::getId() {
+#ifdef ACCESSIBLE_COMPAT_OK
+ QQuickAccessibleAttached* accessible = qobject_cast<QQuickAccessibleAttached*>(
+ qmlAttachedPropertiesObject<QQuickAccessibleAttached>(parent()));
+ return accessible->id();
+#endif
+ return {};
+}
+
+AccessibleCompatAttached* AccessibleCompatAttached::qmlAttachedProperties(QObject* parent)
+{
+ return new AccessibleCompatAttached(parent);
+}
+
+void AccessibleCompatAttached::setId(QWidget* wd, const QString& id)
+{
+ #if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0)
+ wd->setAccessibleIdentifier(id);
+ #endif
+}
\ No newline at end of file
=====================================
modules/gui/qt/util/accessible_compat_attached.hpp
=====================================
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (C) 2026 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * ( at your option ) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef ACCESSIBLE_COMPAT_ATTACHED_HPP
+#define ACCESSIBLE_COMPAT_ATTACHED_HPP
+
+#include <QObject>
+#include <QWidget>
+#include <QtQml/qqml.h>
+
+class AccessibleCompatAttached : public QObject {
+ Q_OBJECT
+
+ QML_NAMED_ELEMENT(AccessibleCompat)
+ QML_UNCREATABLE("Compatibility for accessible")
+ QML_ATTACHED(AccessibleCompatAttached)
+
+ Q_PROPERTY(QString id READ getId WRITE setId NOTIFY IdChanged FINAL)
+
+ public:
+ AccessibleCompatAttached(QObject* parent = nullptr);
+
+ void setId(const QString& id);
+ static void setId(QWidget* wd, const QString& id);
+
+ QString getId();
+
+ static AccessibleCompatAttached* qmlAttachedProperties(QObject* parent);
+signals:
+ void IdChanged();
+};
+
+#endif // ACCESSIBLE_COMPAT_ATTACHED_HPP
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a3bec70d2550dcfe4cdeb1b0a5bc8533b3967621...466a8172c478cc3cfc99dc2bb9cad11e3c57fa4e
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/a3bec70d2550dcfe4cdeb1b0a5bc8533b3967621...466a8172c478cc3cfc99dc2bb9cad11e3c57fa4e
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list