Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QLinearGradient Class Reference

\inmodule QtGui More...

#include <qbrush.h>

+ Inheritance diagram for QLinearGradient:
+ Collaboration diagram for QLinearGradient:

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.
 
- Public Member Functions inherited from QGradient
 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
 

Additional Inherited Members

- Public Types inherited from QGradient
enum  Type { LinearGradient , RadialGradient , ConicalGradient , NoGradient }
 Specifies the type of gradient. More...
 
enum  Spread { PadSpread , ReflectSpread , RepeatSpread }
 Specifies how the area outside the gradient area should be filled. More...
 
enum  CoordinateMode { LogicalMode , StretchToDeviceMode , ObjectBoundingMode , ObjectMode }
 
enum  InterpolationMode { ColorInterpolation , ComponentInterpolation }
 
enum  Preset {
  WarmFlame = 1 , NightFade = 2 , SpringWarmth = 3 , JuicyPeach = 4 ,
  YoungPassion = 5 , LadyLips = 6 , SunnyMorning = 7 , RainyAshville = 8 ,
  FrozenDreams = 9 , WinterNeva = 10 , DustyGrass = 11 , TemptingAzure = 12 ,
  HeavyRain = 13 , AmyCrisp = 14 , MeanFruit = 15 , DeepBlue = 16 ,
  RipeMalinka = 17 , CloudyKnoxville = 18 , MalibuBeach = 19 , NewLife = 20 ,
  TrueSunset = 21 , MorpheusDen = 22 , RareWind = 23 , NearMoon = 24 ,
  WildApple = 25 , SaintPetersburg = 26 , PlumPlate = 28 , EverlastingSky = 29 ,
  HappyFisher = 30 , Blessing = 31 , SharpeyeEagle = 32 , LadogaBottom = 33 ,
  LemonGate = 34 , ItmeoBranding = 35 , ZeusMiracle = 36 , OldHat = 37 ,
  StarWine = 38 , HappyAcid = 41 , AwesomePine = 42 , NewYork = 43 ,
  ShyRainbow = 44 , MixedHopes = 46 , FlyHigh = 47 , StrongBliss = 48 ,
  FreshMilk = 49 , SnowAgain = 50 , FebruaryInk = 51 , KindSteel = 52 ,
  SoftGrass = 53 , GrownEarly = 54 , SharpBlues = 55 , ShadyWater = 56 ,
  DirtyBeauty = 57 , GreatWhale = 58 , TeenNotebook = 59 , PoliteRumors = 60 ,
  SweetPeriod = 61 , WideMatrix = 62 , SoftCherish = 63 , RedSalvation = 64 ,
  BurningSpring = 65 , NightParty = 66 , SkyGlider = 67 , HeavenPeach = 68 ,
  PurpleDivision = 69 , AquaSplash = 70 , SpikyNaga = 72 , LoveKiss = 73 ,
  CleanMirror = 75 , PremiumDark = 76 , ColdEvening = 77 , CochitiLake = 78 ,
  SummerGames = 79 , PassionateBed = 80 , MountainRock = 81 , DesertHump = 82 ,
  JungleDay = 83 , PhoenixStart = 84 , OctoberSilence = 85 , FarawayRiver = 86 ,
  AlchemistLab = 87 , OverSun = 88 , PremiumWhite = 89 , MarsParty = 90 ,
  EternalConstance = 91 , JapanBlush = 92 , SmilingRain = 93 , CloudyApple = 94 ,
  BigMango = 95 , HealthyWater = 96 , AmourAmour = 97 , RiskyConcrete = 98 ,
  StrongStick = 99 , ViciousStance = 100 , PaloAlto = 101 , HappyMemories = 102 ,
  MidnightBloom = 103 , Crystalline = 104 , PartyBliss = 106 , ConfidentCloud = 107 ,
  LeCocktail = 108 , RiverCity = 109 , FrozenBerry = 110 , ChildCare = 112 ,
  FlyingLemon = 113 , NewRetrowave = 114 , HiddenJaguar = 115 , AboveTheSky = 116 ,
  Nega = 117 , DenseWater = 118 , Seashore = 120 , MarbleWall = 121 ,
  CheerfulCaramel = 122 , NightSky = 123 , MagicLake = 124 , YoungGrass = 125 ,
  ColorfulPeach = 126 , GentleCare = 127 , PlumBath = 128 , HappyUnicorn = 129 ,
  AfricanField = 131 , SolidStone = 132 , OrangeJuice = 133 , GlassWater = 134 ,
  NorthMiracle = 136 , FruitBlend = 137 , MillenniumPine = 138 , HighFlight = 139 ,
  MoleHall = 140 , SpaceShift = 142 , ForestInei = 143 , RoyalGarden = 144 ,
  RichMetal = 145 , JuicyCake = 146 , SmartIndigo = 147 , SandStrike = 148 ,
  NorseBeauty = 149 , AquaGuidance = 150 , SunVeggie = 151 , SeaLord = 152 ,
  BlackSea = 153 , GrassShampoo = 154 , LandingAircraft = 155 , WitchDance = 156 ,
  SleeplessNight = 157 , AngelCare = 158 , CrystalRiver = 159 , SoftLipstick = 160 ,
  SaltMountain = 161 , PerfectWhite = 162 , FreshOasis = 163 , StrictNovember = 164 ,
  MorningSalad = 165 , DeepRelief = 166 , SeaStrike = 167 , NightCall = 168 ,
  SupremeSky = 169 , LightBlue = 170 , MindCrawl = 171 , LilyMeadow = 172 ,
  SugarLollipop = 173 , SweetDessert = 174 , MagicRay = 175 , TeenParty = 176 ,
  FrozenHeat = 177 , GagarinView = 178 , FabledSunset = 179 , PerfectBlue = 180 ,
  NumPresets
}
 

