I have QCPItemText boxes on my plot. I want to have a QLinearGradient brush. Each text box should have the same dark to light gardient. I have not found a way to get consistent appearance. I have played with the coordinates and modes but I just don't undestand.
// Set the background color for both regular and selected. QColor color = m_format.GetColor(); QColor dark = color.darker(); QColor light = color.lighter(); setBrush(color); auto tl = topLeft->pixelPosition(); auto br = bottomRight->pixelPosition(); QLinearGradient gradient(tl.x(), tl.y(), br.x(), br.y()); // gradient.setCoordinateMode(QGradient::ObjectBoundingMode); gradient.setColorAt(0, dark); gradient.setColorAt(1, light); setSelectedBrush(QBrush(gradient));