• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Doc
  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Products
    • Automation Designer
    • HMI Designer
    • Maritime HMIs
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • GUI - CDP Widgets
  • ParserSVG

ParserSVG Class

Class with helpful functions for svg parsing (intended for internal use). More...

Header: #include <ParserSVG>
  • List of all members, including inherited members

Public Types

class GeneralInfo
class TextInfo
typedef ElementListMap
typedef MarginsStyleMap
typedef NamedElementListMap
typedef NamedElementMap
enum ProcessDir { Unknown, WorkingDir, ThemeRootDir, Resource }
typedef StyleListMap
typedef StyleMap
typedef TextElementListMap
typedef TextStyleMap

Public Functions

ParserSVG()
QDomElement GetElementByID(QDomNode node, const QString &id)
QDomElement GetLayerElement(QDomNode node, int layer)
void GetNamedElements(NamedElementListMap listMap, QDomElement element)
void GetStyles(ElementListMap listMap, QDomElement element, bool bNoNumber = false, bool bContains = false)
void GetTextStyles(TextElementListMap listMap, QDomElement element, bool bNoNumber = false, bool bContains = false, bool bGetText = false)
QDomElement GetValidatedElement(const QString &validator, const QDomElement &element, int &style, bool bNoNumber = false, bool bContains = false, QString tag = "rect")
QDomElement GetValidatedNamedRectElement(const QString &validator, const QDomElement &element, QString &strKey)
QDomElement GetValidatedRectElement(const QString &validator, const QDomElement &element, int &style, bool bNoNumber = false, bool bContains = false)
void Init(QString fileName = "")
virtual bool ProcessSVG(QString fileName = "")
bool SetDocumentContent(QDomDocument &doc, const QString &fileName)
virtual int ValidateNumberedString(const QString &validator, QString id)
bool debugEnabled() const
bool isResourceFile() const
bool isSvgFile() const
void setDebugEnabled(bool enabled)
void setSvgFileName(const QString &fileName)
bool svgFileExists() const
const QString &svgFileName() const
bool svgFileProcessed() const
virtual bool svgOutOfDate() const
QSvgRenderer *svgRenderer() const
bool updateRequired(QString &svg, QWidget *caller)

Static Public Members

void DrawTextOnPix(QPixmap &pix, const QString &text, const ParserSVG::TextStyleMap &textMap, int style = 0, QFont textFont = QFont( "Areal" ), const QSizeF &scaling = QSizeF( 1, 1 ))
double GetAngle(QPointF center, QPointF point, double radius = -1)
bool GetMarginsFromMaps(const StyleMap &marginTL, const StyleMap &marginBR, QMargins &margins)
double GetNumberFromString(QString string, const QString &prefix, const QChar &endChar, bool *bOk = 0)
double GetRadius(QPointF center, QPointF point)
bool GetText(TextStyleMap &map, QString &text, int style = 0)
bool GetTextColor(TextStyleMap &map, QColor &color, int style = 0)
void RenderPixmap(QPixmap &pix, const ParserSVG::StyleMap &map, QSvgRenderer &svg, QSize pixSize = QSize(), int index = 0)
qreal ScaledPointSize(QFont textFont, const QRect &textRect, const QString &text)
void UpdateGradientString(QString &gradient, TextStyleMap &map, bool addStartText = true)
void UpdateLabelFont(QLabel &label, ParserSVG::TextStyleMap &map, int style, bool skipSize = false)
bool UpdateThemePath(QString &svgPath, const QString &newThemeName)
bool UpdateThemePath(QString &svgPath, QWidget *caller = 0)
QString addThemesDirIfNotFound(const QString &fileName)
QString createImageFromSvg(const ParserSVG::GeneralInfo &info, const QString &fileName, bool overwrite = false)
bool fileExistsOnDiskOrAsResource(const QString &fileName)
QString imageSaveDir()
Qt::Alignment parseAlignmentFromText(const TextInfo &info)
bool svgDebug()
QString themeRootDir()
ProcessDir updateFileNameIfRequiredAndReturnProcessDir(QString &fileName)

Detailed Description

Class with helpful functions for svg parsing (intended for internal use).

Member Type Documentation

typedef ParserSVG::ElementListMap

typedef ParserSVG::MarginsStyleMap

typedef ParserSVG::NamedElementListMap

typedef ParserSVG::NamedElementMap

enum ParserSVG::ProcessDir

typedef ParserSVG::StyleListMap

typedef ParserSVG::StyleMap

typedef ParserSVG::TextElementListMap

typedef ParserSVG::TextStyleMap

Member Function Documentation

