Loading...
Searching...
No Matches
qwt_plot_svgitem.cpp
/******************************************************************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#include "qwt_plot_svgitem.h"
#include "qwt_text.h"
#include "qwt_graphic.h"
#include <qsvgrenderer.h>
QwtPlotSvgItem::QwtPlotSvgItem( const QString& title )
: QwtPlotGraphicItem( QwtText( title ) )
{
}
QwtPlotSvgItem::QwtPlotSvgItem( const QwtText& title )
: QwtPlotGraphicItem( title )
{
}
QwtPlotSvgItem::~QwtPlotSvgItem()
{
}
bool QwtPlotSvgItem::loadFile( const QRectF& rect,
const QString& fileName )
{
QwtGraphic graphic;
QSvgRenderer renderer;
const bool ok = renderer.load( fileName );
if ( ok )
{
QPainter p( &graphic );
renderer.render( &p );
}
setGraphic( rect, graphic );
return ok;
}
bool QwtPlotSvgItem::loadData( const QRectF& rect,
const QByteArray& data )
{
QwtGraphic graphic;
QSvgRenderer renderer;
const bool ok = renderer.load( data );
if ( ok )
{
QPainter p( &graphic );
renderer.render( &p );
}
setGraphic( rect, graphic );
return ok;
}
QwtGraphic
A paint device for scalable graphics.
Definition qwt_graphic.h:76
QwtPlotGraphicItem
A plot item, which displays a recorded sequence of QPainter commands.
Definition qwt_plot_graphicitem.h:30
QwtPlotGraphicItem::setGraphic
void setGraphic(const QRectF &rect, const QwtGraphic &)
Definition qwt_plot_graphicitem.cpp:82
QwtPlotGraphicItem::graphic
QwtGraphic graphic() const
Definition qwt_plot_graphicitem.cpp:96
QwtPlotSvgItem::~QwtPlotSvgItem
virtual ~QwtPlotSvgItem()
Destructor.
Definition qwt_plot_svgitem.cpp:35
QwtPlotSvgItem::loadData
bool loadData(const QRectF &, const QByteArray &)
Definition qwt_plot_svgitem.cpp:74
QwtPlotSvgItem::loadFile
bool loadFile(const QRectF &, const QString &fileName)
Definition qwt_plot_svgitem.cpp:47
QwtPlotSvgItem::QwtPlotSvgItem
QwtPlotSvgItem(const QString &title=QString())
Constructor.
Definition qwt_plot_svgitem.cpp:20
QwtText
A class representing a text.
Definition qwt_text.h:52