QColor color(255, 0, 0); // red color.setHueF(0.5); // set the hue to green
QColor startColor(Qt::red); QColor endColor; double hue = getUserHue(); // assume this function returns a double endColor.setHueF(hue); QLinearGradient gradient(0, 0, 100, 100); gradient.setColorAt(0, startColor); gradient.setColorAt(1, endColor);Package/library: Qt Core and GUI libraries.