[Kst] Re: kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Tue Jul 6 06:12:51 CEST 2004


On Monday 05 July 2004 19:09, Rick Chern wrote:
> CVS commit by rchern:
>
> Individual plot colours for each plot.
> Note: right now, if the plot foreground or background colour happens to be
> the same as the current default setting, then no foreground or background
> colour is saved, respectively.
>
>
>   M +47 -5     kst2dplot.cpp   1.131
>   M +9 -0      kst2dplot.h   1.57

   Why not use KstViewObject:: background and foreground colour settings?  
Duplicating these variables can lead to quite some confusion I think.  The 
only case I can think of for duplicating is if we want the PlotRegion to have 
a different background than the exterior portion of the plot, but that sounds 
a bit needless to me.

BTW: you should write accessors and pass variables in like this for efficiency 
and consistency:

void setX(const SomeClassName& variable);
const SomeClassName& x() const;

The const is particularly important because without it, you can't do anything 
of value to a const pointer without casting away the const (ugly, potentially 
dangerous).  Passing by reference avoids unnecessary data copies and improves 
efficieny, in particular with classes that have d-pointers.  Finally, for 
consistency, we use Qt-style nomenclature for accessor methods:
"property()" as opposed to "getProperty()".  This helps avoid constant lookups 
in header files to find out if the property accessor method has "get" before 
it or not.  I've tried to document many of these things in 
devel-docs/codingstyle.txt.

--

George Staikos
KDE Developer				http://www.kde.org/
Staikos Computing Services Inc.		http://www.staikos.net/



More information about the Kst mailing list