##// END OF EJS Templates
Fix bar category axis labels...
Fix bar category axis labels The labels are now created only for the categories within the current range. Change-Id: I1f1b5c9245254b18c87f810986e29d73a1a7a72e Task-number: QTRD-3016 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com>

File last commit:

r2714:929d943d1aab
r2720:d65072475355
Show More
declarativebarseries.cpp
509 lines | 17.9 KiB | text/x-c | CppLexer
/ src / chartsqml2 / declarativebarseries.cpp
Jani Honkonen
Add/modify license headers
r830 /****************************************************************************
**
Titta Heikkala
Update copyright year...
r2688 ** Copyright (C) 2014 Digia Plc
Jani Honkonen
Add/modify license headers
r830 ** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
Miikka Heikkinen
Qt Commercial -> Qt Enterprise...
r2574 ** This file is part of the Qt Enterprise Charts Add-on.
Jani Honkonen
Add/modify license headers
r830 **
** $QT_BEGIN_LICENSE$
Miikka Heikkinen
Qt Commercial -> Qt Enterprise...
r2574 ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the
Jani Honkonen
Add/modify license headers
r830 ** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.
**
** If you have questions regarding the use of this file, please use
** contact form at http://qt.digia.com
** $QT_END_LICENSE$
**
****************************************************************************/
Tero Ahola
Added QML api for bar series
r646 #include "declarativebarseries.h"
Titta Heikkala
Fix include syntax...
r2714 #include <QtCharts/QBarSet>
#include <QtCharts/QVBarModelMapper>
#include <QtCharts/QHBarModelMapper>
Tero Ahola
Added QML api for bar series
r646
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_BEGIN_NAMESPACE
Tero Ahola
Added QML api for bar series
r646
Jani Honkonen
coding style fixes for plugins
r2101 DeclarativeBarSet::DeclarativeBarSet(QObject *parent)
: QBarSet("", parent)
Tero Ahola
Added QML api for bar series
r646 {
Jani Honkonen
Normalize signal and slot signatures
r1937 connect(this, SIGNAL(valuesAdded(int,int)), this, SLOT(handleCountChanged(int,int)));
connect(this, SIGNAL(valuesRemoved(int,int)), this, SLOT(handleCountChanged(int,int)));
Titta Heikkala
Add possibility to set brush image via QML API...
r2681 connect(this, SIGNAL(brushChanged()), this, SLOT(handleBrushChanged()));
Tero Ahola
Property notifications: axis minmax, bar properties, xyseries p-visibl and count
r1465 }
void DeclarativeBarSet::handleCountChanged(int index, int count)
{
Q_UNUSED(index)
Q_UNUSED(count)
emit countChanged(QBarSet::count());
Tero Ahola
Added QML api for bar series
r646 }
Tero Ahola
Adding missing QML series API line/border properties
r1904 qreal DeclarativeBarSet::borderWidth() const
{
return pen().widthF();
}
void DeclarativeBarSet::setBorderWidth(qreal width)
{
if (width != pen().widthF()) {
QPen p = pen();
p.setWidthF(width);
setPen(p);
emit borderWidthChanged(width);
}
}
Tero Ahola
Added declarative model for bar series
r1162 QVariantList DeclarativeBarSet::values()
Tero Ahola
Added QML api for bar series
r646 {
Tero Ahola
Added declarative model for bar series
r1162 QVariantList values;
for (int i(0); i < count(); i++)
Tero Ahola
QML BarSet data manipulation
r1513 values.append(QVariant(QBarSet::at(i)));
Tero Ahola
Added declarative model for bar series
r1162 return values;
Tero Ahola
Enabled dummy bar chart impl in QML again
r1004 }
Tero Ahola
Added QML api for bar series
r646
Tero Ahola
Added declarative model for bar series
r1162 void DeclarativeBarSet::setValues(QVariantList values)
Tero Ahola
Enabled dummy bar chart impl in QML again
r1004 {
Tero Ahola
Added declarative model for bar series
r1162 while (count())
remove(count() - 1);
Tero Ahola
Added QML api for bar series
r646
Titta Heikkala
Fix setting values for BarSet using Qt.point...
r2678 if (values.at(0).canConvert(QVariant::Point)) {
// Create list of values for appending if the first item is Qt.point
int maxValue = 0;
for (int i = 0; i < values.count(); i++) {
if (values.at(i).canConvert(QVariant::Point) &&
values.at(i).toPoint().x() > maxValue) {
maxValue = values.at(i).toPoint().x();
}
}
QVector<int> indexValueList;
indexValueList.resize(maxValue + 1);
for (int i = 0; i < values.count(); i++) {
if (values.at(i).canConvert(QVariant::Point)) {
indexValueList.replace(values.at(i).toPoint().x(), values.at(i).toPoint().y());
}
}
for (int i = 0; i < indexValueList.count(); i++)
QBarSet::append(indexValueList.at(i));
} else {
for (int i(0); i < values.count(); i++) {
if (values.at(i).canConvert(QVariant::Double))
QBarSet::append(values[i].toDouble());
}
Tero Ahola
Enabled dummy bar chart impl in QML again
r1004 }
Tero Ahola
Added declarative model for bar series
r1162 }
Tero Ahola
Added QML api for bar series
r646
Titta Heikkala
Add possibility to set brush image via QML API...
r2681 QString DeclarativeBarSet::brushFilename() const
{
return m_brushFilename;
}
void DeclarativeBarSet::setBrushFilename(const QString &brushFilename)
{
QImage brushImage(brushFilename);
if (QBarSet::brush().textureImage() != brushImage) {
QBrush brush = QBarSet::brush();
brush.setTextureImage(brushImage);
QBarSet::setBrush(brush);
m_brushFilename = brushFilename;
m_brushImage = brushImage;
emit brushFilenameChanged(brushFilename);
}
}
void DeclarativeBarSet::handleBrushChanged()
{
// If the texture image of the brush has changed along the brush
// the brush file name needs to be cleared.
if (!m_brushFilename.isEmpty() && QBarSet::brush().textureImage() != m_brushImage) {
m_brushFilename.clear();
emit brushFilenameChanged(QString(""));
}
}
sauimone
declarative series for horizontal barcharts
r1806 // Declarative bar series ======================================================================================
Titta Heikkala
Qt Charts project file structure change...
r2712 DeclarativeBarSeries::DeclarativeBarSeries(QQuickItem *parent) :
Tero Ahola
Refactored QML axis handling
r1813 QBarSeries(parent),
Tero Ahola
Added axisXTop and axisYRight properties to QML series APIs
r2296 m_axes(new DeclarativeAxes(this))
Tero Ahola
Cleaning up declarative implementation
r1211 {
Tero Ahola
Added axisXTop and axisYRight properties to QML series APIs
r2296 connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
Tero Ahola
Cleaning up declarative implementation
r1211 }
sauimone
GroupedBarSeries to BarSeries
r1594 void DeclarativeBarSeries::classBegin()
Tero Ahola
Cleaning up declarative implementation
r1211 {
}
sauimone
GroupedBarSeries to BarSeries
r1594 void DeclarativeBarSeries::componentComplete()
Tero Ahola
Cleaning up declarative implementation
r1211 {
Jani Honkonen
coding style: foreach whitespace fix
r2100 foreach (QObject *child, children()) {
Tero Ahola
Color properties to QML BarSet API
r1302 if (qobject_cast<DeclarativeBarSet *>(child)) {
sauimone
QBarSeries to QAbstractBarSeries
r1584 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
Jani Honkonen
coding style fixes for plugins
r2101 } else if (qobject_cast<QVBarModelMapper *>(child)) {
Tero Ahola
Bar model mapper to Qml custom model demo
r1313 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
mapper->setSeries(this);
Jani Honkonen
coding style fixes for plugins
r2101 } else if (qobject_cast<QHBarModelMapper *>(child)) {
Tero Ahola
Bar model mapper to Qml custom model demo
r1313 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
mapper->setSeries(this);
Tero Ahola
Cleaning up declarative implementation
r1211 }
}
}
Titta Heikkala
Qt Charts project file structure change...
r2712 QQmlListProperty<QObject> DeclarativeBarSeries::seriesChildren()
Tero Ahola
Bar model mapper to Qml custom model demo
r1313 {
Titta Heikkala
Qt Charts project file structure change...
r2712 return QQmlListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren ,0,0,0);
Tero Ahola
Bar model mapper to Qml custom model demo
r1313 }
Titta Heikkala
Qt Charts project file structure change...
r2712 void DeclarativeBarSeries::appendSeriesChildren(QQmlListProperty<QObject> *list, QObject *element)
Tero Ahola
Cleaning up declarative implementation
r1211 {
Tero Ahola
Bar model mapper to Qml custom model demo
r1313 // Empty implementation; the children are parsed in componentComplete instead
Q_UNUSED(list);
Q_UNUSED(element);
Tero Ahola
Cleaning up declarative implementation
r1211 }
sauimone
GroupedBarSeries to BarSeries
r1594 DeclarativeBarSet *DeclarativeBarSeries::at(int index)
Tero Ahola
Color properties to QML BarSet API
r1302 {
Jani Honkonen
coding style fixes for plugins
r2101 QList<QBarSet *> setList = barSets();
Tero Ahola
Implemented BarSeries::append, insert, remove and clear to QML API
r1511 if (index >= 0 && index < setList.count())
Tero Ahola
Color properties to QML BarSet API
r1302 return qobject_cast<DeclarativeBarSet *>(setList[index]);
return 0;
}
sauimone
GroupedBarSeries to BarSeries
r1594 DeclarativeBarSet *DeclarativeBarSeries::insert(int index, QString label, QVariantList values)
Tero Ahola
Implemented BarSeries::append, insert, remove and clear to QML API
r1511 {
DeclarativeBarSet *barset = new DeclarativeBarSet(this);
barset->setLabel(label);
barset->setValues(values);
sauimone
GroupedBarSeries to BarSeries
r1594 if (QBarSeries::insert(index, barset))
Tero Ahola
Implemented BarSeries::append, insert, remove and clear to QML API
r1511 return barset;
delete barset;
return 0;
}
sauimone
declarative series for horizontal barcharts
r1806 // Declarative stacked bar series ==============================================================================
Titta Heikkala
Qt Charts project file structure change...
r2712 DeclarativeStackedBarSeries::DeclarativeStackedBarSeries(QQuickItem *parent) :
Tero Ahola
Refactored QML axis handling
r1813 QStackedBarSeries(parent),
Tero Ahola
Added axisXTop and axisYRight properties to QML series APIs
r2296 m_axes(0)
Tero Ahola
Added stacked and percent bar series to QML api
r1318 {
Tero Ahola
Added axisXTop and axisYRight properties to QML series APIs
r2296 m_axes = new DeclarativeAxes(this);
connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
Tero Ahola
Added stacked and percent bar series to QML api
r1318 }
void DeclarativeStackedBarSeries::classBegin()
{
}
void DeclarativeStackedBarSeries::componentComplete()
{
Jani Honkonen
coding style: foreach whitespace fix
r2100 foreach (QObject *child, children()) {
Tero Ahola
Added stacked and percent bar series to QML api
r1318 if (qobject_cast<DeclarativeBarSet *>(child)) {
sauimone
QBarSeries to QAbstractBarSeries
r1584 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
Jani Honkonen
coding style fixes for plugins
r2101 } else if (qobject_cast<QVBarModelMapper *>(child)) {
Tero Ahola
Added stacked and percent bar series to QML api
r1318 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
mapper->setSeries(this);
Jani Honkonen
coding style fixes for plugins
r2101 } else if (qobject_cast<QHBarModelMapper *>(child)) {
Tero Ahola
Added stacked and percent bar series to QML api
r1318 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
mapper->setSeries(this);
}
}
}
Tero Ahola
Added value and category axis to QML api
r1550
Titta Heikkala
Qt Charts project file structure change...
r2712 QQmlListProperty<QObject> DeclarativeStackedBarSeries::seriesChildren()
Tero Ahola
Added stacked and percent bar series to QML api
r1318 {
Titta Heikkala
Qt Charts project file structure change...
r2712 return QQmlListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren ,0,0,0);
Tero Ahola
Added stacked and percent bar series to QML api
r1318 }
Titta Heikkala
Qt Charts project file structure change...
r2712 void DeclarativeStackedBarSeries::appendSeriesChildren(QQmlListProperty<QObject> * list, QObject *element)
Tero Ahola
Added stacked and percent bar series to QML api
r1318 {
// Empty implementation; the children are parsed in componentComplete instead
Q_UNUSED(list);
Q_UNUSED(element);
}
DeclarativeBarSet *DeclarativeStackedBarSeries::at(int index)
{
Jani Honkonen
coding style fixes for plugins
r2101 QList<QBarSet *> setList = barSets();
Tero Ahola
Implemented BarSeries::append, insert, remove and clear to QML API
r1511 if (index >= 0 && index < setList.count())
Tero Ahola
Added stacked and percent bar series to QML api
r1318 return qobject_cast<DeclarativeBarSet *>(setList[index]);
return 0;
}
Tero Ahola
Implemented BarSeries::append, insert, remove and clear to QML API
r1511 DeclarativeBarSet *DeclarativeStackedBarSeries::insert(int index, QString label, QVariantList values)
{
DeclarativeBarSet *barset = new DeclarativeBarSet(this);
barset->setLabel(label);
barset->setValues(values);
if (QStackedBarSeries::insert(index, barset))
return barset;
delete barset;
return 0;
}
sauimone
declarative series for horizontal barcharts
r1806 // Declarative percent bar series ==============================================================================
Titta Heikkala
Qt Charts project file structure change...
r2712 DeclarativePercentBarSeries::DeclarativePercentBarSeries(QQuickItem *parent) :
Tero Ahola
Refactored QML axis handling
r1813 QPercentBarSeries(parent),
Tero Ahola
Added axisXTop and axisYRight properties to QML series APIs
r2296 m_axes(0)
Tero Ahola
Added stacked and percent bar series to QML api
r1318 {
Tero Ahola
Added axisXTop and axisYRight properties to QML series APIs
r2296 m_axes = new DeclarativeAxes(this);
connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
Tero Ahola
Added stacked and percent bar series to QML api
r1318 }
void DeclarativePercentBarSeries::classBegin()
{
}
void DeclarativePercentBarSeries::componentComplete()
{
Jani Honkonen
coding style: foreach whitespace fix
r2100 foreach (QObject *child, children()) {
Tero Ahola
Added stacked and percent bar series to QML api
r1318 if (qobject_cast<DeclarativeBarSet *>(child)) {
sauimone
QBarSeries to QAbstractBarSeries
r1584 QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
Jani Honkonen
coding style fixes for plugins
r2101 } else if (qobject_cast<QVBarModelMapper *>(child)) {
Tero Ahola
Added stacked and percent bar series to QML api
r1318 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
mapper->setSeries(this);
Jani Honkonen
coding style fixes for plugins
r2101 } else if (qobject_cast<QHBarModelMapper *>(child)) {
Tero Ahola
Added stacked and percent bar series to QML api
r1318 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
mapper->setSeries(this);
}
}
}
Titta Heikkala
Qt Charts project file structure change...
r2712 QQmlListProperty<QObject> DeclarativePercentBarSeries::seriesChildren()
Tero Ahola
Added stacked and percent bar series to QML api
r1318 {
Titta Heikkala
Qt Charts project file structure change...
r2712 return QQmlListProperty<QObject>(this, 0, &DeclarativeBarSeries::appendSeriesChildren ,0,0,0);
Tero Ahola
Added stacked and percent bar series to QML api
r1318 }
Titta Heikkala
Qt Charts project file structure change...
r2712 void DeclarativePercentBarSeries::appendSeriesChildren(QQmlListProperty<QObject> * list, QObject *element)
Tero Ahola
Added stacked and percent bar series to QML api
r1318 {
// Empty implementation; the children are parsed in componentComplete instead
Q_UNUSED(list);
Q_UNUSED(element);
}
DeclarativeBarSet *DeclarativePercentBarSeries::at(int index)
{
Jani Honkonen
coding style fixes for plugins
r2101 QList<QBarSet *> setList = barSets();
Tero Ahola
Implemented BarSeries::append, insert, remove and clear to QML API
r1511 if (index >= 0 && index < setList.count())
Tero Ahola
Added stacked and percent bar series to QML api
r1318 return qobject_cast<DeclarativeBarSet *>(setList[index]);
return 0;
}
Tero Ahola
Implemented BarSeries::append, insert, remove and clear to QML API
r1511 DeclarativeBarSet *DeclarativePercentBarSeries::insert(int index, QString label, QVariantList values)
{
DeclarativeBarSet *barset = new DeclarativeBarSet(this);
barset->setLabel(label);
barset->setValues(values);
if (QPercentBarSeries::insert(index, barset))
return barset;
delete barset;
return 0;
}
sauimone
declarative series for horizontal barcharts
r1806 // Declarative horizontal bar series ===========================================================================
Titta Heikkala
Qt Charts project file structure change...
r2712 DeclarativeHorizontalBarSeries::DeclarativeHorizontalBarSeries(QQuickItem *parent) :
Tero Ahola
Refactored QML axis handling
r1813 QHorizontalBarSeries(parent),
Tero Ahola
Added axisXTop and axisYRight properties to QML series APIs
r2296 m_axes(0)
sauimone
declarative series for horizontal barcharts
r1806 {
Tero Ahola
Added axisXTop and axisYRight properties to QML series APIs
r2296 m_axes = new DeclarativeAxes(this);
connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
sauimone
declarative series for horizontal barcharts
r1806 }
void DeclarativeHorizontalBarSeries::classBegin()
{
}
void DeclarativeHorizontalBarSeries::componentComplete()
{
Jani Honkonen
coding style: foreach whitespace fix
r2100 foreach (QObject *child, children()) {
sauimone
declarative series for horizontal barcharts
r1806 if (qobject_cast<DeclarativeBarSet *>(child)) {
QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
Jani Honkonen
coding style fixes for plugins
r2101 } else if (qobject_cast<QVBarModelMapper *>(child)) {
sauimone
declarative series for horizontal barcharts
r1806 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
mapper->setSeries(this);
Jani Honkonen
coding style fixes for plugins
r2101 } else if (qobject_cast<QHBarModelMapper *>(child)) {
sauimone
declarative series for horizontal barcharts
r1806 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
mapper->setSeries(this);
}
}
}
Titta Heikkala
Qt Charts project file structure change...
r2712 QQmlListProperty<QObject> DeclarativeHorizontalBarSeries::seriesChildren()
sauimone
declarative series for horizontal barcharts
r1806 {
Titta Heikkala
Qt Charts project file structure change...
r2712 return QQmlListProperty<QObject>(this, 0, &DeclarativeHorizontalBarSeries::appendSeriesChildren ,0,0,0);
sauimone
declarative series for horizontal barcharts
r1806 }
Titta Heikkala
Qt Charts project file structure change...
r2712 void DeclarativeHorizontalBarSeries::appendSeriesChildren(QQmlListProperty<QObject> * list, QObject *element)
sauimone
declarative series for horizontal barcharts
r1806 {
// Empty implementation; the children are parsed in componentComplete instead
Q_UNUSED(list);
Q_UNUSED(element);
}
DeclarativeBarSet *DeclarativeHorizontalBarSeries::at(int index)
{
Jani Honkonen
coding style fixes for plugins
r2101 QList<QBarSet *> setList = barSets();
sauimone
declarative series for horizontal barcharts
r1806 if (index >= 0 && index < setList.count())
return qobject_cast<DeclarativeBarSet *>(setList[index]);
return 0;
}
DeclarativeBarSet *DeclarativeHorizontalBarSeries::insert(int index, QString label, QVariantList values)
{
DeclarativeBarSet *barset = new DeclarativeBarSet(this);
barset->setLabel(label);
barset->setValues(values);
if (QHorizontalBarSeries::insert(index, barset))
return barset;
delete barset;
return 0;
}
// Declarative horizontal stacked bar series ===================================================================
Titta Heikkala
Qt Charts project file structure change...
r2712 DeclarativeHorizontalStackedBarSeries::DeclarativeHorizontalStackedBarSeries(QQuickItem *parent) :
Tero Ahola
Refactored QML axis handling
r1813 QHorizontalStackedBarSeries(parent),
Tero Ahola
Added axisXTop and axisYRight properties to QML series APIs
r2296 m_axes(0)
sauimone
declarative series for horizontal barcharts
r1806 {
Tero Ahola
Added axisXTop and axisYRight properties to QML series APIs
r2296 m_axes = new DeclarativeAxes(this);
connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
sauimone
declarative series for horizontal barcharts
r1806 }
void DeclarativeHorizontalStackedBarSeries::classBegin()
{
}
void DeclarativeHorizontalStackedBarSeries::componentComplete()
{
Jani Honkonen
coding style: foreach whitespace fix
r2100 foreach (QObject *child, children()) {
sauimone
declarative series for horizontal barcharts
r1806 if (qobject_cast<DeclarativeBarSet *>(child)) {
QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
Jani Honkonen
coding style fixes for plugins
r2101 } else if (qobject_cast<QVBarModelMapper *>(child)) {
sauimone
declarative series for horizontal barcharts
r1806 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
mapper->setSeries(this);
Jani Honkonen
coding style fixes for plugins
r2101 } else if (qobject_cast<QHBarModelMapper *>(child)) {
sauimone
declarative series for horizontal barcharts
r1806 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
mapper->setSeries(this);
}
}
}
Titta Heikkala
Qt Charts project file structure change...
r2712 QQmlListProperty<QObject> DeclarativeHorizontalStackedBarSeries::seriesChildren()
sauimone
declarative series for horizontal barcharts
r1806 {
Titta Heikkala
Qt Charts project file structure change...
r2712 return QQmlListProperty<QObject>(this, 0, &DeclarativeHorizontalStackedBarSeries::appendSeriesChildren ,0,0,0);
sauimone
declarative series for horizontal barcharts
r1806 }
Titta Heikkala
Qt Charts project file structure change...
r2712 void DeclarativeHorizontalStackedBarSeries::appendSeriesChildren(QQmlListProperty<QObject> * list, QObject *element)
sauimone
declarative series for horizontal barcharts
r1806 {
// Empty implementation; the children are parsed in componentComplete instead
Q_UNUSED(list);
Q_UNUSED(element);
}
DeclarativeBarSet *DeclarativeHorizontalStackedBarSeries::at(int index)
{
Jani Honkonen
coding style fixes for plugins
r2101 QList<QBarSet *> setList = barSets();
sauimone
declarative series for horizontal barcharts
r1806 if (index >= 0 && index < setList.count())
return qobject_cast<DeclarativeBarSet *>(setList[index]);
return 0;
}
DeclarativeBarSet *DeclarativeHorizontalStackedBarSeries::insert(int index, QString label, QVariantList values)
{
DeclarativeBarSet *barset = new DeclarativeBarSet(this);
barset->setLabel(label);
barset->setValues(values);
if (QHorizontalStackedBarSeries::insert(index, barset))
return barset;
delete barset;
return 0;
}
// Declarative horizontal percent bar series ===================================================================
Titta Heikkala
Qt Charts project file structure change...
r2712 DeclarativeHorizontalPercentBarSeries::DeclarativeHorizontalPercentBarSeries(QQuickItem *parent) :
Tero Ahola
Refactored QML axis handling
r1813 QHorizontalPercentBarSeries(parent),
Tero Ahola
Added axisXTop and axisYRight properties to QML series APIs
r2296 m_axes(0)
sauimone
declarative series for horizontal barcharts
r1806 {
Tero Ahola
Added axisXTop and axisYRight properties to QML series APIs
r2296 m_axes = new DeclarativeAxes(this);
connect(m_axes, SIGNAL(axisXChanged(QAbstractAxis*)), this, SIGNAL(axisXChanged(QAbstractAxis*)));
connect(m_axes, SIGNAL(axisYChanged(QAbstractAxis*)), this, SIGNAL(axisYChanged(QAbstractAxis*)));
connect(m_axes, SIGNAL(axisXTopChanged(QAbstractAxis*)), this, SIGNAL(axisXTopChanged(QAbstractAxis*)));
connect(m_axes, SIGNAL(axisYRightChanged(QAbstractAxis*)), this, SIGNAL(axisYRightChanged(QAbstractAxis*)));
sauimone
declarative series for horizontal barcharts
r1806 }
void DeclarativeHorizontalPercentBarSeries::classBegin()
{
}
void DeclarativeHorizontalPercentBarSeries::componentComplete()
{
Jani Honkonen
coding style: foreach whitespace fix
r2100 foreach (QObject *child, children()) {
sauimone
declarative series for horizontal barcharts
r1806 if (qobject_cast<DeclarativeBarSet *>(child)) {
QAbstractBarSeries::append(qobject_cast<DeclarativeBarSet *>(child));
Jani Honkonen
coding style fixes for plugins
r2101 } else if (qobject_cast<QVBarModelMapper *>(child)) {
sauimone
declarative series for horizontal barcharts
r1806 QVBarModelMapper *mapper = qobject_cast<QVBarModelMapper *>(child);
mapper->setSeries(this);
Jani Honkonen
coding style fixes for plugins
r2101 } else if (qobject_cast<QHBarModelMapper *>(child)) {
sauimone
declarative series for horizontal barcharts
r1806 QHBarModelMapper *mapper = qobject_cast<QHBarModelMapper *>(child);
mapper->setSeries(this);
}
}
}
Titta Heikkala
Qt Charts project file structure change...
r2712 QQmlListProperty<QObject> DeclarativeHorizontalPercentBarSeries::seriesChildren()
sauimone
declarative series for horizontal barcharts
r1806 {
Titta Heikkala
Qt Charts project file structure change...
r2712 return QQmlListProperty<QObject>(this, 0, &DeclarativeHorizontalPercentBarSeries::appendSeriesChildren ,0,0,0);
sauimone
declarative series for horizontal barcharts
r1806 }
Titta Heikkala
Qt Charts project file structure change...
r2712 void DeclarativeHorizontalPercentBarSeries::appendSeriesChildren(QQmlListProperty<QObject> * list, QObject *element)
sauimone
declarative series for horizontal barcharts
r1806 {
// Empty implementation; the children are parsed in componentComplete instead
Q_UNUSED(list);
Q_UNUSED(element);
}
DeclarativeBarSet *DeclarativeHorizontalPercentBarSeries::at(int index)
{
Jani Honkonen
coding style fixes for plugins
r2101 QList<QBarSet *> setList = barSets();
sauimone
declarative series for horizontal barcharts
r1806 if (index >= 0 && index < setList.count())
return qobject_cast<DeclarativeBarSet *>(setList[index]);
return 0;
}
DeclarativeBarSet *DeclarativeHorizontalPercentBarSeries::insert(int index, QString label, QVariantList values)
{
DeclarativeBarSet *barset = new DeclarativeBarSet(this);
barset->setLabel(label);
barset->setValues(values);
if (QHorizontalPercentBarSeries::insert(index, barset))
return barset;
delete barset;
return 0;
}
sauimone
fixed moc name in declarative barseries
r1592 #include "moc_declarativebarseries.cpp"
Tero Ahola
Added QML api for bar series
r646
Titta Heikkala
Qt Charts project file structure change...
r2712 QT_CHARTS_END_NAMESPACE