本文整理汇总了C++中QSvgGenerator::fileName方法的典型用法代码示例。如果您正苦于以下问题:C++ QSvgGenerator::fileName方法的具体用法?C++ QSvgGenerator::fileName怎么用?C++ QSvgGenerator::fileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSvgGenerator
的用法示例。
在下文中一共展示了QSvgGenerator::fileName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: construction
void tst_QSvgGenerator::construction()
{
QSvgGenerator generator;
QCOMPARE(generator.fileName(), QString());
QCOMPARE(generator.outputDevice(), (QIODevice *)0);
QCOMPARE(generator.resolution(), 72);
QCOMPARE(generator.size(), QSize());
}
示例2: pen
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgEllipse(const QDomElement &element)
{
//ellipse horisontal and vertical radius
qreal rx = element.attribute(aRx).toDouble();
qreal ry = element.attribute(aRy).toDouble();
QSvgGenerator *generator = createSvgGenerator(rx * 2, ry * 2);
//fill and stroke color
QColor fillColor = colorFromString(element.attribute(aFill));
QColor strokeColor = colorFromString(element.attribute(aStroke));
int strokeWidth = element.attribute(aStrokewidth).toInt();
//ellipse center coordinates
qreal cx = element.attribute(aCx).toDouble();
qreal cy = element.attribute(aCy).toDouble();
//init painter to paint to svg
QPainter painter;
painter.begin(generator);
QPen pen(strokeColor);
pen.setWidth(strokeWidth);
painter.setPen(pen);
painter.setBrush(QBrush(fillColor));
painter.drawEllipse(0, 0, rx * 2, ry * 2);
painter.end();
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName()));
QTransform transform;
QString textTransform = element.attribute(aTransform);
svgItem->resetTransform();
if (!textTransform.isNull()) {
transform = transformFromString(textTransform, svgItem);
}
repositionSvgItem(svgItem, rx * 2, ry * 2, cx - 2*rx, cy+ry, transform);
hashSceneItem(element, svgItem);
delete generator;
return true;
}
示例3: colorFromString
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgRect(const QDomElement &element)
{
qreal x1 = element.attribute(aX).toDouble();
qreal y1 = element.attribute(aY).toDouble();
//rect dimensions
qreal width = element.attribute(aWidth).toDouble();
qreal height = element.attribute(aHeight).toDouble();
QString textFillColor = element.attribute(aFill);
QString textStrokeColor = element.attribute(aStroke);
QString textStrokeWidth = element.attribute(aStrokewidth);
QColor fillColor = !textFillColor.isNull() ? colorFromString(textFillColor) : QColor();
QColor strokeColor = !textStrokeColor.isNull() ? colorFromString(textStrokeColor) : QColor();
int strokeWidth = textStrokeWidth.toInt();
x1 -= strokeWidth/2;
y1 -= strokeWidth/2;
width += strokeWidth;
height += strokeWidth;
//init svg generator with temp file
QSvgGenerator *generator = createSvgGenerator(width, height);
//init painter to paint to svg
QPainter painter;
painter.begin(generator);
//fill rect
if (fillColor.isValid()) {
painter.setBrush(QBrush(fillColor));
painter.fillRect(0, 0, width, height, fillColor);
}
QPen pen;
if (strokeColor.isValid()) {
pen.setColor(strokeColor);
}
if (strokeWidth)
pen.setWidth(strokeWidth);
painter.setPen(pen);
painter.drawRect(0, 0, width, height);
painter.end();
UBGraphicsSvgItem *svgItem = mCurrentScene->addSvg(QUrl::fromLocalFile(generator->fileName()));
QTransform transform;
QString textTransform = element.attribute(aTransform);
svgItem->resetTransform();
if (!textTransform.isNull()) {
transform = transformFromString(textTransform, svgItem);
}
repositionSvgItem(svgItem, width, height, x1, y1, transform);
hashSceneItem(element, svgItem);
delete generator;
return true;
}