[kde-edu]: KDE-EDU KPlotWidget and KPlotAxis

Andreas Nicolai Andreas.Nicolai at gmx.net
Sat Jun 18 16:46:41 CEST 2005


Hi everyone,

(at first, I finally got SVN working, so now I can commit new stuff by 
myself :-)

some new functionality is available for KPlotWidget. All data for a single 
axis is now available through new member variables LeftAxis and BottomAxis. 
Later we may add a TopAxis and RightAxis also, but right now the drawing code 
just includes a BottomAxis (X) and LeftAxis (Y) as before.  In order to set 
each axis properties, for instance the axis label, you now do

  plotWidget->LeftAxis.setLabel(...);

to retrieve use

  plotWidget->LeftAxis.label(...);

Old functions like setXAxisLabel() are kept for compatibility, but I would 
recommand using the axis objects directly as shown above. 
I compiled Kalzium and KStars with the new code and both compile fine (I had 
to keep some old variables in order not to break the code, maybe some of the 
features in the KStarsPlotWidget could be generalized and put in the 
KPlotWidget?).

You can now also set the number format for axis labels, using

  plotWidget->LeftAxis.setLabelFormat(5, 'g', 2);

The arguments are the same as for QString::arg()

You can turn on or off the different axis separately now, using the "visible" 
property of the axis objects (member functions isVisible(), setVisible(), 
show() and hide(), I used isVisible() instead of visible() because QWidgets 
also have the function isVisible() )

Bye,
Andreas


More information about the kde-edu mailing list