[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/kexi/plugins/reportspgz/backend
From:       Adam Pigg <adam () piggz ! co ! uk>
Date:       2008-04-25 19:27:23
Message-ID: 1209151643.777807.30767.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 801140 by piggz:

Add background color and remove line color

 M  +33 -24    common/krchartdata.cpp  
 M  +4 -4      common/krchartdata.h  
 M  +18 -9     wrtembed/reportentitychart.cpp  


--- trunk/koffice/kexi/plugins/reportspgz/backend/common/krchartdata.cpp \
#801139:801140 @@ -27,7 +27,7 @@
 #include <kexidb/cursor.h>
 #include <kexidb/parser/parser.h>
 #include <koproperty/property.h>
-
+#include <QMotifStyle>
 #include <kdebug.h>
 typedef QVector<qreal> datalist;
 
@@ -108,16 +108,19 @@
 			_pos.setPointPos(r.topLeft());
 			_size.setPointSize(r.size());
 		}
-		
+		else if (n == "backgroundcolor")
+		{
+			_bgColor->setValue(QColor(node.firstChild().nodeValue()));	
+		}
 		else if (n == "linestyle")
 		{
 			ORLineStyleData ls;
-			if (parseReportLineStyleData( node.toElement(), ls ))
-			{
-				_lnWeight->setValue(ls.weight);
-				_lnColor->setValue(ls.lnColor);
-				_lnStyle->setValue(ls.style);
-			}
+//			if (parseReportLineStyleData( node.toElement(), ls ))
+//			{
+//				_lnWeight->setValue(ls.weight);
+//				_lnColor->setValue(ls.lnColor);
+//				_lnStyle->setValue(ls.style);
+//			}
 		}
 		else
 		{
@@ -173,10 +176,10 @@
 	_xTitle = new KoProperty::Property ( "XTitle", "", "X Axis Title", "X Axis Title" \
);  _yTitle = new KoProperty::Property ( "YTitle", "", "Y Axis Title", "Y Axis Title" \
);  
-	_lnWeight = new KoProperty::Property ( "Weight", 1, "Line Weight", "Line Weight" );
-	_lnColor = new KoProperty::Property ( "LineColor", Qt::black, "Line Color", "Line \
                Color" );
-	_lnStyle = new KoProperty::Property ( "LineStyle", Qt::NoPen, "Line Style", "Line \
                Style", KoProperty::LineStyle );
-
+	//_lnWeight = new KoProperty::Property ( "Weight", 1, "Line Weight", "Line Weight" \
); +	//_lnColor = new KoProperty::Property ( "LineColor", Qt::black, "Line Color", \
"Line Color" ); +	//_lnStyle = new KoProperty::Property ( "LineStyle", Qt::NoPen, \
"Line Style", "Line Style", KoProperty::LineStyle ); +	_bgColor = new \
KoProperty::Property ( "BackgroundColor", Qt::white, "Background Color", "Background \
Color" );  _set->addProperty ( _name );
 	_set->addProperty ( _dataSource );
 
@@ -190,11 +193,12 @@
 	_set->addProperty ( _aa );
 	_set->addProperty ( _xTitle );
 	_set->addProperty ( _yTitle );
+	_set->addProperty ( _bgColor );
+	
+	//_set->addProperty ( _lnWeight );
+	//_set->addProperty ( _lnColor );
+	//_set->addProperty ( _lnStyle );
 
-	_set->addProperty ( _lnWeight );
-	_set->addProperty ( _lnColor );
-	_set->addProperty ( _lnStyle );
-
 	set3D ( false );
 	setAA ( false );
 	setColorScheme ( "default" );
@@ -272,6 +276,8 @@
 			data.resize(cols);
 			
 			_chartWidget = new KDChart::Widget();
+			_chartWidget->setStyle(new QMotifStyle());
+			
 			_chartWidget->setType ( ( KDChart::Widget::ChartType ) \
_chartType->value().toInt() );  _chartWidget->setSubType ( ( KDChart::Widget::SubType \
) _chartSubType->value().toInt() );  set3D ( _threeD->value().toBool() );
@@ -327,6 +333,9 @@
 					}
 				}
 			}
