#includeIn the above example, we create a graphics scene and view, and then create a QPen with a color of black and the cosmetic attribute set to true. We then add a line to the scene using this pen. When the line is drawn, it will have a width of 0, and its width will be determined by other means. Package library: This code example uses the Qt GUI library.int main(int argc, char** argv) { QApplication app(argc, argv); QGraphicsScene scene; QGraphicsView view(&scene); // Create a cosmetic pen QPen pen(Qt::black); pen.setCosmetic(true); // Add a line to the scene QGraphicsLineItem* line = scene.addLine(0, 0, 100, 100, pen); view.show(); return app.exec(); }