diff --git a/src/qchart.cpp b/src/qchart.cpp index b9ed712..15cf830 100644 --- a/src/qchart.cpp +++ b/src/qchart.cpp @@ -94,6 +94,7 @@ QChart::~QChart() */ void QChart::addSeries(QSeries* series, QChartAxis* axisY) { + Q_ASSERT(series); d_ptr->m_dataset->addSeries(series, axisY); } @@ -105,6 +106,7 @@ void QChart::addSeries(QSeries* series, QChartAxis* axisY) */ void QChart::removeSeries(QSeries* series) { + Q_ASSERT(series); d_ptr->m_dataset->removeSeries(series); } @@ -172,9 +174,9 @@ QString QChart::title() const { //TODO: refactor me if (d_ptr->m_presenter->m_titleItem) - return d_ptr->m_presenter->m_titleItem->text(); + return d_ptr->m_presenter->m_titleItem->text(); else - return QString(); + return QString(); } /*! @@ -188,6 +190,14 @@ void QChart::setTitleFont(const QFont& font) d_ptr->m_presenter->updateLayout(); } +QFont QChart::titleFont() const +{ + if (d_ptr->m_presenter->m_titleItem) + return d_ptr->m_presenter->m_titleItem->font(); + else + return QFont(); +} + /*! Sets the \a brush used for rendering the title text. */ diff --git a/src/qchartview.cpp b/src/qchartview.cpp index cc19d6f..1f72f61 100644 --- a/src/qchartview.cpp +++ b/src/qchartview.cpp @@ -57,6 +57,7 @@ QChartView::QChartView(QChart *chart,QWidget *parent) : QGraphicsView(parent), d_ptr(new QChartViewPrivate()) { + Q_ASSERT(chart); d_ptr->m_scene = new QGraphicsScene(this); d_ptr->m_chart = chart; setFrameShape(QFrame::NoFrame);