QPen setWidthF() is a method available in Qt GUI library used to set the width of the pen used for drawing lines and outlines of shapes. It takes a float value as its argument which represents the width of the pen in pixels.
Code Examples:
1. Basic Usage:
QPen pen(Qt::black); pen.setWidthF(2.5);
In the above code, a QPen object is created with a black color and then setWidthF() method is called on it with a width of 2.5 pixels.
In the above code, a custom pen style is created with a dashed line style and a width of 1.5 pixels.
Package Library:
The QPen setWidthF() method is available in the Qt GUI library which is a part of the Qt framework.
C++ (Cpp) QPen::setWidthF - 30 examples found. These are the top rated real world C++ (Cpp) examples of QPen::setWidthF extracted from open source projects. You can rate examples to help us improve the quality of examples.