##// END OF EJS Templates
Color themes now enabled for scatter, pie and line series.
Color themes now enabled for scatter, pie and line series.

File last commit:

r75:cdad8ac737ab
r75:cdad8ac737ab
Show More
qchartwidget.cpp
57 lines | 1.3 KiB | text/x-c | CppLexer
/ src / qchartwidget.cpp
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19 #include "qchartwidget.h"
Michal Klocek
Refactor current draft to fit int current design specs...
r21 #include "qchartseries.h"
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19 #include <QGraphicsView>
#include <QGraphicsScene>
Michal Klocek
Refactor current draft to fit int current design specs...
r21 #include <QResizeEvent>
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19
Tero Ahola
Renamed to QtCommercialChart
r30 QTCOMMERCIALCHART_BEGIN_NAMESPACE
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19
QChartWidget::QChartWidget(QWidget *parent) :
Tero Ahola
Refactoring: QChartWidget is now a QGraphicsView
r55 QGraphicsView(parent)
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19 {
Tero Ahola
Added size hint for the widget
r29 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
Michal Klocek
Adds rubberband for zooming...
r58 m_scene = new QGraphicsScene();
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setScene(m_scene);
Tero Ahola
Refactored series creation with QChart
r61
Michal Klocek
Removes PIMPL for now...
r53 m_chart = new QChart();
m_scene->addItem(m_chart);
Tero Ahola
Refactoring: QChartWidget is now a QGraphicsView
r55 show();
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19 }
QChartWidget::~QChartWidget()
{
}
Michal Klocek
Refactor current draft to fit int current design specs...
r21 void QChartWidget::resizeEvent(QResizeEvent *event)
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19 {
Michal Klocek
Removes PIMPL for now...
r53 m_scene->setSceneRect(0,0,size().width(),size().height());
m_chart->setSize(size());
Michal Klocek
Refactor current draft to fit int current design specs...
r21 QWidget::resizeEvent(event);
}
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19
Tero Ahola
Added size hint for the widget
r29 QSize QChartWidget::sizeHint() const
{
// TODO: calculate size hint based on contents?
return QSize(100, 100);
}
Michal Klocek
Refactor current draft to fit int current design specs...
r21
void QChartWidget::addSeries(QChartSeries* series)
{
Michal Klocek
Removes PIMPL for now...
r53 m_chart->addSeries(series);
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19 }
Tero Ahola
Refactored series creation with QChart
r61 QChartSeries* QChartWidget::createSeries(QChartSeries::QChartSeriesType type)
Tero Ahola
Integrated scatter type series...
r42 {
Tero Ahola
Refactored series creation with QChart
r61 return m_chart->createSeries(type);
Tero Ahola
Integrated scatter type series...
r42 }
Tero Ahola
Draft implementation for setting color themes for a chart
r64
Tero Ahola
Color themes now enabled for scatter, pie and line series.
r75 void QChartWidget::setTheme(QChart::ChartThemeId theme)
Tero Ahola
Draft implementation for setting color themes for a chart
r64 {
m_chart->setTheme(theme);
}
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19 #include "moc_qchartwidget.cpp"
Tero Ahola
Renamed to QtCommercialChart
r30 QTCOMMERCIALCHART_END_NAMESPACE