MCPcopy Create free account
hub / github.com/KDE/labplot / recalcShapeAndBoundingRect

Method recalcShapeAndBoundingRect

src/backend/worksheet/plots/cartesian/BarPlot.cpp:1241–1274  ·  view source on GitHub ↗

! recalculates the outer bounds and the shape of the item. */

Source from the content-addressed store, hash-verified

1239 recalculates the outer bounds and the shape of the item.
1240*/
1241void BarPlotPrivate::recalcShapeAndBoundingRect() {
1242 if (suppressRecalc)
1243 return;
1244
1245 prepareGeometryChange();
1246 m_shape = QPainterPath();
1247
1248 int index = 0;
1249 for (const auto& columnBarLines : m_barLines) { // loop over the different data columns
1250 for (const auto& barLines : columnBarLines) { // loop over the bars for every data column
1251 QPainterPath barPath;
1252 for (const auto& line : barLines) { // loop over the four lines for every bar
1253 barPath.moveTo(line.p1());
1254 barPath.lineTo(line.p2());
1255 }
1256
1257 if (index < borderLines.count()) { // TODO
1258 const auto& borderPen = borderLines.at(index)->pen();
1259 m_shape.addPath(WorksheetElement::shapeFromPath(barPath, borderPen));
1260 }
1261 }
1262
1263 if (index < errorBars.size() && errorBars.at(index) && errorBars.at(index)->yErrorType() != ErrorBar::ErrorType::NoError)
1264 m_shape.addPath(WorksheetElement::shapeFromPath(m_errorBarsPaths.at(index), errorBars.at(index)->line()->pen()));
1265
1266 ++index;
1267 }
1268
1269 if (value->type() != Value::NoValues)
1270 m_shape.addPath(m_valuesPath);
1271
1272 m_boundingRectangle = m_shape.boundingRect();
1273 updatePixmap();
1274}
1275
1276void BarPlotPrivate::updatePixmap() {
1277 PERFTRACE(name() + QLatin1String(Q_FUNC_INFO));

Callers 1

loadThemeConfigMethod · 0.45

Calls 5

countMethod · 0.45
sizeMethod · 0.45
lineMethod · 0.45
typeMethod · 0.45
boundingRectMethod · 0.45

Tested by

no test coverage detected