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