Detailed Description

\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.

See also
QRadialGradient, QConicalGradient, {painting/gradients}{The Gradients Example}

Definition at line 393 of file qbrush.h.

Constructor & Destructor Documentation

◆ QLinearGradient() [1/3]

QLinearGradient::QLinearGradient ( )

Constructs a default linear gradient with interpolation area between (0, 0) and (1, 1).

See also
QGradient::setColorAt(), setStart(), setFinalStop()

Definition at line 1819 of file qbrush.cpp.

References QGradient::LinearGradient, m_data, and QGradient::PadSpread.

◆ QLinearGradient() [2/3]

QLinearGradient::QLinearGradient ( const QPointF & start,
const QPointF & finalStop )

Constructs a linear gradient with interpolation area between the given start point and finalStop.

Note
The expected parameter values are in pixels.
See also
QGradient::setColorAt(), QGradient::setStops()

Definition at line 1838 of file qbrush.cpp.

References finalStop(), QGradient::LinearGradient, m_data, QGradient::PadSpread, QPointF::x(), and QPointF::y().

+ Here is the call graph for this function:

◆ QLinearGradient() [3/3]

QLinearGradient::QLinearGradient ( qreal x1,
qreal y1,
qreal x2,
qreal y2 )

Constructs a linear gradient with interpolation area between (x1, y1) and (x2, y2).

Note
The expected parameter values are in pixels.
See also
QGradient::setColorAt(), QGradient::setStops()

Definition at line 1858 of file qbrush.cpp.

◆ ~QLinearGradient()

QLinearGradient::~QLinearGradient ( )

Definition at line 1866 of file qbrush.cpp.

Member Function Documentation

◆ finalStop()

QPointF QLinearGradient::finalStop ( ) const

Returns the final stop point of this linear gradient in logical coordinates.

See also
QGradient::stops()

Definition at line 1927 of file qbrush.cpp.

References QGradient::LinearGradient, m_data, and Q_ASSERT.

Referenced by QLinearGradient(), and QSvgPaintEngine::saveLinearGradientBrush().

+ Here is the caller graph for this function:

◆ setFinalStop() [1/2]

void QLinearGradient::setFinalStop ( const QPointF & stop)
Since
4.2

Sets the final stop point of this linear gradient in logical coordinates to stop.

See also
finalStop()

Definition at line 1943 of file qbrush.cpp.

References QGradient::LinearGradient, m_data, Q_ASSERT, QPointF::x(), and QPointF::y().

Referenced by SplitterHandle::paintEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setFinalStop() [2/2]

void QLinearGradient::setFinalStop ( qreal x,
qreal y )
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
4.2

Sets the final stop point of this linear gradient in logical coordinates to x, y.

See also
start()

Definition at line 407 of file qbrush.h.

References setFinalStop().

Referenced by setFinalStop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setStart() [1/2]

void QLinearGradient::setStart ( const QPointF & start)
Since
4.2

Sets the start point of this linear gradient in logical coordinates to start.

See also
start()

Definition at line 1902 of file qbrush.cpp.

References QGradient::LinearGradient, m_data, and Q_ASSERT.

Referenced by SplitterHandle::paintEvent().

+ Here is the caller graph for this function:

◆ setStart() [2/2]

void QLinearGradient::setStart ( qreal x,
qreal y )
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Since
4.2

Sets the start point of this linear gradient in logical coordinates to x, y.

See also
start()

Definition at line 403 of file qbrush.h.

References setStart().

Referenced by setStart().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ start()

QPointF QLinearGradient::start ( ) const

Returns the start point of this linear gradient in logical coordinates.

See also
QGradient::stops()

Definition at line 1876 of file qbrush.cpp.

References QGradient::LinearGradient, m_data, and Q_ASSERT.

Referenced by QSvgPaintEngine::saveLinearGradientBrush().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: