[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/ksysguard/gui/SensorDisplayLib
From: Tobias Koenig <tokoe () kde ! org>
Date: 2006-09-07 17:52:31
Message-ID: 1157651551.336200.11635.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 581843 by tokoe:
Check whether there is a first element in the list, otherwise
Qt throws an assert...
M +30 -25 SignalPlotter.cc
--- trunk/KDE/kdebase/workspace/ksysguard/gui/SensorDisplayLib/SignalPlotter.cc \
#581842:581843 @@ -410,31 +410,36 @@
QList<QColor>::Iterator col;
col = mBeamColors.begin();
- /* The top bar shows the current values of all the beam data. This iterates \
through each different beam and plots the newest data for each*/
- QList<double> newestData = mBeamData.first();
- QList<double>::Iterator i;
- for(i = newestData.begin(); i != newestData.end(); ++i, ++col) {
- double newest_datapoint = *i;
- int start = x0 + (int)( bias * scaleFac );
- int end = x0 + (int)( ( bias += newest_datapoint ) * scaleFac );
- /* If the rect is wider than 2 pixels we draw only the last
- * pixels with the bright color. The rest is painted with
- * a 50% darker color. */
- if ( end - start > 1 ) {
- p.setPen( (*col).dark( 150 ) );
- p.setBrush( (*col).dark( 150 ) );
- p.drawRect( start, 1, end - start, h0 );
- p.setPen( *col );
- p.drawLine( end, 1, end, h0 );
- } else if ( start - end > 1 ) {
- p.setPen( (*col).dark( 150 ) );
- p.setBrush( (*col).dark( 150 ) );
- p.drawRect( end, 1, start - end, h0 );
- p.setPen( *col );
- p.drawLine( end, 1, end, h0 );
- } else {
- p.setPen( *col );
- p.drawLine( start, 1, start, h0 );
+ /**
+ * The top bar shows the current values of all the beam data.
+ * This iterates through each different beam and plots the newest data for each
+ */
+ if ( !mBeamData.isEmpty() ) {
+ QList<double> newestData = mBeamData.first();
+ QList<double>::Iterator i;
+ for(i = newestData.begin(); i != newestData.end(); ++i, ++col) {
+ double newest_datapoint = *i;
+ int start = x0 + (int)( bias * scaleFac );
+ int end = x0 + (int)( ( bias += newest_datapoint ) * scaleFac );
+ /* If the rect is wider than 2 pixels we draw only the last
+ * pixels with the bright color. The rest is painted with
+ * a 50% darker color. */
+ if ( end - start > 1 ) {
+ p.setPen( (*col).dark( 150 ) );
+ p.setBrush( (*col).dark( 150 ) );
+ p.drawRect( start, 1, end - start, h0 );
+ p.setPen( *col );
+ p.drawLine( end, 1, end, h0 );
+ } else if ( start - end > 1 ) {
+ p.setPen( (*col).dark( 150 ) );
+ p.setBrush( (*col).dark( 150 ) );
+ p.drawRect( end, 1, start - end, h0 );
+ p.setPen( *col );
+ p.drawLine( end, 1, end, h0 );
+ } else {
+ p.setPen( *col );
+ p.drawLine( start, 1, start, h0 );
+ }
}
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic