##// END OF EJS Templates
Adjust bin direcotry in compilation config
Adjust bin direcotry in compilation config

File last commit:

r39:abd9caf3a53e
r41:f222db1b1731
Show More
qchartwidget.cpp
69 lines | 1.5 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
class QChartWidgetPrivate
{
public:
Michal Klocek
Refactor current draft to fit int current design specs...
r21 QChartWidgetPrivate(QChartWidget *parent) :
m_view(0),
m_scene(0),
Michal Klocek
Adds pimpl to qchart class
r28 m_chart(0)
Michal Klocek
Refactor current draft to fit int current design specs...
r21 {
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19 m_scene = new QGraphicsScene();
Michal Klocek
Refactor current draft to fit int current design specs...
r21 m_view = new QGraphicsView(parent);
m_view->setScene(m_scene);
m_chart = new QChart();
m_scene->addItem(m_chart);
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19 }
Michal Klocek
Refactor current draft to fit int current design specs...
r21
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19 ~QChartWidgetPrivate() {
}
QGraphicsView *m_view;
QGraphicsScene *m_scene;
QChart* m_chart;
};
Tero Ahola
Added size hint for the widget
r29 ///////////////////////////////////////////////////////////////////////////////////////////////////
Michal Klocek
Adds pimpl to qchart class
r28
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19 QChartWidget::QChartWidget(QWidget *parent) :
QWidget(parent),
Michal Klocek
Refactor current draft to fit int current design specs...
r21 d_ptr(new QChartWidgetPrivate(this))
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);
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 delete d_ptr;
Tero Ahola
Started to refactor the API to allow integrating different plot types
r19 }
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
Refactor current draft to fit int current design specs...
r21 Q_D(QChartWidget);
d->m_view->resize(size().width(),size().height());
d->m_scene->setSceneRect(0,0,size().width(),size().height());
d->m_chart->setSize(size());
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)
{
Q_D(QChartWidget);
d->m_chart->addSeries(series);
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