##// END OF EJS Templates
demos: coding style police make a surprise strike
demos: coding style police make a surprise strike

File last commit:

r2104:f8a933676fbd
r2130:e2c3f0e5fca7
Show More
barchartitem.cpp
94 lines | 3.2 KiB | text/x-c | CppLexer
Jani Honkonen
Add license headers
r794 /****************************************************************************
**
** Copyright (C) 2012 Digia Plc
** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
** This file is part of the Qt Commercial Charts Add-on.
**
** $QT_BEGIN_LICENSE$
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** 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$
**
****************************************************************************/
sauimone
combined barpresenterbase and barpresenter. renamed barchartpresenters to barchartitems
r666 #include "barchartitem_p.h"
sauimone
refactored barcharts. layout to derived classess other funtionality to base class
r126 #include "bar_p.h"
sauimone
renamed barseries files to abstractbarseries
r1586 #include "qabstractbarseries_p.h"
sauimone
refactoring internal barchart items
r1674 #include "qbarset.h"
#include "qbarset_p.h"
sauimone
refactored barcharts. layout to derived classess other funtionality to base class
r126
QTCOMMERCIALCHART_BEGIN_NAMESPACE
sauimone
QBarSeries to QAbstractBarSeries
r1584 BarChartItem::BarChartItem(QAbstractBarSeries *series, ChartPresenter *presenter) :
sauimone
refactoring internal barchart items
r1674 AbstractBarChartItem(series, presenter)
sauimone
refactored barcharts. layout to derived classess other funtionality to base class
r126 {
}
sauimone
bug fix in bar charts. Crashed, if layout was set before data. Also integrated to test app.
r165
sauimone
barchart animation mechanics working. still some todo
r681 QVector<QRectF> BarChartItem::calculateLayout()
sauimone
Animation framework for barchart.
r671 {
sauimone
barchart animation mechanics working. still some todo
r681 QVector<QRectF> layout;
sauimone
removed categories from barseries. categories are now only on axis
r1321 // Use temporary qreals for accuracy
qreal categoryCount = m_series->d_func()->categoryCount();
Tero Ahola
Minor modifications to properties of abstract, area and bar series
r1462 qreal setCount = m_series->count();
sauimone
visible property to barseries
r1284 bool barsVisible = m_series->isVisible();
sauimone
barchart animation mechanics working. still some todo
r681
sauimone
percent barchart layout fix. signal fix
r850 // Domain:
sauimone
build error fix after merge
r682 qreal width = geometry().width();
qreal height = geometry().height();
sauimone
new series: groupedbarseries
r1167 qreal rangeY = m_domainMaxY - m_domainMinY;
qreal rangeX = m_domainMaxX - m_domainMinX;
qreal scaleY = (height / rangeY);
qreal scaleX = (width / rangeX);
sauimone
bar test update. Tests now calculate expected layout from charts plot area and use that instead of precalculated QPointF magic numbers
r2073 qreal rectWidth = (scaleX / setCount) * m_series->d_func()->barWidth();
sauimone
barchart animation mechanics working. still some todo
r681
int itemIndex(0);
Tero Ahola
Code review: Fixed simple issues in Bar and Legend
r737 for (int category = 0; category < categoryCount; category++) {
sauimone
bar test update. Tests now calculate expected layout from charts plot area and use that instead of precalculated QPointF magic numbers
r2073 qreal yPos = height + scaleY * m_domainMinY + geometry().top();
sauimone
barchart animation mechanics working. still some todo
r681 for (int set = 0; set < setCount; set++) {
Jani Honkonen
more coding style fixes for src-folder...
r2104 QBarSetPrivate *barSet = m_series->d_func()->barsetAt(set)->d_ptr.data();
sauimone
Barchart value layout fix
r817
sauimone
bar test update. Tests now calculate expected layout from charts plot area and use that instead of precalculated QPointF magic numbers
r2073 qreal xPos = (barSet->pos(category) - m_domainMinX) * scaleX + geometry().left();
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 xPos -= setCount * rectWidth / 2;
xPos += set * rectWidth;
sauimone
population pyramid example. Added grouping option to barseries to give some control over layout
r1794
sauimone
bar test update. Tests now calculate expected layout from charts plot area and use that instead of precalculated QPointF magic numbers
r2073 qreal rectHeight = barSet->value(category) * scaleY;
Jani Honkonen
more coding style fixes for src-folder...
r2104 Bar *bar = m_bars.at(itemIndex);
sauimone
new series: groupedbarseries
r1167
sauimone
bar test update. Tests now calculate expected layout from charts plot area and use that instead of precalculated QPointF magic numbers
r2073 QRectF rect(xPos, yPos - rectHeight, rectWidth, rectHeight);
sauimone
barchart animation mechanics working. still some todo
r681 layout.append(rect);
sauimone
Removed QPointF from QBarSet
r1580 bar->setPen(barSet->m_pen);
bar->setBrush(barSet->m_brush);
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (qFuzzyIsNull(rectHeight))
sauimone
fixed crash in barchartitem after refactoring
r1603 bar->setVisible(false);
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 else
sauimone
fixed crash in barchartitem after refactoring
r1603 bar->setVisible(barsVisible);
sauimone
barchart animation mechanics working. still some todo
r681
Jani Honkonen
more coding style fixes for src-folder...
r2104 QGraphicsSimpleTextItem *label = m_labels.at(itemIndex);
sauimone
barchart animation mechanics working. still some todo
r681
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 if (!qFuzzyIsNull(barSet->value(category)))
sauimone
horizontal barchart & example
r1681 label->setText(QString::number(barSet->value(category)));
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 else
sauimone
renamed barchart floating values with labels to be consistent with piechart
r820 label->setText(QString(""));
sauimone
barchart animation mechanics working. still some todo
r681
Jani Honkonen
astyle and manual coding style fixes for src-folder
r2097 label->setPos(xPos + (rect.width() / 2 - label->boundingRect().width() / 2),
yPos - rectHeight / 2 - label->boundingRect().height() / 2);
sauimone
Removed QPointF from QBarSet
r1580 label->setFont(barSet->m_labelFont);
label->setBrush(barSet->m_labelBrush);
sauimone
simple text item for barvalue
r811
sauimone
barchart animation mechanics working. still some todo
r681 itemIndex++;
}
}
sauimone
Animation framework for barchart.
r671 return layout;
}
sauimone
combined barpresenterbase and barpresenter. renamed barchartpresenters to barchartitems
r666 #include "moc_barchartitem_p.cpp"
Michal Klocek
Refactored for MVP...
r139
sauimone
refactored barcharts. layout to derived classess other funtionality to base class
r126 QTCOMMERCIALCHART_END_NAMESPACE