From: Pino Toscano Date: Fri, 16 Feb 2007 17:10:21 +0000 (+0000) Subject: API change: move the axis in the Private class X-Git-Tag: v3.80.3~52 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=cc82c68f51d00d86643bbe79f7375e1a9778dfde;p=libqmvoc.git API change: move the axis in the Private class svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=634230 --- diff --git a/kdeeduplot/kplotwidget.cpp b/kdeeduplot/kplotwidget.cpp index 5f1be0a..6d987e5 100644 --- a/kdeeduplot/kplotwidget.cpp +++ b/kdeeduplot/kplotwidget.cpp @@ -46,6 +46,22 @@ class KPlotWidget::Private cBackground( Qt::white ), cForeground( Qt::white ), cGrid( Qt::gray ), showGrid( false ), showObjectToolTips( true ), useAntialias( false ) { + // create the axes and setting their default properties + KPlotAxis *leftAxis = new KPlotAxis(); + leftAxis->setShowTickLabels( true ); + axes.insert( LeftAxis, leftAxis ); + KPlotAxis *bottomAxis = new KPlotAxis(); + bottomAxis->setShowTickLabels( true ); + axes.insert( BottomAxis, bottomAxis ); + KPlotAxis *rightAxis = new KPlotAxis(); + axes.insert( RightAxis, rightAxis ); + KPlotAxis *topAxis = new KPlotAxis(); + axes.insert( TopAxis, topAxis ); + } + + Private() + { + qDeleteAll( axes ); } KPlotWidget *q; @@ -56,6 +72,8 @@ class KPlotWidget::Private bool showGrid, showObjectToolTips, useAntialias; //padding int leftPadding, rightPadding, topPadding, bottomPadding; + // hashmap with the axes we have + QHash axes; }; KPlotWidget::KPlotWidget( QWidget *parent, double x1, double x2, double y1, double y2 ) @@ -63,20 +81,10 @@ KPlotWidget::KPlotWidget( QWidget *parent, double x1, double x2, double y1, doub { setAttribute( Qt::WA_NoBackground, true ); - // create the axes - mAxes[LeftAxis] = new KPlotAxis(); - mAxes[BottomAxis] = new KPlotAxis(); - mAxes[RightAxis] = new KPlotAxis(); - mAxes[TopAxis] = new KPlotAxis(); - //set DataRect setLimits( x1, x2, y1, y2 ); SecondDataRect = QRect(); //default: no secondary data rect - //By default, the left and bottom axes have tickmark labels - axis(LeftAxis)->setShowTickLabels( true ); - axis(BottomAxis)->setShowTickLabels( true ); - setDefaultPaddings(); setMinimumSize( 150, 150 ); @@ -86,8 +94,6 @@ KPlotWidget::~KPlotWidget() { qDeleteAll( ObjectList ); ObjectList.clear(); - qDeleteAll( mAxes ); - mAxes.clear(); delete d; } @@ -273,14 +279,14 @@ void KPlotWidget::setShowObjectToolTips( bool show ) KPlotAxis* KPlotWidget::axis( Axis a ) { - QHash::Iterator it = mAxes.find( a ); - return it != mAxes.end() ? it.value() : 0; + QHash::Iterator it = d->axes.find( a ); + return it != d->axes.end() ? it.value() : 0; } const KPlotAxis* KPlotWidget::axis( Axis a ) const { - QHash::ConstIterator it = mAxes.find( a ); - return it != mAxes.end() ? it.value() : 0; + QHash::ConstIterator it = d->axes.find( a ); + return it != d->axes.end() ? it.value() : 0; } QList KPlotWidget::pointsUnderPoint( const QPoint& p ) const { diff --git a/kdeeduplot/kplotwidget.h b/kdeeduplot/kplotwidget.h index 3b6a8fa..c0b5d5a 100644 --- a/kdeeduplot/kplotwidget.h +++ b/kdeeduplot/kplotwidget.h @@ -445,11 +445,6 @@ protected: */ QList ObjectList; - /** - * Hashmap with the axes we have - */ - QHash mAxes; - //Grid of bools to mask "used" regions of the plot float PlotMask[100][100]; double px[100], py[100];