Temporarily rollback unicode support (as it is incomplete causing regressions)
_PTR(Study) study = appStudy->studyDS();
_PTR(SObject) obj = study->FindObjectID( io->getEntry() );
if ( obj ) {
_PTR(Study) study = appStudy->studyDS();
_PTR(SObject) obj = study->FindObjectID( io->getEntry() );
if ( obj ) {
- QString aName = QString( QString::fromUtf8(obj->GetName().c_str()) );
+ QString aName = QString( SMESH::fromUtf8(obj->GetName()) );
while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of Popup
aName.remove( (aName.length() - 1), 1 );
title = aName;
while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of Popup
aName.remove( (aName.length() - 1), 1 );
title = aName;
_PTR(SObject) obj = study->FindObjectID( entry.toLatin1().constData() );
QString name;
if ( obj )
_PTR(SObject) obj = study->FindObjectID( entry.toLatin1().constData() );
QString name;
if ( obj )
- name = QString::fromUtf8(obj->GetName().c_str());
+ name = SMESH::fromUtf8(obj->GetName());
if ( name.isEmpty() )
return;
if ( name.isEmpty() )
return;
bool isUnique = false;
while (!isUnique) {
aName = theOperation + "_" + QString::number(++aNumber);
bool isUnique = false;
while (!isUnique) {
aName = theOperation + "_" + QString::number(++aNumber);
- isUnique = (aSet.count(aName.toUtf8().data()) == 0);
+ isUnique = (aSet.count(std::string(SMESH::toUtf8(aName))) == 0);
do
{
aResName = aPrefix + QString::number( i++ );
do
{
aResName = aPrefix + QString::number( i++ );
- anObj = aStudy->FindObject( aResName.toUtf8().data() );
+ anObj = aStudy->FindObject( SMESH::toUtf8(aResName) );
}
while ( anObj );
myName->setText(aResName);
}
while ( anObj );
myName->setText(aResName);
myNameChanged = true;
myName->blockSignals(true);
myNameChanged = true;
myName->blockSignals(true);
- myName->setText(QString::fromUtf8(theGroup->GetName()));
+ myName->setText(SMESH::fromUtf8(theGroup->GetName()));
myName->blockSignals(false);
myName->home(false);
SALOMEDS::Color aColor = theGroup->GetColor();
setGroupColor( aColor );
myName->blockSignals(false);
myName->home(false);
SALOMEDS::Color aColor = theGroup->GetColor();
setGroupColor( aColor );
- myMeshGroupLine->setText(QString::fromUtf8(theGroup->GetName()));
+ myMeshGroupLine->setText(SMESH::fromUtf8(theGroup->GetName()));
int aType = 0;
switch(theGroup->GetType()) {
int aType = 0;
switch(theGroup->GetType()) {
{
myNameChanged = true;
myName->blockSignals(true);
{
myNameChanged = true;
myName->blockSignals(true);
- myName->setText(QString::fromUtf8(theGroup->GetName()));
+ myName->setText(SMESH::fromUtf8(theGroup->GetName()));
myName->blockSignals(false);
}
myName->blockSignals(false);
}
if (myGeomObjects->length() == 1) {
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
if (myGeomObjects->length() == 1) {
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
- myName->text().toUtf8().data(),
+ SMESH::toUtf8(myName->text()),
myGeomObjects[0]);
}
else {
myGeomObjects[0]);
}
else {
aNewGeomGroupName += myName->text();
SALOMEDS::SObject_var aNewGroupSO =
geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGroupVar,
aNewGeomGroupName += myName->text();
SALOMEDS::SObject_var aNewGroupSO =
geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGroupVar,
- aNewGeomGroupName.toUtf8().data(), aMeshShape);
+ SMESH::toUtf8(aNewGeomGroupName), aMeshShape);
}
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
}
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType,
- myName->text().toUtf8().data(),
+ SMESH::toUtf8(myName->text()),
aGroupVar);
}
resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnGeom );
aGroupVar);
}
resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnGeom );
return false;
myGroupOnFilter = myMesh->CreateGroupFromFilter(aType,
return false;
myGroupOnFilter = myMesh->CreateGroupFromFilter(aType,
- myName->text().toUtf8().data(),
+ SMESH::toUtf8(myName->text()),
myFilter);
resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnFilter );
myFilter);
resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnFilter );
- resultGroup->SetName(myName->text().toUtf8().data());
+ resultGroup->SetName(SMESH::toUtf8(myName->text()));
if ( !anActor ) return false;
myActorsList.append( anActor );
}
if ( !anActor ) return false;
myActorsList.append( anActor );
}
- anActor->setName(myName->text().toUtf8().data());
+ anActor->setName(SMESH::toUtf8(myName->text()));
QColor c;
int delta;
switch ( myTypeId ) {
QColor c;
int delta;
switch ( myTypeId ) {
SMESH::SMESH_Group_var aGroup;
try {
if ( !theMesh->_is_nil() )
SMESH::SMESH_Group_var aGroup;
try {
if ( !theMesh->_is_nil() )
- aGroup = theMesh->CreateGroup( theType, theGroupName.toUtf8().data() );
+ aGroup = theMesh->CreateGroup( theType, SMESH::toUtf8(theGroupName) );
}
catch( const SALOME::SALOME_Exception& S_ex ) {
SalomeApp_Tools::QtCatchCorbaException( S_ex );
}
catch( const SALOME::SALOME_Exception& S_ex ) {
SalomeApp_Tools::QtCatchCorbaException( S_ex );
#include CORBA_SERVER_HEADER(SMESH_Group)
#include CORBA_SERVER_HEADER(SMESH_Group)
+//VSR: uncomment below macro to support unicode text properly in SALOME
+// current commented out due to regressions
+//#define PAL22528_UNICODE
+
namespace SMESH
{
SUIT_Desktop*
namespace SMESH
{
SUIT_Desktop*
+ 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() );
+ }
+
+ const char* toUtf8( const QString& txt )
+ {
+#ifdef PAL22528_UNICODE
+ return txt.toUtf8().constData();
+#else
+ return txt.toLatin1().constData();
+#endif
+ }
+
} // end of namespace SMESH
} // end of namespace SMESH
toStdStr( char* s ): toStrT< std::string >(s) {}
};
toStdStr( char* s ): toStrT< std::string >(s) {}
};
+ QString fromUtf8( const char* txt );
+ QString fromUtf8( const std::string& txt );
+ const char* toUtf8( const QString& txt );
}
#endif // SMESHGUI_UTILS_H
}
#endif // SMESHGUI_UTILS_H