]> Git trees. - libqmvoc.git/commitdiff
API change:
authorPino Toscano <pino@kde.org>
Sat, 17 Feb 2007 14:10:34 +0000 (14:10 +0000)
committerPino Toscano <pino@kde.org>
Sat, 17 Feb 2007 14:10:34 +0000 (14:10 +0000)
- move all the private stuff of KPlotPoint to the Private class

svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=634529

kdeeduplot/kplotobject.cpp
kdeeduplot/kplotobject.h

index c395254b202caaf8dddff5e586d3eb17c2ec11ee..2959ed1941afb0afa9f12f0f4a6f3c6226f747c5 100644 (file)
 #include "kplotobject.h"
 #include "kplotwidget.h"
 
+class KPlotPoint::Private
+{
+    public:
+        Private( KPlotPoint * qq, const QPointF &p, const QString &l, double bw )
+            : q( qq ), point( p ), label( l ), barWidth( bw )
+        {
+        }
+
+        KPlotPoint *q;
+
+        QPointF point;
+        QString label;
+        double barWidth;
+};
+
+
 class KPlotObject::Private
 {
     public:
@@ -48,24 +64,76 @@ class KPlotObject::Private
 
 
 KPlotPoint::KPlotPoint()
: X(0), Y(0), Label(QString()), BarWidth(0.0)
   : d( new Private( this, QPointF(), QString(), 0.0 ) )
 {
 }
 
-KPlotPoint::KPlotPoint( double x, double y, const QString &label, double barWidth ) 
-       : X( x ), Y( y ), Label( label ), BarWidth( barWidth )
+KPlotPoint::KPlotPoint( double x, double y, const QString &label, double barWidth )
+    : d( new Private( this, QPointF( x, y ), label, barWidth ) )
 {
 }
 
 KPlotPoint::KPlotPoint( const QPointF &p, const QString &label, double barWidth )
-       :       X( p.x() ), Y( p.y() ), Label( label ), BarWidth( barWidth )
+    : d( new Private( this, p, label, barWidth ) )
 {
 }
 
-KPlotPoint::~KPlotPoint() 
+KPlotPoint::~KPlotPoint()
 {
+    delete d;
 }
 
+QPointF KPlotPoint::position() const
+{
+    return d->point;
+}
+
+void KPlotPoint::setPosition( const QPointF &pos )
+{
+    d->point = pos;
+}
+
+double KPlotPoint::x() const
+{
+    return d->point.x();
+}
+
+void KPlotPoint::setX( double x )
+{
+    d->point.setX( x );
+}
+
+double KPlotPoint::y() const
+{
+    return d->point.y();
+}
+
+void KPlotPoint::setY( double y )
+{
+    d->point.setY( y );
+}
+
+QString KPlotPoint::label() const
+{
+    return d->label;
+}
+
+void KPlotPoint::setLabel( const QString &label )
+{
+    d->label = label;
+}
+
+double KPlotPoint::barWidth() const
+{
+    return d->barWidth;
+}
+
+void KPlotPoint::setBarWidth( double w )
+{
+    d->barWidth = w;
+}
+
+
 KPlotObject::KPlotObject( const QColor &c, PlotType t, double size, PointStyle ps )
     : d( new Private( this ) )
 {
index d8334d87dd5c350ed7de6c0d40ac26a3e79a2aa2..d685fcbf6d5a4e30fb6212061c37595621b66fd1 100644 (file)
@@ -44,7 +44,7 @@ class KDEEDUPLOT_EXPORT KPlotPoint {
        /** 
         *Default constructor.
         */
-       KPlotPoint();
+        explicit KPlotPoint();
        /**
         * Constructor.  Sets the KPlotPoint according to the given arguments
         * @param x the X-position for the point, in Data units
@@ -54,7 +54,7 @@ class KDEEDUPLOT_EXPORT KPlotPoint {
         * @param width the BarWidth to use for this point (only used for 
         * plots of type KPlotObject::BARS)
         */
-       KPlotPoint( double x, double y, const QString &label="", double width=0.0 );
+        KPlotPoint( double x, double y, const QString &label = QString(), double width = 0.0 );
        /**
         * Constructor.  Sets the KPlotPoint according to the given arguments
         * @param p the position for the point, in Data units
@@ -63,7 +63,7 @@ class KDEEDUPLOT_EXPORT KPlotPoint {
         * @param width the BarWidth to use for this point (only used for 
         * plots of type KPlotObject::BARS)
         */
-       KPlotPoint( const QPointF &p, const QString &label="", double width=0.0 );
+        explicit KPlotPoint( const QPointF &p, const QString &label = QString(), double width = 0.0 );
        /**
         * Destructor
         */
@@ -72,51 +72,52 @@ class KDEEDUPLOT_EXPORT KPlotPoint {
        /**
         * @return the position of the point, in data units
         */
-       QPointF position() const { return QPointF( X, Y ); }
+        QPointF position() const;
        /**
         * Set the position of the point, in data units
         * @param pos the new position for the point.
         */
-       void setPosition( const QPointF &pos ) { X = pos.x(); Y = pos.y(); }
+        void setPosition( const QPointF &pos );
        /**
         * @return the X-position of the point, in data units
         */
-       double x() const { return X; }
+        double x() const;
        /**
         * Set the X-position of the point, in Data units
         */
-       void setX( double x ) { X = x; }
+        void setX( double x );
        /**
         * @return the Y-position of the point, in data units
         */
-       double y() const { return Y; }
+        double y() const;
        /**
         * Set the Y-position of the point, in Data units
         */
-       void setY( double y ) { Y = y; }
+        void setY( double y );
 
        /**
         * @return the label for the point
         */
-       const QString& label() const { return Label; }
+        QString label() const;
        /**
         * Set the label for the point
         */
-       void setLabel( const QString &label ) { Label = label; }
+        void setLabel( const QString &label );
 
        /**
         * @return the bar-width for the point
         */
-       double barWidth() const { return BarWidth; }
+        double barWidth() const;
        /**
         * Set the bar-width for the point
         */
-       void setBarWidth( double w ) { BarWidth = w; }
+        void setBarWidth( double w );
 
  private:
-       double X, Y;
-       QString Label;
-  double BarWidth;
+        class Private;
+        Private * const d;
+
+        Q_DISABLE_COPY( KPlotPoint )
 };
 
 /**