Logo Search packages:      
Sourcecode: qt4-x11 version File versions

void QGradient::setColorAt ( qreal  position,
const QColor color 
) [inherited]

Creates a stop point at the given position with the given color. The given position must be in the range 0 to 1.

See also:
setStops(), stops()

Definition at line 1273 of file qbrush.cpp.

References QVector< T >::at(), QVector< T >::insert(), QGradient::QGradientStop(), and QVector< T >::size().

Referenced by Window::brushChanged(), MyClass::createImage(), QCleanlooksStyle::drawComplexControl(), QPlastiqueStyle::drawComplexControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QPlastiqueStyle::drawPrimitive(), Helper::Helper(), Node::paint(), RenderArea::paintEvent(), and QGradient::setStops().

    if (pos > 1 || pos < 0) {
        qWarning("QGradient::setColorAt: Color position must be specified in the range 0 to 1");

    int index = 0;
    while (index < m_stops.size() && m_stops.at(index).first < pos) ++index;

    if (index < m_stops.size() && m_stops.at(index).first == pos)
        m_stops[index].second = color;
        m_stops.insert(index, QGradientStop(pos, color));

Generated by  Doxygen 1.6.0   Back to index