// Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #include "piechart.h" #include "pieslice.h" PieChart::PieChart(QQuickItem *parent) : QQuickItem(parent) { } QString PieChart::name() const { return m_name; } void PieChart::setName(const QString &name) { m_name = name; } //![0] QQmlListProperty PieChart::slices() { return QQmlListProperty(this, nullptr, &PieChart::append_slice, nullptr, nullptr, nullptr, nullptr, nullptr); } void PieChart::append_slice(QQmlListProperty *list, PieSlice *slice) { PieChart *chart = qobject_cast(list->object); if (chart) { slice->setParentItem(chart); chart->m_slices.append(slice); } } //![0]