#include "kplotobject.h"
KPlotObject::KPlotObject() {
- KPlotObject( "", "white", POINTS );
+ KPlotObject( "", Qt::white, POINTS );
}
-KPlotObject::KPlotObject( const QString &n, const QString &c, PTYPE t, unsigned int s, unsigned int p ) {
+KPlotObject::KPlotObject( const QString &n, const QColor &c, PTYPE t, unsigned int s, unsigned int p ) {
//We use the set functions because they may include data validation
setName( n );
setColor( c );
/**
* Constructor. Create a KPlotObject according to the arguments.
*/
- KPlotObject( const QString &name, const QString &color, PTYPE otype, unsigned int size=2, unsigned int param=0 );
+ KPlotObject( const QString &name, const QColor &color, PTYPE otype, unsigned int size=2, unsigned int param=0 );
/**
* Destructor (empty)
/**
* @return the KPlotObject's Color
*/
- QString color() const { return Color; }
+ QColor color() const { return Color; }
/**
* Set the KPlotObject's Color
* @param c the new color
*/
- void setColor( const QString &c ) { Color = c; }
+ void setColor( const QColor &c ) { Color = c; }
/**
* @return the KPlotObject's Type
QList<QPointF*> pList;
PTYPE Type;
unsigned int Size, Parameter;
- QString Color, Name;
+ QString Name;
+ QColor Color;
};
#endif
KPlotObject *po = ( *it );
if ( po->points()->count() ) {
//draw the plot object
- p->setPen( QColor( po->color() ) );
+ p->setPen( po->color() );
switch ( po->type() ) {
case KPlotObject::POINTS :
{
- p->setBrush( QColor( po->color() ) );
+ p->setBrush( po->color() );
for ( QList<QPointF*>::ConstIterator dpit = po->points()->begin(); dpit != po->points()->constEnd(); ++dpit )
{
case KPlotObject::CURVE :
{
- p->setPen( QPen( QColor( po->color() ), po->size(), (Qt::PenStyle)po->param() ) );
+ p->setPen( QPen( po->color(), po->size(), (Qt::PenStyle)po->param() ) );
QPolygon poly;
for ( QList<QPointF*>::ConstIterator dpit = po->points()->begin(); dpit != po->points()->constEnd(); ++dpit )
poly << mapToPoint( **dpit );
case KPlotObject::POLYGON :
{
- QColor co( po->color() );
- p->setPen( QPen( co, po->size(), (Qt::PenStyle)po->param() ) );
- p->setBrush( co );
+ p->setPen( QPen( po->color(), po->size(), (Qt::PenStyle)po->param() ) );
+ p->setBrush( po->color() );
QPolygon a( po->count() );