qwt_plot_svgitem.cpp
Go to the documentation of this file.
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2  * Qwt Widget Library
3  * Copyright (C) 1997 Josef Wilgen
4  * Copyright (C) 2002 Uwe Rathmann
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the Qwt License, Version 1.0
8  *****************************************************************************/
9 
10 #include "qwt_plot_svgitem.h"
11 #include "qwt_text.h"
12 #include "qwt_graphic.h"
13 
14 #include <qsvgrenderer.h>
15 
20 QwtPlotSvgItem::QwtPlotSvgItem( const QString& title ):
21  QwtPlotGraphicItem( QwtText( title ) )
22 {
23 }
24 
30  QwtPlotGraphicItem( title )
31 {
32 }
33 
36 {
37 }
38 
47 bool QwtPlotSvgItem::loadFile( const QRectF &rect,
48  const QString &fileName )
49 {
51 
52  QSvgRenderer renderer;
53 
54  const bool ok = renderer.load( fileName );
55  if ( ok )
56  {
57  QPainter p( &graphic );
58  renderer.render( &p );
59  }
60 
61  setGraphic( rect, graphic );
62 
63  return ok;
64 }
65 
74 bool QwtPlotSvgItem::loadData( const QRectF &rect,
75  const QByteArray &data )
76 {
78 
79  QSvgRenderer renderer;
80 
81  const bool ok = renderer.load( data );
82  if ( ok )
83  {
84  QPainter p( &graphic );
85  renderer.render( &p );
86  }
87 
88  setGraphic( rect, graphic );
89 
90  return ok;
91 }
QwtPlotSvgItem(const QString &title=QString())
Constructor.
A plot item, which displays a recorded sequence of QPainter commands.
QwtGraphic graphic() const
A class representing a text.
Definition: qwt_text.h:51
virtual ~QwtPlotSvgItem()
Destructor.
A paint device for scalable graphics.
Definition: qwt_graphic.h:75
bool loadFile(const QRectF &, const QString &fileName)
bool loadData(const QRectF &, const QByteArray &)
dictionary data
Definition: mqtt_test.py:22
void setGraphic(const QRectF &rect, const QwtGraphic &)
const QwtText & title() const


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:48:10