現在我只是想創建一個圓圈漸變填充:創建QGradient
//I want the center to be at 10, 10 in the circle and the radius to be 50 pixels
QRadialGradient radial(QPointF(10, 10), 50);
radial.setColorAt(0, Qt::black); //I want the center to be black
radial.setColorAt(1, Qt::white); //I want the sides to be white
painter.setBrush(QBrush(radial));
painter.drawEllipse(/*stuff*/);
然而,這一切所完成的是給我一個完全白色的圓圈。我該如何糾正這一點?
之間的數啊是,我認爲這個梯度會被設置爲re lative到每個橢圓而不是相對於小部件。謝謝! – wrongusername 2010-12-05 02:02:53