~showard314/ubuntu/utopic/qtiplot/utopic_1311721

« back to all changes in this revision

Viewing changes to qtiplot/src/plot2D/ImageSymbol.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Scott Howard
  • Date: 2011-05-07 17:00:26 UTC
  • mfrom: (1.1.9 upstream) (2.1.10 sid)
  • Revision ID: james.westby@ubuntu.com-20110507170026-77wvcv8uc6955fff
* moved debian/build.conf into debian/patches/03_build_conf.patch
  to track changes to build.conf between releases. Updated
  debian/rules accordingly.
* New upstream release. (Closes: #599450)
* Refreshed patches.
* debian/control B-D on libalglib-dev, libtamuanova-dev,
  libqtexengine-dev
* debian/rules allows for parallel builds
* Byte compile python modules with dh_python2, removed debian/*.post{rm,inst}
  dropped dependency on depricated python-central (Closes: #587669)
* Added shared-mime-info xml data in debian/qtiplot.sharedmimeinfo
  (LP: #184307)
* 04_qwtplot3d_static.patch added to build a modified static
  library of qwt3dplot
* 05_link_gl2ps.patch added to use Debian gl2ps library.
* Policy 3.9.2, no changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
        File                 : ImageSymbol.cpp
 
3
    Project              : QtiPlot
 
4
    --------------------------------------------------------------------
 
5
        Copyright            : (C) 2010 by Ion Vasilief
 
6
    Email (use @ for *)  : ion_vasilief*yahoo.fr
 
7
        Description          : A QwtSymbol displaying a custom images
 
8
 
 
9
 ***************************************************************************/
 
10
 
 
11
/***************************************************************************
 
12
 *                                                                         *
 
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.                                    *
 
17
 *                                                                         *
 
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.                           *
 
22
 *                                                                         *
 
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                                           *
 
27
 *                                                                         *
 
28
 ***************************************************************************/
 
29
#include "ImageSymbol.h"
 
30
#include <QPainter>
 
31
#include <qwt_painter.h>
 
32
 
 
33
ImageSymbol::ImageSymbol(const QString& fileName):
 
34
                QwtSymbol(QwtSymbol::Image, QBrush(), QPen(Qt::NoPen), QSize()),
 
35
        d_image_path(fileName)
 
36
{
 
37
        d_pixmap.load(fileName);
 
38
        setSize(d_pixmap.size());
 
39
}
 
40
 
 
41
ImageSymbol::ImageSymbol(const QPixmap& pixmap, const QString& fileName):
 
42
                QwtSymbol(QwtSymbol::Image, QBrush(), QPen(Qt::NoPen), QSize()),
 
43
        d_image_path(fileName)
 
44
{
 
45
        d_pixmap = QPixmap(pixmap);
 
46
        setSize(d_pixmap.size());
 
47
}
 
48
 
 
49
ImageSymbol *ImageSymbol::clone() const
 
50
{
 
51
        ImageSymbol *other = new ImageSymbol(d_image_path);
 
52
        *other = *this;
 
53
 
 
54
        return other;
 
55
}
 
56
 
 
57
/*!
 
58
  \brief Draw the symbol into a bounding rectangle.
 
59
  \param painter Painter
 
60
  \param r Bounding rectangle
 
61
*/
 
62
void ImageSymbol::draw(QPainter *p, const QRect& r) const
 
63
{
 
64
        p->drawPixmap(r, d_pixmap);
 
65
}