qtcharts/qmlplugin/declarativechart.cpp

28 lines
705 B
C++
Raw Normal View History

2012-01-03 14:22:10 +00:00
#include "declarativechart.h"
QTCOMMERCIALCHART_BEGIN_NAMESPACE
2012-01-03 14:22:10 +00:00
DeclarativeChart::DeclarativeChart(QDeclarativeItem *parent)
: QDeclarativeItem(parent),
m_chart(new QChart(this))
2012-01-03 14:22:10 +00:00
{
setFlag(QGraphicsItem::ItemHasNoContents, false);
2012-02-13 14:33:22 +00:00
// m_chart->setMargin(50); // TODO: should not be needed?
2012-01-03 14:22:10 +00:00
}
DeclarativeChart::ChartTheme DeclarativeChart::theme()
{
if (m_chart)
2012-02-09 13:31:00 +00:00
return (ChartTheme) m_chart->chartTheme();
2012-01-03 14:22:10 +00:00
}
void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
2012-01-03 14:22:10 +00:00
{
2012-02-13 14:33:22 +00:00
if (newGeometry.isValid())
m_chart->resize(newGeometry.width(), newGeometry.height());
2012-01-03 14:22:10 +00:00
}
#include "moc_declarativechart.cpp"
QTCOMMERCIALCHART_END_NAMESPACE