X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FVTKViewer%2FVTKViewer_FramedTextActor.cxx;h=efd2ae0c14acc423c25bc751e63673083e662116;hb=refs%2Fheads%2Fngr%2Fpython3_dev_pv5.4;hp=3de2711f132fc6dafbcc4a588d52f31457de9589;hpb=cac0b4571c951b557e1956d4777cf1e5199637c3;p=modules%2Fgui.git diff --git a/src/VTKViewer/VTKViewer_FramedTextActor.cxx b/src/VTKViewer/VTKViewer_FramedTextActor.cxx index 3de2711f1..efd2ae0c1 100644 --- a/src/VTKViewer/VTKViewer_FramedTextActor.cxx +++ b/src/VTKViewer/VTKViewer_FramedTextActor.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -38,6 +38,30 @@ #define TEXT_MARGIN 4 #define OFFSET_SPACING 2 +//VSR: uncomment below macro to support unicode text properly in SALOME +// current commented out due to regressions +//#define PAL22528_UNICODE + +namespace +{ + QString fromUtf8( const char* txt ) + { +#ifdef PAL22528_UNICODE + return QString::fromUtf8( txt ); +#else + return QString( txt ); +#endif + } + std::string toUtf8( const QString& txt ) + { +#ifdef PAL22528_UNICODE + return txt.toUtf8().constData(); +#else + return txt.toLatin1().constData(); +#endif + } +} + //================================================================== vtkStandardNewMacro(VTKViewer_FramedTextActor); @@ -268,7 +292,7 @@ void VTKViewer_FramedTextActor::SetText(const char* theText) { // remove whitespaces from from the start and the end // additionally, consider a case of multi-string text - QString aString(QString::fromUtf8(theText)); + QString aString(fromUtf8(theText)); QStringList aTrimmedStringList; QStringList aStringList = aString.split("\n"); @@ -276,7 +300,7 @@ void VTKViewer_FramedTextActor::SetText(const char* theText) while(anIter.hasNext()) aTrimmedStringList.append(anIter.next().trimmed()); - myTextActor->SetInput(aTrimmedStringList.join("\n").toUtf8().constData()); + myTextActor->SetInput(toUtf8(aTrimmedStringList.join("\n")).c_str()); Modified(); }