This is what I tried, it did not give me a result. Where am I mistaken?
// Start point of bottom line qreal startPointX1 = 600.0; qreal startPointY1 = 600.0; // End point of bottom line qreal endPointX1 = 600.0; qreal endPointY1 = 1200.0; // Start point of top line qreal startPointX2 = 600.0; qreal startPointY2 = 600.0; // End point of top line qreal endPointX2 = 800.0; qreal endPointY2 = 1200.0; QPainterPath path; // Set pen to this point. path.moveTo (startPointX1, startPointY1); // Draw line from pen point to this point. path.lineTo (endPointX1, endPointY1); path.moveTo (endPointX1, endPointY1); path.lineTo (endPointX2, endPointY2); path.moveTo (endPointX2, endPointY2); path.lineTo (startPointX1, startPointY1); painter.setPen (Qt :: NoPen); painter.fillPath (path, QBrush (QColor ("blue")));
I just tried to create a path between these three points and fill the area, but the result is not displayed.
source share