ParserSVG::ParserSVG()

Default constructs an instance of ParserSVG.

[static] void ParserSVG::DrawTextOnPix(QPixmap &pix, const QString &text, const ParserSVG::TextStyleMap &textMap, int style = 0, QFont textFont = QFont( "Areal" ), const QSizeF &scaling = QSizeF( 1, 1 ))

[static] double ParserSVG::GetAngle(QPointF center, QPointF point, double radius = -1)

QDomElement ParserSVG::GetElementByID(QDomNode node, const QString &id)

QDomElement ParserSVG::GetLayerElement(QDomNode node, int layer)

[static] bool ParserSVG::GetMarginsFromMaps(const StyleMap &marginTL, const StyleMap &marginBR, QMargins &margins)

void ParserSVG::GetNamedElements(NamedElementListMap listMap, QDomElement element)

[static] double ParserSVG::GetNumberFromString(QString string, const QString &prefix, const QChar &endChar, bool *bOk = 0)

[static] double ParserSVG::GetRadius(QPointF center, QPointF point)

void ParserSVG::GetStyles(ElementListMap listMap, QDomElement element, bool bNoNumber = false, bool bContains = false)

[static] bool ParserSVG::GetText(TextStyleMap &map, QString &text, int style = 0)

[static] bool ParserSVG::GetTextColor(TextStyleMap &map, QColor &color, int style = 0)

void ParserSVG::GetTextStyles(TextElementListMap listMap, QDomElement element, bool bNoNumber = false, bool bContains = false, bool bGetText = false)

QDomElement ParserSVG::GetValidatedElement(const QString &validator, const QDomElement &element, int &style, bool bNoNumber = false, bool bContains = false, QString tag = "rect")

QDomElement ParserSVG::GetValidatedNamedRectElement(const QString &validator, const QDomElement &element, QString &strKey)

QDomElement ParserSVG::GetValidatedRectElement(const QString &validator, const QDomElement &element, int &style, bool bNoNumber = false, bool bContains = false)

void ParserSVG::Init(QString fileName = "")

[virtual] bool ParserSVG::ProcessSVG(QString fileName = "")

[static] void ParserSVG::RenderPixmap(QPixmap &pix, const ParserSVG::StyleMap &map, QSvgRenderer &svg, QSize pixSize = QSize(), int index = 0)

[static] qreal ParserSVG::ScaledPointSize(QFont textFont, const QRect &textRect, const QString &text)

bool ParserSVG::SetDocumentContent(QDomDocument &doc, const QString &fileName)

[static] void ParserSVG::UpdateGradientString(QString &gradient, TextStyleMap &map, bool addStartText = true)

[static] void ParserSVG::UpdateLabelFont(QLabel &label, ParserSVG::TextStyleMap &map, int style, bool skipSize = false)

[static] bool ParserSVG::UpdateThemePath(QString &svgPath, const QString &newThemeName)

[static] bool ParserSVG::UpdateThemePath(QString &svgPath, QWidget *caller = 0)

[virtual] int ParserSVG::ValidateNumberedString(const QString &validator, QString id)

[static] QString ParserSVG::addThemesDirIfNotFound(const QString &fileName)

[static] QString ParserSVG::createImageFromSvg(const ParserSVG::GeneralInfo &info, const QString &fileName, bool overwrite = false)

bool ParserSVG::debugEnabled() const

See also setDebugEnabled().

[static] bool ParserSVG::fileExistsOnDiskOrAsResource(const QString &fileName)

[static] QString ParserSVG::imageSaveDir()

bool ParserSVG::isResourceFile() const

bool ParserSVG::isSvgFile() const

[static] Qt::Alignment ParserSVG::parseAlignmentFromText(const TextInfo &info)

void ParserSVG::setDebugEnabled(bool enabled)

See also debugEnabled().

void ParserSVG::setSvgFileName(const QString &fileName)

See also svgFileName().

[static] bool ParserSVG::svgDebug()

bool ParserSVG::svgFileExists() const

const QString &ParserSVG::svgFileName() const

See also setSvgFileName().

bool ParserSVG::svgFileProcessed() const

[virtual] bool ParserSVG::svgOutOfDate() const

QSvgRenderer *ParserSVG::svgRenderer() const

[static] QString ParserSVG::themeRootDir()

[static] ProcessDir ParserSVG::updateFileNameIfRequiredAndReturnProcessDir(QString &fileName)

bool ParserSVG::updateRequired(QString &svg, QWidget *caller)

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

My account

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

© Copyright 2025 CDP Technologies. Privacy and cookie policy.

Return to top