[kde-edu]: KDE/kdeedu/libkdeedu/kdeeduplot
Carsten Niehaus
cniehaus at gmx.de
Tue Oct 17 18:14:34 CEST 2006
SVN commit 596476 by cniehaus:
I needed to introduce this new ctor because I am using a KPlotWidget in a .ui file in Kalzium (see Revision 596474). The uic always uses Foo(QWidget*) and you cannot change this. Therefor I need a KPlotWidget(QWidget*)-ctor. Another solution would be to change the order of the arguements so that the QWidget = 0 would be at the first position. I would of course prefere that solution as it would remove this stupid second ctor.
Jason, Pino, what do you think?
CCMAIL:kde-edu at kde.org
M +35 -0 kplotwidget.cpp
M +6 -0 kplotwidget.h
--- trunk/KDE/kdeedu/libkdeedu/kdeeduplot/kplotwidget.cpp #596475:596476
@@ -36,6 +36,41 @@
#define XPADDING 20
#define YPADDING 20
+KPlotWidget::KPlotWidget( QWidget *parent )
+ : QFrame( parent ), ShowGrid( false ), ShowObjectToolTips( true ), UseAntialias( false )
+{
+ setAttribute( Qt::WA_NoBackground, true );
+
+ double x1 = 0.0;
+ double x2 = 1.0;
+ double y1 = 0.0;
+ double y2 = 1.0;
+
+ // 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();
+
+ //default colors:
+ setBackgroundColor( Qt::black );
+ setForegroundColor( Qt::white );
+ setGridColor( Qt::gray );
+
+ setMinimumSize( 150, 150 );
+
+}
+
KPlotWidget::KPlotWidget( double x1, double x2, double y1, double y2, QWidget *parent )
: QFrame( parent ), ShowGrid( false ), ShowObjectToolTips( true ), UseAntialias( false )
{
--- trunk/KDE/kdeedu/libkdeedu/kdeeduplot/kplotwidget.h #596475:596476
@@ -91,6 +91,12 @@
* @param parent the parent widget
*/
KPlotWidget( double x1=0.0, double x2=1.0, double y1=0.0, double y2=1.0, QWidget *parent=0 );
+
+ /**
+ * @short Constructor. x and y limits will be set to 0.0 and 1.0 (min/max)
+ * @param parent the parent widget
+ */
+ KPlotWidget( QWidget *parent=0 );
/**
* Destructor.
More information about the kde-edu
mailing list