Fix accented characters within SVG symbol
This commit is contained in:
parent
195ea429e6
commit
c8f380516a
|
@ -32,6 +32,7 @@
|
|||
# include <QString>
|
||||
# include <QStringList>
|
||||
# include <QRegExp>
|
||||
#include <QChar>
|
||||
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
|
@ -227,4 +228,21 @@ const char* DrawUtil::printBool(bool b)
|
|||
{
|
||||
return (b ? "True" : "False");
|
||||
}
|
||||
|
||||
QString DrawUtil::qbaToDebug(const QByteArray & line)
|
||||
{
|
||||
QString s;
|
||||
uchar c;
|
||||
|
||||
for ( int i=0 ; i < line.size() ; i++ ){
|
||||
c = line[i];
|
||||
if ( c >= 0x20 and c <= 126 ) {
|
||||
s.append(QChar::fromLatin1(c));
|
||||
} else {
|
||||
s.append(QString::fromUtf8("<%1>").arg(c, 2, 16, QChar::fromLatin1('0')));
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
//==================================
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
#define _DrawUtil_h_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <QString>
|
||||
#include <QByteArray>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
|
@ -51,6 +54,7 @@ class TechDrawExport DrawUtil {
|
|||
static void countWires(const char* label, const TopoDS_Shape& s);
|
||||
static void countEdges(const char* label, const TopoDS_Shape& s);
|
||||
static const char* printBool(bool b);
|
||||
static QString qbaToDebug(const QByteArray& line);
|
||||
};
|
||||
|
||||
} //end namespace TechDraw
|
||||
|
|
|
@ -123,18 +123,16 @@ void QGIViewSymbol::drawSvg()
|
|||
|
||||
m_svgItem->setScale(viewSymbol->Scale.getValue());
|
||||
|
||||
QString qs(QString::fromUtf8(viewSymbol->Symbol.getValue()));
|
||||
symbolToSvg(qs);
|
||||
QByteArray qba(viewSymbol->Symbol.getValue(),strlen(viewSymbol->Symbol.getValue()));
|
||||
symbolToSvg(qba);
|
||||
}
|
||||
|
||||
void QGIViewSymbol::symbolToSvg(QString qs)
|
||||
void QGIViewSymbol::symbolToSvg(QByteArray qba)
|
||||
{
|
||||
if (qs.isEmpty()) {
|
||||
if (qba.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QByteArray qba;
|
||||
qba.append(qs);
|
||||
prepareGeometryChange();
|
||||
if (!m_svgItem->load(&qba)) {
|
||||
Base::Console().Error("Error - Could not load Symbol into SVG renderer for %s\n", getViewObject()->getNameInDocument());
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
|
||||
protected:
|
||||
virtual void drawSvg();
|
||||
void symbolToSvg(QString qs);
|
||||
void symbolToSvg(QByteArray qba);
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
|
||||
|
||||
QGCustomSvg *m_svgItem;
|
||||
|
|
Loading…
Reference in New Issue
Block a user