#include <QTextStream>
#include <QChar>
+//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
+ }
+}
+
static QString READY_PROMPT = ">>> ";
static QString DOTS_PROMPT = "... ";
{
if(!((PyConsole_Editor*)data)->isSuppressOutput()) {
PyConsole_Editor* e = (PyConsole_Editor*)data;
- e->putLog( QString::fromUtf8(c) );
- QApplication::postEvent( e, new PrintEvent( QString::fromUtf8(c), false ) );
+ e->putLog( fromUtf8(c) );
+ QApplication::postEvent( e, new PrintEvent( fromUtf8(c), false ) );
}
}
{
if(!((PyConsole_Editor*)data)->isSuppressOutput()) {
PyConsole_Editor* e = (PyConsole_Editor*)data;
- e->putLog( QString::fromUtf8(c) );
- QApplication::postEvent( e, new PrintEvent( QString::fromUtf8(c), true ) );
+ e->putLog( fromUtf8(c) );
+ QApplication::postEvent( e, new PrintEvent( fromUtf8(c), true ) );
}
}
#include <QObject>
#include <QVariant>
+//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
+ }
+
+ QString fromUtf8( const std::string& txt )
+ {
+ return fromUtf8( txt.c_str() );
+ }
+}
+
/*!
\class SalomeApp_DataObject
\brief Implementation of the data object for use in CORBA-based
{
QString str;
if ( myObject )
- str = QString::fromUtf8( myObject->GetName().c_str() );
+ str = fromUtf8( myObject->GetName() );
if ( str.isEmpty() ) {
_PTR(SObject) refObj = referencedObject();
if ( refObj )
- str = QString::fromUtf8( refObj->GetName().c_str() );
+ str = fromUtf8( refObj->GetName() );
}
if ( isReference() ) {
_PTR(AttributePixMap) aPixAttr ( anAttr );
if ( aPixAttr->HasPixMap() ) {
QString componentType = componentDataType();
- QString pixmapID = QString::fromUtf8(aPixAttr->GetPixMap().c_str());
+ QString pixmapID = fromUtf8( aPixAttr->GetPixMap() );
// select a plugin within a component
QStringList plugin_pixmap = pixmapID.split( "::", QString::KeepEmptyParts );
if ( plugin_pixmap.size() == 2 ) {
{
_PTR(AttributeString) strAttr = attr;
std::string str = strAttr->Value();
- QString aStrings = QString::fromUtf8( str.c_str() );
+ QString aStrings = fromUtf8( str );
//Special case to show NoteBook variables in the "Value" column of the OB
if ( LightApp_RootObject* aRoot = dynamic_cast<LightApp_RootObject*>( root() ) )
#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
+ }
+ const char* toUtf8( const QString& txt )
+ {
+#ifdef PAL22528_UNICODE
+ return txt.toUtf8().constData();
+#else
+ return txt.toLatin1().constData();
+#endif
+ }
+}
+
//==================================================================
vtkStandardNewMacro(VTKViewer_FramedTextActor);
{
// 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");
while(anIter.hasNext())
aTrimmedStringList.append(anIter.next().trimmed());
- myTextActor->SetInput(aTrimmedStringList.join("\n").toUtf8().constData());
+ myTextActor->SetInput(toUtf8(aTrimmedStringList.join("\n")));
Modified();
}