QColor myColor(255, 0, 0); // creates a red QColor object myColor.setAlpha(128); // sets the alpha to 50%
QColor myColor(0, 255, 0); // creates a green QColor object int userAlpha = getUserInput(); // gets the user's alpha value input myColor.setAlpha(userAlpha); // sets the QColor object's alpha to the user's inputPackage library: Qt Framework