rahulch

Untitled

Feb 28th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void ChartModel::appendData(QList<double> graphAttributes)
  2. {
  3.     int vecSize = vec_.size();
  4.  
  5.     // limit reached, remove first row and append new row
  6.     if (vecSize == 100) {
  7.         beginRemoveRows(QModelIndex(), 0, 1);
  8.         vec_.removeAt(0);
  9.         vecSize = vec_.size();
  10.         endRemoveRows();
  11.     }
  12.  
  13.     beginInsertRows(QModelIndex(), vecSize, vecSize+1);
  14.  
  15.     double xVal = vec_.size();
  16.     QList<double> coordinates = {xVal, graphAttributes.at(0), graphAttributes.at(1)};
  17.     qDebug() << coordinates;
  18.     vec_.push_back(coordinates);
  19.  
  20.     endInsertRows();
  21. }
Add Comment
Please, Sign In to add comment