QColor color = QColor::fromRgbF(0.5, 0.0, 0.5, 1.0); // set color values for purple
QColor color = QColor("#FF00FF"); // set color to purple qDebug() << color.redF(); // prints the red value (1.0) qDebug() << color.greenF(); // prints the green value (0.0) qDebug() << color.blueF(); // prints the blue value (1.0) qDebug() << color.alphaF(); // prints the alpha value (1.0)In this example, the valueF function is used to get the color values of the QColor object that represents the color purple. By calling the redF(), greenF(), blueF(), and alphaF() functions on the QColor object, we can retrieve the respective color values. Package Library: Qt Library