KDEUI
kplotpoint.cpp
Go to the documentation of this file.
00001 /* -*- C++ -*- 00002 This file is part of the KDE libraries 00003 Copyright (C) 2003 Jason Harris <kstars@30doradus.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #include "kplotpoint.h" 00022 00023 #include <QtAlgorithms> 00024 #include <QPainter> 00025 00026 #include <kdebug.h> 00027 00028 class KPlotPoint::Private 00029 { 00030 public: 00031 Private( KPlotPoint * qq, const QPointF &p, const QString &l, double bw ) 00032 : q( qq ), point( p ), label( l ), barWidth( bw ) 00033 { 00034 } 00035 00036 KPlotPoint *q; 00037 00038 QPointF point; 00039 QString label; 00040 double barWidth; 00041 }; 00042 00043 KPlotPoint::KPlotPoint() 00044 : d( new Private( this, QPointF(), QString(), 0.0 ) ) 00045 { 00046 } 00047 00048 KPlotPoint::KPlotPoint( double x, double y, const QString &label, double barWidth ) 00049 : d( new Private( this, QPointF( x, y ), label, barWidth ) ) 00050 { 00051 } 00052 00053 KPlotPoint::KPlotPoint( const QPointF &p, const QString &label, double barWidth ) 00054 : d( new Private( this, p, label, barWidth ) ) 00055 { 00056 } 00057 00058 KPlotPoint::~KPlotPoint() 00059 { 00060 delete d; 00061 } 00062 00063 QPointF KPlotPoint::position() const 00064 { 00065 return d->point; 00066 } 00067 00068 void KPlotPoint::setPosition( const QPointF &pos ) 00069 { 00070 d->point = pos; 00071 } 00072 00073 double KPlotPoint::x() const 00074 { 00075 return d->point.x(); 00076 } 00077 00078 void KPlotPoint::setX( double x ) 00079 { 00080 d->point.setX( x ); 00081 } 00082 00083 double KPlotPoint::y() const 00084 { 00085 return d->point.y(); 00086 } 00087 00088 void KPlotPoint::setY( double y ) 00089 { 00090 d->point.setY( y ); 00091 } 00092 00093 QString KPlotPoint::label() const 00094 { 00095 return d->label; 00096 } 00097 00098 void KPlotPoint::setLabel( const QString &label ) 00099 { 00100 d->label = label; 00101 } 00102 00103 double KPlotPoint::barWidth() const 00104 { 00105 return d->barWidth; 00106 } 00107 00108 void KPlotPoint::setBarWidth( double w ) 00109 { 00110 d->barWidth = w; 00111 }
KDE 4.6 API Reference