QColor color = QColor(255, 0, 0); color.setBlue(255);In this example, a new QColor object is created with the color red (255, 0, 0) and then the setBlue method is used to change the blue component of the color to 255, resulting in the color magenta (255, 0, 255). Package library: Qt Core module of the Qt library.