avmedia/source/qt6/QtFrameGrabber.cxx | 6 +----- include/vcl/qt/QtUtils.hxx | 6 ++++++ vcl/inc/qt5/QtTools.hxx | 7 +------ 3 files changed, 8 insertions(+), 11 deletions(-)
New commits: commit 2b075e9a93de4bb9cf9833eb9a2274ce0129cd1b Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Apr 11 17:19:20 2025 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Wed Jun 4 10:13:26 2025 +0200 qt: Consolidate to one toOUString helper 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.wegh...@posteo.de> (cherry picked from commit d023035acf83ee1b61dfc03333bfc6e612bb58f6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186133 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/avmedia/source/qt6/QtFrameGrabber.cxx b/avmedia/source/qt6/QtFrameGrabber.cxx index a9cf99fadc7f..b82b02005d9a 100644 --- a/avmedia/source/qt6/QtFrameGrabber.cxx +++ b/avmedia/source/qt6/QtFrameGrabber.cxx @@ -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; diff --git a/include/vcl/qt/QtUtils.hxx b/include/vcl/qt/QtUtils.hxx index 87f21d96315c..3ab5f19f02cb 100644 --- a/include/vcl/qt/QtUtils.hxx +++ b/include/vcl/qt/QtUtils.hxx @@ -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; diff --git a/vcl/inc/qt5/QtTools.hxx b/vcl/inc/qt5/QtTools.hxx index c1b2b75fff5f..b090ba3718c8 100644 --- a/vcl/inc/qt5/QtTools.hxx +++ b/vcl/inc/qt5/QtTools.hxx @@ -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> @@ -43,12 +44,6 @@ 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());