/************************* * * * * * * * * * * * * *************************** Copyright (c) 1999-2005 Ryan Bobko ryan@ostrich-emulators.com This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ************************* * * * * * * * * * * * * ***************************/ #include "singlelinegraph.h" #include "qhacctable.h" #include "qhacc.h" #include // plugin factory calls extern "C" { QHaccPlugin * create(){ return new SingleLineGraph; } void destroy( SingleLineGraph * p ){ delete p; } } SingleLineGraph::SingleLineGraph(){ setIvsE( false ); setLine( true ); } SingleLineGraph::~SingleLineGraph(){} void SingleLineGraph::paintRow( QPainter * p, const TableRow& last, const TableRow& row, int wstart, int, const QColor& color, bool drawTots, const QString& head ) const { //cout<<"PAINTROW\t"<toString()<<"\t"; //if( last ) cout<toString(); //else cout<<"no last row"; //cout<rows()>1 ); int sstart=wstart, send=wpm; int tstart=wstart; //p->setPen( QPen( color ) ); //cout<<" point is ("<setPen( QPen( color, 3 ) ); else p->setPen( QPen( "black", 3 ) ); // draw a line from the last value to this one int lsum=last.geti( INCREASES )+last.geti( DECREASES ); int lwpos=wpos-wpm; int lhpos=zeroline-( int )( lsum/factor ); //cout<<" last was ("<drawLine( lwpos, lhpos, wpos, hpos ); p->fillRect( lwpos-3, lhpos-3, 6, 6, QBrush( "black" ) ); } // draw a little box over the datapoint p->fillRect( wpos-3, hpos-3, 6, 6, QBrush( "black" ) ); if( !head.isNull() ) drawTitle( p, head, sstart, tstart, hpos ); if( drawTots ) drawSum( p, sum, sstart, hpos, send, p->fontMetrics().height() ); } const SingleLineInfo SingleLineGraph::pinfo; const PluginInfo& SingleLineGraph::info() const { return pinfo; }