##// END OF EJS Templates
Minor changes to spline and model examples
Marek Rosa -
r894:29eac6e74027
parent child
Show More
@@ -118,8 +118,3 void CustomTableModel::addMapping(QString color, QRect area)
118 118 {
119 119 m_mapping.insertMulti(color, area);
120 120 }
121
122 void CustomTableModel::addMapping(QString color, int left, int top, int right, int bottom)
123 {
124 addMapping(color, QRect(QPoint(left, top), QPoint(right, bottom)));
125 }
@@ -22,9 +22,6
22 22 #define XYPOINTSMODEL_H
23 23
24 24 #include <QAbstractTableModel>
25 #include <QPointF>
26 #include <QStringList>
27 //#include <QColor>
28 25 #include <QHash>
29 26 #include <QRect>
30 27
@@ -42,7 +39,6 public:
42 39 Qt::ItemFlags flags ( const QModelIndex & index ) const;
43 40
44 41 void addMapping(QString color, QRect area);
45 void addMapping(QString color, int left, int top, int right, int bottom);
46 42 void clearMapping() { m_mapping.clear(); }
47 43
48 44 private:
@@ -38,13 +38,12 TableWidget::TableWidget(QWidget *parent)
38 38 // create table view and add model to it
39 39 QTableView *tableView = new QTableView;
40 40 tableView->setModel(model);
41 tableView->setMinimumWidth(200);
42 // tableView->setMaximumWidth(200);
43 // m_tableView->resizeColumnsToContents();
44 tableView->setColumnWidth(0, 50);
45 tableView->setColumnWidth(1, 50);
46 tableView->setColumnWidth(2, 50);
47 tableView->setColumnWidth(3, 50);
41 // tableView->
42 // tableView->setMinimumWidth(200);
43 tableView->setColumnWidth(0, 56);
44 tableView->setColumnWidth(1, 56);
45 tableView->setColumnWidth(2, 56);
46 tableView->setColumnWidth(3, 56);
48 47
49 48 QChart *m_chart = new QChart;
50 49 m_chart->setAnimationOptions(QChart::AllAnimations);
@@ -75,13 +74,11 TableWidget::TableWidget(QWidget *parent)
75 74 seriesColorHex = "#" + QString::number(m_series->pen().color().rgb(), 16).right(6).toUpper();
76 75 model->addMapping(seriesColorHex, QRect(2, 0, 2, model->rowCount()));
77 76
78 // m_chart->axisX()->setRange(0, 800);
79 // m_chart->axisY()->setRange(0, 120);
80
81 77 // create main layout
82 78 QGridLayout* mainLayout = new QGridLayout;
83 79 mainLayout->addWidget(tableView, 1, 0);
84 80 mainLayout->addWidget(m_chartView, 1, 1);
85 81 mainLayout->setColumnStretch(1, 1);
82 mainLayout->setColumnStretch(0, 0);
86 83 setLayout(mainLayout);
87 84 }
@@ -49,6 +49,7 int main(int argc, char *argv[])
49 49 QChart* chart = new QChart();
50 50 chart->addSeries(series);
51 51 chart->setTitle("Simple spline chart example");
52 chart->axisY()->setRange(0, 10);
52 53 //![3]
53 54
54 55 //![4]
General Comments 0
You need to be logged in to leave comments. Login now