/// Add Done Shape
lstPointsPower.clear();
lstPointsPower.append(btnLeft);
lstPointsPower.append(topLeft);
lstPointsPower.append(topRight);
lstPointsPower.append(btnRight);
addShapeFromPoints("SHAPE_DONE", Qt::gray, lstPointsPower, 1, false);
/// Add Todo Shape
lstPointsPower.clear();
lstPointsPower.append(btnLeft);
lstPointsPower.append(topLeft);
lstPointsPower.append(topRight);
lstPointsPower.append(btnRight);
addShapeFromPoints("SHAPE_TODO", Qt::black, lstPointsPower, 1, false);
void WorkoutPlot
::addShapeFromPoints(const QString &title,
const QColor &color, QList<QPointF> lstPoints,
int positionZ,
bool antiliasing
) {
QwtPlotShapeItem *item;
if (title == "SHAPE_TODO") {
shapeWorkoutToDo = new QwtPlotShapeItem(title);
item = shapeWorkoutToDo;
}
else if (title == "SHAPE_DONE") {
shapeWorkoutDone = new QwtPlotShapeItem(title);
item = shapeWorkoutDone;
}
else {
item = new QwtPlotShapeItem(title);
}
item
->setRenderHint
(QwtPlotItem::RenderAntialiased, antiliasing
);
item->setShape( ShapeFactory::path(lstPoints));
fillColor.setAlpha(200);
pen.setJoinStyle(Qt::MiterJoin);
item->setPen(pen);
item->setBrush(fillColor);
item->setZ(positionZ);
item->attach(this);
if (title == "PARALLELOGRAM_POWER")
{
lstTargetPower.append(item);
}
else if (title == "PARALLELOGRAM_CADENCE")
{
lstTargetCadence.append(item);
}
}
/// Add Done Shape
lstPointsPower.clear();
btnLeft = QPointF(0, 0 );
topLeft = QPointF(0, 700 );
btnRight = QPointF(60, 0 );
topRight = QPointF(60, 700 );
lstPointsPower.append(btnLeft);
lstPointsPower.append(topLeft);
lstPointsPower.append(topRight);
lstPointsPower.append(btnRight);
addShapeFromPoints("SHAPE_DONE", Qt::gray, lstPointsPower, 1, false);
/// Add Todo Shape
lstPointsPower.clear();
btnLeft = QPointF(60, 0 );
topLeft = QPointF(60, 700 );
btnRight = QPointF(time, 0 );
topRight = QPointF(time, 700 );
lstPointsPower.append(btnLeft);
lstPointsPower.append(topLeft);
lstPointsPower.append(topRight);
lstPointsPower.append(btnRight);
addShapeFromPoints("SHAPE_TODO", Qt::black, lstPointsPower, 1, false);
void WorkoutPlot::addShapeFromPoints(const QString &title, const QColor &color, QList<QPointF> lstPoints, int positionZ, bool antiliasing) {
QwtPlotShapeItem *item;
if (title == "SHAPE_TODO") {
shapeWorkoutToDo = new QwtPlotShapeItem(title);
item = shapeWorkoutToDo;
}
else if (title == "SHAPE_DONE") {
shapeWorkoutDone = new QwtPlotShapeItem(title);
item = shapeWorkoutDone;
}
else {
item = new QwtPlotShapeItem(title);
}
item->setRenderHint(QwtPlotItem::RenderAntialiased, antiliasing);
item->setShape( ShapeFactory::path(lstPoints));
QColor fillColor = color;
fillColor.setAlpha(200);
QPen pen(color, 1);
pen.setJoinStyle(Qt::MiterJoin);
item->setPen(pen);
item->setBrush(fillColor);
item->setZ(positionZ);
item->attach(this);
if (title == "PARALLELOGRAM_POWER")
{
lstTargetPower.append(item);
}
else if (title == "PARALLELOGRAM_CADENCE")
{
lstTargetCadence.append(item);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks