![]() |
Qt 6.x
The Qt SDK
|
\inmodule QtGui More...
#include <qbrush.h>
Public Member Functions | |
QLinearGradient () | |
Constructs a default linear gradient with interpolation area between (0, 0) and (1, 1). | |
QLinearGradient (const QPointF &start, const QPointF &finalStop) | |
Constructs a linear gradient with interpolation area between the given start point and finalStop. | |
QLinearGradient (qreal xStart, qreal yStart, qreal xFinalStop, qreal yFinalStop) | |
Constructs a linear gradient with interpolation area between (x1, y1) and (x2, y2). | |
~QLinearGradient () | |
QPointF | start () const |
Returns the start point of this linear gradient in logical coordinates. | |
void | setStart (const QPointF &start) |
void | setStart (qreal x, qreal y) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QPointF | finalStop () const |
Returns the final stop point of this linear gradient in logical coordinates. | |
void | setFinalStop (const QPointF &stop) |
void | setFinalStop (qreal x, qreal y) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
![]() | |
QGradient () | |
QGradient (Preset) | |
~QGradient () | |
Type | type () const |
Returns the type of gradient. | |
void | setSpread (Spread spread) |
Specifies the spread method that should be used for this gradient. | |
Spread | spread () const |
Returns the spread method use by this gradient. | |
void | setColorAt (qreal pos, const QColor &color) |
Creates a stop point at the given position with the given color. | |
void | setStops (const QGradientStops &stops) |
Replaces the current set of stop points with the given stopPoints. | |
QGradientStops | stops () const |
Returns the stop points for this gradient. | |
CoordinateMode | coordinateMode () const |
void | setCoordinateMode (CoordinateMode mode) |
InterpolationMode | interpolationMode () const |
void | setInterpolationMode (InterpolationMode mode) |
bool | operator== (const QGradient &gradient) const |
Returns true if the gradient is the same as the other gradient specified; otherwise returns false . | |
bool | operator!= (const QGradient &other) const |
\inmodule QtGui
The QLinearGradient class is used in combination with QBrush to specify a linear gradient brush.
Linear gradients interpolate colors between start and end points. Outside these points the gradient is either padded, reflected or repeated depending on the currently set \l {QGradient::Spread}{spread} method:
\table \row
The colors in a gradient is defined using stop points of the QGradientStop type, i.e. a position and a color. Use the QGradient::setColorAt() or the QGradient::setStops() function to define the stop points. It is the gradient's complete set of stop points that describes how the gradient area should be filled. If no stop points have been specified, a gradient of black at 0 to white at 1 is used.
In addition to the functions inherited from QGradient, the QLinearGradient class provides the finalStop() function which returns the final stop point of the gradient, and the start() function returning the start point of the gradient.
QLinearGradient::QLinearGradient | ( | ) |
Constructs a default linear gradient with interpolation area between (0, 0) and (1, 1).
Definition at line 1819 of file qbrush.cpp.
References QGradient::LinearGradient, m_data, and QGradient::PadSpread.
Constructs a linear gradient with interpolation area between the given start point and finalStop.
Definition at line 1838 of file qbrush.cpp.
References finalStop(), QGradient::LinearGradient, m_data, QGradient::PadSpread, QPointF::x(), and QPointF::y().
Constructs a linear gradient with interpolation area between (x1, y1) and (x2, y2).
Definition at line 1858 of file qbrush.cpp.
QLinearGradient::~QLinearGradient | ( | ) |
Definition at line 1866 of file qbrush.cpp.
QPointF QLinearGradient::finalStop | ( | ) | const |
Returns the final stop point of this linear gradient in logical coordinates.
Definition at line 1927 of file qbrush.cpp.
References QGradient::LinearGradient, m_data, and Q_ASSERT.
Referenced by QLinearGradient(), QSvgPaintEngine::saveLinearGradientBrush(), and QCoreGraphicsPaintEnginePrivate::setFillBrush().
Sets the final stop point of this linear gradient in logical coordinates to stop.
Definition at line 1943 of file qbrush.cpp.
References QGradient::LinearGradient, m_data, Q_ASSERT, QPointF::x(), and QPointF::y().
Referenced by QQC2_NAMESPACE::QMacStyle::drawControl(), QMacStyle::drawControl(), QQC2_NAMESPACE::QMacStyle::drawPrimitive(), QMacStyle::drawPrimitive(), and SplitterHandle::paintEvent().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Sets the final stop point of this linear gradient in logical coordinates to x, y.
Definition at line 407 of file qbrush.h.
References setFinalStop().
Referenced by setFinalStop().
Sets the start point of this linear gradient in logical coordinates to start.
Definition at line 1902 of file qbrush.cpp.
References QGradient::LinearGradient, m_data, and Q_ASSERT.
Referenced by QQC2_NAMESPACE::QMacStyle::drawControl(), QMacStyle::drawControl(), QQC2_NAMESPACE::QMacStyle::drawPrimitive(), QMacStyle::drawPrimitive(), and SplitterHandle::paintEvent().
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Sets the start point of this linear gradient in logical coordinates to x, y.
Definition at line 403 of file qbrush.h.
References setStart().
Referenced by setStart().
QPointF QLinearGradient::start | ( | ) | const |
Returns the start point of this linear gradient in logical coordinates.
Definition at line 1876 of file qbrush.cpp.
References QGradient::LinearGradient, m_data, and Q_ASSERT.
Referenced by QSvgPaintEngine::saveLinearGradientBrush(), and QCoreGraphicsPaintEnginePrivate::setFillBrush().