]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Issue 0019818: EDF 703 SMESH VISU : Display Mesh Groups names in viewer (as a caption)
authorouv <ouv@opencascade.com>
Wed, 27 May 2009 12:00:45 +0000 (12:00 +0000)
committerouv <ouv@opencascade.com>
Wed, 27 May 2009 12:00:45 +0000 (12:00 +0000)
src/VTKViewer/VTKViewer_FramedTextActor.cxx

index b0ab3984906999ccebaaca60e0249046dc4533e2..50600be3115069873dce0426425c70748529b015 100644 (file)
@@ -36,7 +36,7 @@
 #include <vtkViewport.h>
 #include <vtkWindow.h>
 
-#include <QString>
+#include <QStringList>
 
 #define TEXT_MARGIN    4
 #define OFFSET_SPACING 2
@@ -273,8 +273,16 @@ void VTKViewer_FramedTextActor::SetOffset(const int theOffset[2])
 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(theText);
-  myTextMapper->SetInput(aString.trimmed().toLatin1().constData());
+
+  QStringList aTrimmedStringList;
+  QStringList aStringList = aString.split("\n");
+  QStringListIterator anIter(aStringList);
+  while(anIter.hasNext())
+    aTrimmedStringList.append(anIter.next().trimmed());
+
+  myTextMapper->SetInput(aTrimmedStringList.join("\n").toLatin1().constData());
   Modified();
 }