| 1296 | } |
| 1297 | |
| 1298 | void BarPlotPrivate::draw(QPainter* painter) { |
| 1299 | PERFTRACE(name() + QLatin1String(Q_FUNC_INFO)); |
| 1300 | |
| 1301 | int columnIndex = 0; |
| 1302 | for (const auto& columnBarLines : m_barLines) { // loop over the different data columns |
| 1303 | int valueIndex = 0; |
| 1304 | for (const auto& barLines : columnBarLines) { // loop over the bars for every data column |
| 1305 | // draw the box filling |
| 1306 | if (columnIndex < backgrounds.size()) { // TODO: remove this check later |
| 1307 | const auto* background = backgrounds.at(columnIndex); |
| 1308 | if (background->enabled()) |
| 1309 | background->draw(painter, m_fillPolygons.at(columnIndex).at(valueIndex)); |
| 1310 | } |
| 1311 | |
| 1312 | // draw the border |
| 1313 | if (columnIndex < borderLines.size()) { // TODO: remove this check later |
| 1314 | const auto& borderPen = borderLines.at(columnIndex)->pen(); |
| 1315 | const double borderOpacity = borderLines.at(columnIndex)->opacity(); |
| 1316 | if (borderPen.style() != Qt::NoPen) { |
| 1317 | painter->setPen(borderPen); |
| 1318 | painter->setBrush(Qt::NoBrush); |
| 1319 | painter->setOpacity(borderOpacity); |
| 1320 | for (const auto& line : barLines) // loop over the four lines for every bar |
| 1321 | painter->drawLine(line); |
| 1322 | } |
| 1323 | } |
| 1324 | |
| 1325 | ++valueIndex; |
| 1326 | } |
| 1327 | |
| 1328 | // draw error bars |
| 1329 | auto* errorBar = errorBars.at(columnIndex); |
| 1330 | if (errorBar && errorBar->yErrorType() != ErrorBar::ErrorType::NoError) |
| 1331 | errorBar->draw(painter, m_errorBarsPaths.at(columnIndex)); |
| 1332 | |
| 1333 | ++columnIndex; |
| 1334 | } |
| 1335 | |
| 1336 | // draw values |
| 1337 | value->draw(painter, m_valuesPoints, m_valuesStrings); |
| 1338 | } |
| 1339 | |
| 1340 | void BarPlotPrivate::paint(QPainter* painter, const QStyleOptionGraphicsItem* /*option*/, QWidget*) { |
| 1341 | if (!isVisible()) |
nothing calls this directly
no test coverage detected