void Ledger::readFile(QTextStream *inputStream) { if(inputStream){ if( !(validFile = readCsv(inputStream)) ){ clear(); setHorizontalHeaderLabels(QStringList("Error")); appendRow(static_cast<QStandardItem*>(new LedgerItem::QStandardItem("Invalid File Format"))); } computeTotal(); } else{ appendRow(constructEmptyRow()); validFile = true; } undoStack->setClean(); // setup signals connect(this,&QAbstractItemModel::dataChanged, this,&Ledger::computeTotal); connect(this,&QAbstractItemModel::rowsRemoved, this,&Ledger::computeTotal); connect(this,&QAbstractItemModel::rowsInserted,this,&Ledger::computeTotal); connect(undoStack,&QUndoStack::cleanChanged, this,&Ledger::sendChangeSignal); }
void main(int argc,char*argv[]){ map = readCsv("map.csv", width, height); for (int i = 0; i < width * height; i++){ if ((i + 1) % width == 0){ printf("%d\n", map[i]); } else{ printf("%d", map[i]); } } glutInit(&argc, argv); glutCreateWindow(argv[0]); glutDisplayFunc(display);//void (GLUTCALLBACK *func)(void) glutTimerFunc( 0, timer, 0); //unsigned int millis, void (GLUTCALLBACK *func)(int value), int value glutMainLoop(); }
MapColorReader::MapColorReader() { model = new QStandardItemModel(); QString fileName = ":/MyFiles/color-breawer.csv"; readCsv(fileName); }