qtcharts/qmlplugin/declarativechart.cpp

29 lines
712 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);
}
DeclarativeChart::ChartTheme DeclarativeChart::theme()
{
2012-02-24 09:33:17 +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-17 09:03:26 +00:00
if (newGeometry.isValid()) {
if (newGeometry.width() > 0 && newGeometry.height() > 0) {
m_chart->resize(newGeometry.width(), newGeometry.height());
2012-02-17 09:03:26 +00:00
}
}
2012-01-03 14:22:10 +00:00
}
#include "moc_declarativechart.cpp"
QTCOMMERCIALCHART_END_NAMESPACE