本文整理汇总了C++中QSvgRenderer::viewBox方法的典型用法代码示例。如果您正苦于以下问题:C++ QSvgRenderer::viewBox方法的具体用法?C++ QSvgRenderer::viewBox怎么用?C++ QSvgRenderer::viewBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSvgRenderer
的用法示例。
在下文中一共展示了QSvgRenderer::viewBox方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
bool QSvgIOHandlerPrivate::load(QIODevice *device)
{
if (loaded)
return true;
if (q->format().isEmpty())
q->canRead();
// # The SVG renderer doesn't handle trailing, unrelated data, so we must
// assume that all available data in the device is to be read.
bool res = false;
QBuffer *buf = qobject_cast<QBuffer *>(device);
if (buf) {
const QByteArray &ba = buf->data();
res = r.load(QByteArray::fromRawData(ba.constData() + buf->pos(), ba.size() - buf->pos()));
buf->seek(ba.size());
} else if (q->format() == "svgz") {
res = r.load(device->readAll());
} else {
xmlReader.setDevice(device);
res = r.load(&xmlReader);
}
if (res) {
defaultSize = QSize(r.viewBox().width(), r.viewBox().height());
loaded = true;
}
return loaded;
}
示例2: getSvgRenderer
QSvgRenderer* DiagramView::getSvgRenderer(QString filePath)
{
if (!_svgRendererPool.contains(filePath))
{
QSvgRenderer* renderer = new QSvgRenderer(filePath);
renderer->setViewBox(renderer->viewBox().adjusted(
-NodeItem::OFFSET, -NodeItem::OFFSET,
NodeItem::OFFSET, NodeItem::OFFSET));
_svgRendererPool.insert(filePath, renderer);
}
return _svgRendererPool.value(filePath);
}
示例3: setEndSvgMarkerPath
void QgsLayoutItemPolyline::setEndSvgMarkerPath( const QString &path )
{
QSvgRenderer r;
mEndMarkerFile = path;
if ( path.isEmpty() || !r.load( path ) )
{
mEndArrowHeadHeight = 0;
}
else
{
//calculate mArrowHeadHeight from svg file and mArrowHeadWidth
QRect viewBox = r.viewBox();
mEndArrowHeadHeight = mArrowHeadWidth / viewBox.width() * viewBox.height();
}
updateBoundingRect();
}