##// END OF EJS Templates
QXYSeries: model data orientation added. QBarSeries: some model data function placeholders
QXYSeries: model data orientation added. QBarSeries: some model data function placeholders

File last commit:

r527:b700a12da54b
r527:b700a12da54b
Show More
tablewidget.cpp
54 lines | 1.4 KiB | text/x-c | CppLexer
Marek Rosa
Table model data example
r519 #include "tablewidget.h"
#include <QGridLayout>
#include <QTableView>
#include <QStyledItemDelegate>
#include "qlineseries.h"
#include "qsplineseries.h"
#include "customtablemodel.h"
#include "qpieseries.h"
TableWidget::TableWidget(QWidget *parent)
: QWidget(parent)
{
// create simple model for storing data
// user's table data model
CustomTableModel* model = new CustomTableModel;
QTableView* tableView = new QTableView;
tableView->setModel(model);
tableView->setMinimumSize(340, 480);
// tableView->setItemDelegate(new QStyledItemDelegate);
chartView = new QChartView;
chartView->setMinimumSize(640, 480);
// create
// QLineSeries* series = new QLineSeries;
QSplineSeries* series = new QSplineSeries;
series->setModel(model);
Marek Rosa
QXYSeries: model data orientation added. QBarSeries: some model data function placeholders
r527 series->setModelMapping(0,1, Qt::Vertical);
// series->setModelMappingY(1);
Marek Rosa
Table model data example
r519
// series->add(QPointF(150, 100));
// series->add(QPointF(200, 130));
// series->add(QPointF(250, 120));
// series->add(QPointF(300, 140));
// series->add(QPointF(350, 160));
// QPieSeries* pieSeries = new QPieSeries;
// pieSeries->setModel(model);
// pieSeries
chartView->addSeries(series);
// create main layout
QGridLayout* mainLayout = new QGridLayout;
mainLayout->addWidget(tableView, 1, 1);
mainLayout->addWidget(chartView, 1, 2);
setLayout(mainLayout);
}
TableWidget::~TableWidget()
{
}