vcl/inc/qt5/QtInstance.hxx    |    5 ++++-
 vcl/qt5/QtFrame.cxx           |   20 +++++++++++++++++++-
 vcl/unx/kf5/KFSalInstance.cxx |    4 +++-
 vcl/unx/kf5/KFSalInstance.hxx |    2 ++
 4 files changed, 28 insertions(+), 3 deletions(-)

New commits:
commit e024f498aec01d4c4f632e5fbad2ca316d591f53
Author:     Michael Weghorn <[email protected]>
AuthorDate: Wed Feb 18 22:54:18 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Thu Feb 19 11:56:35 2026 +0100

    qt a11y: Evaluate QAccessibilityHints::motionPreference (Qt >= 6.12)
    
    Qt dev qtbase commit [1]
    
      commit 444b9f854e0a7aca1c066cb91d66b8f307d9a2bc
      Author: Oliver Eftevaag <[email protected]>
      Date:   Wed Feb 4 17:24:57 2026 +0100
    
          Add QAccessibilityHints::motionPreference
    
          This read-only property can be used to detect if a system setting for
          reducing animated effects have been enabled. Multiple platforms 
support
          such a setting, which is usually found under the accessibility 
category.
    
          Read and detect changes in this setting on Windows, macOS, iOS and
          the Gnome desktop for now.
    
          Introducing this property will allow UI builders to make their
          applications more accessible to those that suffer from vestibular
          disorders. Modern browsers and Gtk already have API for this.
    
          [ChangeLog][QtGui][QAccessibilityHints] Added motionPreference, a
          property that can be used to honor the users request to reduce the 
amount
          of non-essential animations in their UI.
    
          Fixes: QTBUG-133042
          Change-Id: Ia49b5a978cd63fab432e7b8c30b14bc687cf26bf
          Reviewed-by: Jan Arve Sæther <[email protected]>
    
    introduced a new preference to detect whether animations should
    be reduced.
    
    Use this to implement QtFrame::GetUseReducedAnimation for Qt >= 6.12
    and only fall back to the kf5/kf6-specific implementation
    introduced in
    
        commit f3a4b6e1d71ed40d84ef65c6626fb7eb77a13545
        Author: Michael Weghorn <[email protected]>
        Date:   Tue Jul 25 11:52:32 2023 +0200
    
            tdf#155414 kf a11y: Honor KDE Plasma setting to reduce animation
    
    for older Qt versions.
    
    This depends on the QPlatformTheme in use to also
    report the preference accordingly.
    Suggested MR to implement the logic for the KDE Plasma
    platform theme: [2]
    
    [1] 
https://code.qt.io/cgit/qt/qtbase.git/commit/?id=444b9f854e0a7aca1c066cb91d66b8f307d9a2bc
    [2] https://invent.kde.org/plasma/plasma-integration/-/merge_requests/205
    
    Change-Id: Ifc83e70dbe0dc7e079cb84c86d03a49223b18e5b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199670
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/inc/qt5/QtInstance.hxx b/vcl/inc/qt5/QtInstance.hxx
index acf21b57e979..081c55d77c88 100644
--- a/vcl/inc/qt5/QtInstance.hxx
+++ b/vcl/inc/qt5/QtInstance.hxx
@@ -230,8 +230,11 @@ public:
     // for qt font options
     virtual const cairo_font_options_t* GetCairoFontOptions() override;
 
-    // whether to reduce animations; KFSalInstance overrides this to read 
Plasma settings
+#if QT_VERSION < QT_VERSION_CHECK(6, 12, 0)
+    // Helper to implement QtFrame::GetUseReducedAnimation for Qt < 6.12
+    // KFSalInstance overrides this to read Plasma settings
     virtual bool GetUseReducedAnimation() { return false; }
+#endif
     void UpdateStyle(bool bFontsChanged);
 
     void* CreateGStreamerSink(const SystemChildWindow*) override;
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index 8a2b6b65016c..1c63d8b42670 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -42,6 +42,9 @@
 #include <QtGui/QIcon>
 #include <QtGui/QWindow>
 #include <QtGui/QScreen>
+#if QT_VERSION >= QT_VERSION_CHECK(6, 12, 0)
+#include <QtGui/QAccessibilityHints>
+#endif
 #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
 #include <QtGui/QStyleHints>
 #endif
@@ -1287,7 +1290,22 @@ void QtFrame::ResolveWindowHandle(SystemEnvData& rData) 
const
     }
 }
 
-bool QtFrame::GetUseReducedAnimation() const { return 
GetQtInstance().GetUseReducedAnimation(); }
+bool QtFrame::GetUseReducedAnimation() const
+{
+#if QT_VERSION >= QT_VERSION_CHECK(6, 12, 0)
+    QStyleHints* pStyleHints = QGuiApplication::styleHints();
+    if (!pStyleHints)
+        return false;
+
+    const QAccessibilityHints* pAccessibilityHints = 
pStyleHints->accessibility();
+    if (!pAccessibilityHints)
+        return false;
+
+    return pAccessibilityHints->motionPreference() == 
Qt::MotionPreference::ReducedMotion;
+#else
+    return GetQtInstance().GetUseReducedAnimation();
+#endif
+}
 
 // Drag'n'drop foo
 
diff --git a/vcl/unx/kf5/KFSalInstance.cxx b/vcl/unx/kf5/KFSalInstance.cxx
index cc280e9d99a1..955cfe519826 100644
--- a/vcl/unx/kf5/KFSalInstance.cxx
+++ b/vcl/unx/kf5/KFSalInstance.cxx
@@ -42,9 +42,10 @@ KFSalInstance::KFSalInstance(std::unique_ptr<QApplication>& 
pQApp)
     pSVData->maAppData.mxToolkitName = constructToolkitID(sToolkit);
 }
 
+#if QT_VERSION < QT_VERSION_CHECK(6, 12, 0)
 bool KFSalInstance::GetUseReducedAnimation()
 {
-    // since Qt doesn not have a standard way to disable animations for the 
toolkit
+    // since Qt < 6.12 doesn not have a standard way to detect whether 
animations should be reduced,
     // use the animation speed setting when on KDE Plasma, in accordance with 
how kde-gtk-config
     // sets the Gtk setting based on that:
     // 
https://invent.kde.org/plasma/kde-gtk-config/-/blob/881ae01ad361a03396f7f327365f225ef87688e8/kded/configvalueprovider.cpp#L239
@@ -62,6 +63,7 @@ bool KFSalInstance::GetUseReducedAnimation()
 
     return QtInstance::GetUseReducedAnimation();
 }
+#endif
 
 bool KFSalInstance::hasNativeFileSelection() const
 {
diff --git a/vcl/unx/kf5/KFSalInstance.hxx b/vcl/unx/kf5/KFSalInstance.hxx
index 86795a1ba94a..6fc59d059949 100644
--- a/vcl/unx/kf5/KFSalInstance.hxx
+++ b/vcl/unx/kf5/KFSalInstance.hxx
@@ -28,7 +28,9 @@ class KFSalInstance final : public QtInstance
     createPicker(css::uno::Reference<css::uno::XComponentContext> const& 
context,
                  QFileDialog::FileMode) override;
 
+#if QT_VERSION < QT_VERSION_CHECK(6, 12, 0)
     virtual bool GetUseReducedAnimation() override;
+#endif
 
 public:
     explicit KFSalInstance(std::unique_ptr<QApplication>& pQApp);

Reply via email to