1
/***************************************************************************
4
--------------------------------------------------------------------
5
Copyright : (C) 2010 by Ion Vasilief
6
Email (use @ for *) : ion_vasilief*yahoo.fr
7
Description : A QwtSymbol displaying a custom images
9
***************************************************************************/
11
/***************************************************************************
13
* This program is free software; you can redistribute it and/or modify *
14
* it under the terms of the GNU General Public License as published by *
15
* the Free Software Foundation; either version 2 of the License, or *
16
* (at your option) any later version. *
18
* This program is distributed in the hope that it will be useful, *
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21
* GNU General Public License for more details. *
23
* You should have received a copy of the GNU General Public License *
24
* along with this program; if not, write to the Free Software *
25
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26
* Boston, MA 02110-1301 USA *
28
***************************************************************************/
29
#include "ImageSymbol.h"
31
#include <qwt_painter.h>
33
ImageSymbol::ImageSymbol(const QString& fileName):
34
QwtSymbol(QwtSymbol::Image, QBrush(), QPen(Qt::NoPen), QSize()),
35
d_image_path(fileName)
37
d_pixmap.load(fileName);
38
setSize(d_pixmap.size());
41
ImageSymbol::ImageSymbol(const QPixmap& pixmap, const QString& fileName):
42
QwtSymbol(QwtSymbol::Image, QBrush(), QPen(Qt::NoPen), QSize()),
43
d_image_path(fileName)
45
d_pixmap = QPixmap(pixmap);
46
setSize(d_pixmap.size());
49
ImageSymbol *ImageSymbol::clone() const
51
ImageSymbol *other = new ImageSymbol(d_image_path);
58
\brief Draw the symbol into a bounding rectangle.
59
\param painter Painter
60
\param r Bounding rectangle
62
void ImageSymbol::draw(QPainter *p, const QRect& r) const
64
p->drawPixmap(r, d_pixmap);