+			
+			//Set the background color
+			_chartWidget->setStyleSheet("background-color: " + \
_bgColor->value().value<QColor>().name());  }
 		else
 		{
@@ -442,14 +451,14 @@
 	}
 }
 
-ORLineStyleData KRChartData::lineStyle()
-{
-	ORLineStyleData ls;
-	ls.weight = _lnWeight->value().toInt();
-	ls.lnColor = _lnColor->value().value<QColor>();
-	ls.style = (Qt::PenStyle)_lnStyle->value().toInt();
-	return ls;
-}
+//ORLineStyleData KRChartData::lineStyle()
+//{
+//	ORLineStyleData ls;
+//	ls.weight = _lnWeight->value().toInt();
+//	ls.lnColor = _lnColor->value().value<QColor>();
+//	ls.style = (Qt::PenStyle)_lnStyle->value().toInt();
+//	return ls;
+//}
 
 KexiDB::Cursor *KRChartData::dataSet()
 {
--- trunk/koffice/kexi/plugins/reportspgz/backend/common/krchartdata.h #801139:801140
@@ -61,11 +61,11 @@
 		KoProperty::Property * _yTitle;
 		
 		KoProperty::Property *_bgColor;
-		KoProperty::Property* _lnColor;
-		KoProperty::Property* _lnWeight;
-		KoProperty::Property* _lnStyle;
+		//KoProperty::Property* _lnColor;
+		//KoProperty::Property* _lnWeight;
+		//KoProperty::Property* _lnStyle;
 		
-		ORLineStyleData lineStyle();
+		//ORLineStyleData lineStyle();
 		
 		KDChart::Widget *_chartWidget;
 		
--- trunk/koffice/kexi/plugins/reportspgz/backend/wrtembed/reportentitychart.cpp \
#801139:801140 @@ -91,14 +91,14 @@
 	painter->drawText ( rect(), 0, _dataSource->value().toString() +QObject::tr ( ":" ) \
+QObject::tr ( "chart" ) );  
 
-	if ( ( Qt::PenStyle ) _lnStyle->value().toInt() == Qt::NoPen || \
                _lnWeight->value().toInt() <= 0 )
-	{
+//	if ( ( Qt::PenStyle ) _lnStyle->value().toInt() == Qt::NoPen || \
_lnWeight->value().toInt() <= 0 ) +//	{
 		painter->setPen ( QPen ( QColor ( 224,224,224 ) ) );
-	}
-	else
-	{
-		painter->setPen ( QPen ( _lnColor->value().value<QColor>(), \
                _lnWeight->value().toInt(), ( Qt::PenStyle ) \
                _lnStyle->value().toInt() ) );
-	}
+//	}
+//	else
+//	{
+//		painter->setPen ( QPen ( _lnColor->value().value<QColor>(), \
_lnWeight->value().toInt(), ( Qt::PenStyle ) _lnStyle->value().toInt() ) ); +//	}
 
 	painter->drawRect ( rect() );
 
@@ -181,8 +181,13 @@
 	yt.appendChild ( doc.createTextNode ( _yTitle->value().toString() ));
 	entity.appendChild ( yt );
 	
+	//background color
+	QDomElement bc = doc.createElement ( "backgroundcolor" );
+	bc.appendChild ( doc.createTextNode ( _bgColor->value().value<QColor>().name() ));
+	entity.appendChild ( bc );
+	
 	//Line Style
-	buildXMLLineStyle(doc, entity, lineStyle());
+//	buildXMLLineStyle(doc, entity, lineStyle());
 	
 	parent.appendChild ( entity );
 }
@@ -228,7 +233,11 @@
 	{
 		setAxis();
 	}
-
+	else if ( p.name() == "BackgroundColor")
+	{
+		_chartWidget->setStyleSheet("background-color: " + \
_bgColor->value().value<QColor>().name()); +	}
+	
 	if ( _chartWidget )
 	{
 		_chartWidget->setType ( ( KDChart::Widget::ChartType ) _chartType->value().toInt() \
);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic