/home/koen/project/wt/public-git/wt/examples/charts/ChartsExample.C File Reference

#include <math.h>
#include <fstream>
#include "ChartsExample.h"
#include "ChartConfig.h"
#include "CsvUtil.h"
#include <Wt/WApplication>
#include <Wt/WDate>
#include <Wt/WEnvironment>
#include <Wt/WItemDelegate>
#include <Wt/WStandardItemModel>
#include <Wt/WText>
#include <Wt/WBorderLayout>
#include <Wt/WFitLayout>
#include <Wt/WStandardItem>
#include <Wt/WTableView>
#include <Wt/Chart/WCartesianChart>
#include <Wt/Chart/WPieChart>

Go to the source code of this file.

Functions

WAbstractItemModelreadCsvFile (const char *fname, WContainerWidget *parent)


Function Documentation

WAbstractItemModel* @90::readCsvFile ( const char *  fname,
WContainerWidget parent 
) [static]

Definition at line 37 of file ChartsExample.C.

00039   {
00040     WStandardItemModel *model = new WStandardItemModel(0, 0, parent);
00041     std::ifstream f(fname);
00042     
00043     if (f) {
00044       readFromCsv(f, model);
00045 
00046       for (int row = 0; row < model->rowCount(); ++row)
00047         for (int col = 0; col < model->columnCount(); ++col)
00048           model->item(row, col)->setFlags(ItemIsSelectable | ItemIsEditable);
00049 
00050       return model;
00051     } else {
00052       WString error(WString::tr("error-missing-data"));
00053       error.arg(fname, UTF8);
00054       new WText(error, parent);
00055       return 0;
00056     }
00057   }


Generated on Thu May 20 18:14:56 2010 for Wt by doxygen 1.5.6