QColor red(255, 0, 0); // create a red color with RGB values
QPushButton* button = new QPushButton("Click me!"); button->setStyleSheet("background-color: rgb(0, 128, 0)"); // set the background color to dark greenThis code creates a QPushButton object named button and sets its background color to dark green with RGB values of 0, 128, and 0. QColor is part of the QtGui package in Qt library.