#includeQPen pen(Qt::black); pen.setDashPattern(Qt::SolidLine);
#includeIn the first example, we use the Qt namespace to set the pen to a solid line using the Qt library. In the second example, we create a new pen and set the dash pattern manually by passing an initializer list with the length of the dashes and spaces we want. The QPen class is part of the Qt Core module, which is included in the Qt library.QPen pen(Qt::black); pen.setDashPattern({1, 3});