[PATCH] qt: Consolidate to one toOUString helper
authorMichael Weghorn <m.weghorn@posteo.de>
Fri, 11 Apr 2025 15:19:20 +0000 (17:19 +0200)
committerRene Engelhard <rene@debian.org>
Wed, 13 Aug 2025 20:27:02 +0000 (22:27 +0200)
Instead of having one for vcl in vcl/inc/qt5/QtTools.hxx
and one in avmedia/source/qt6/QtFrameGrabber.cxx,
move the existing implementation to
include/vcl/qt/QtUtils.hxx and use it everywhere.

Change-Id: I8576ab0fe2fd12bb25ae262e59acb8412ef8be0c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184057
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
(cherry picked from commit d023035acf83ee1b61dfc03333bfc6e612bb58f6)

Gbp-Pq: Name qt-Consolidate-to-one-toOUString-helper.diff

avmedia/source/qt6/QtFrameGrabber.cxx
include/vcl/qt/QtUtils.hxx
vcl/inc/qt5/QtTools.hxx

index a9cf99fadc7f889b4521c86226f503db2389adf3..b82b02005d9abe50741ed98d84c0c49ea7c6568f 100644 (file)
@@ -14,6 +14,7 @@
 #include <vcl/filter/PngImageReader.hxx>
 #include <vcl/graph.hxx>
 #include <vcl/image.hxx>
+#include <vcl/qt/QtUtils.hxx>
 #include <vcl/scheduler.hxx>
 
 #include "QtFrameGrabber.hxx"
@@ -23,11 +24,6 @@ using namespace ::com::sun::star;
 
 namespace
 {
-inline OUString toOUString(const QString& s)
-{
-    return OUString(reinterpret_cast<const sal_Unicode*>(s.data()), s.length());
-}
-
 uno::Reference<css::graphic::XGraphic> toXGraphic(const QImage& rImage)
 {
     QByteArray aData;
index 87f21d96315cbfc3a445c9e5cbe5d64c5710b59d..3ab5f19f02cb04bbb2af4e817e2674b7ec0a68fb 100644 (file)
@@ -31,6 +31,12 @@ inline QString toQString(const OUString& rStr)
     return QString::fromUtf16(rStr.getStr(), rStr.getLength());
 }
 
+inline OUString toOUString(const QString& s)
+{
+    // QString stores UTF16, just like OUString
+    return OUString(reinterpret_cast<const sal_Unicode*>(s.data()), s.length());
+}
+
 inline QPixmap toQPixmap(const BitmapEx& rBitmapEx)
 {
     SvMemoryStream aMemoryStream;
index c1b2b75fff5f4a3464df6dc7db39870e1a2f3357..b090ba3718c88df5816370502d61a78a7ee60827 100644 (file)
@@ -33,6 +33,7 @@
 #include <tools/color.hxx>
 #include <tools/gen.hxx>
 #include <vcl/bitmap/BitmapTypes.hxx>
+#include <vcl/qt/QtUtils.hxx>
 #include <vcl/vclenum.hxx>
 
 #include <com/sun/star/uno/Sequence.hxx>
 class Image;
 class QImage;
 
-inline OUString toOUString(const QString& s)
-{
-    // QString stores UTF16, just like OUString
-    return OUString(reinterpret_cast<const sal_Unicode*>(s.data()), s.length());
-}
-
 inline QRect toQRect(const tools::Rectangle& rRect)
 {
     return QRect(rRect.Left(), rRect.Top(), rRect.GetWidth(), rRect.GetHeight());