Krita Source Code Documentation
Loading...
Searching...
No Matches
KoColorBackground Class Reference

A simple solid color shape background. More...

#include <KoColorBackground.h>

+ Inheritance diagram for KoColorBackground:

Classes

class  Private
 

Public Member Functions

QBrush brush () const
 
QColor color () const
 Returns the background color.
 
bool compareTo (const KoShapeBackground *other) const override
 
 KoColorBackground ()
 
 KoColorBackground (const KoColorBackground &)
 
 KoColorBackground (const QColor &color, Qt::BrushStyle style=Qt::SolidPattern)
 Creates background from given color and style.
 
KoColorBackgroundoperator= (const KoColorBackground &)
 
void paint (QPainter &painter, const QPainterPath &fillPath) const override
 Paints the background using the given fill path.
 
void setColor (const QColor &color)
 Sets the background color.
 
Qt::BrushStyle style () const
 Returns the background style.
 
 ~KoColorBackground () override
 
- Public Member Functions inherited from KoShapeBackground
virtual bool hasTransparency () const
 Returns if the background has some transparency.
 
 KoShapeBackground ()
 
virtual operator bool () const
 
virtual ~KoShapeBackground ()
 

Private Attributes

QSharedDataPointer< Privated
 

Detailed Description

A simple solid color shape background.

Definition at line 20 of file KoColorBackground.h.

Constructor & Destructor Documentation

◆ KoColorBackground() [1/3]

KoColorBackground::KoColorBackground ( )

Definition at line 27 of file KoColorBackground.cpp.

29 , d(new Private)
30{
31}
QSharedDataPointer< Private > d

◆ KoColorBackground() [2/3]

KoColorBackground::KoColorBackground ( const QColor & color,
Qt::BrushStyle style = Qt::SolidPattern )
explicit

Creates background from given color and style.

Definition at line 33 of file KoColorBackground.cpp.

35 , d(new Private)
36{
37 if (style < Qt::SolidPattern || style >= Qt::LinearGradientPattern) {
38 style = Qt::SolidPattern;
39 }
40
41 d->style = style;
42 d->color = color;
43}
Qt::BrushStyle style() const
Returns the background style.
QColor color() const
Returns the background color.

References color(), d, and style().

◆ ~KoColorBackground()

KoColorBackground::~KoColorBackground ( )
override

Definition at line 45 of file KoColorBackground.cpp.

46{
47}

◆ KoColorBackground() [3/3]

KoColorBackground::KoColorBackground ( const KoColorBackground & rhs)

Definition at line 49 of file KoColorBackground.cpp.

50 : d(new Private(*rhs.d))
51{
52}

Member Function Documentation

◆ brush()

QBrush KoColorBackground::brush ( ) const

Definition at line 81 of file KoColorBackground.cpp.

82{
83 return QBrush(d->color, d->style);
84}

References d.

◆ color()

QColor KoColorBackground::color ( ) const

Returns the background color.

Definition at line 66 of file KoColorBackground.cpp.

67{
68 return d->color;
69}

References d.

◆ compareTo()

bool KoColorBackground::compareTo ( const KoShapeBackground * other) const
overridevirtual

Implements KoShapeBackground.

Definition at line 60 of file KoColorBackground.cpp.

61{
62 const KoColorBackground *bg = dynamic_cast<const KoColorBackground*>(other);
63 return bg && bg->color() == d->color;
64}
A simple solid color shape background.

References color(), and d.

◆ operator=()

KoColorBackground & KoColorBackground::operator= ( const KoColorBackground & rhs)

Definition at line 54 of file KoColorBackground.cpp.

55{
56 d = rhs.d;
57 return *this;
58}

References d.

◆ paint()

void KoColorBackground::paint ( QPainter & painter,
const QPainterPath & fillPath ) const
overridevirtual

Paints the background using the given fill path.

Implements KoShapeBackground.

Reimplemented in KoHatchBackground.

Definition at line 86 of file KoColorBackground.cpp.

87{
88 painter.setBrush(brush());
89 painter.drawPath(fillPath);
90}

References brush().

◆ setColor()

void KoColorBackground::setColor ( const QColor & color)

Sets the background color.

Definition at line 71 of file KoColorBackground.cpp.

72{
73 d->color = color;
74}

References color(), and d.

◆ style()

Qt::BrushStyle KoColorBackground::style ( ) const

Returns the background style.

Definition at line 76 of file KoColorBackground.cpp.

77{
78 return d->style;
79}

References d.

Member Data Documentation

◆ d

QSharedDataPointer<Private> KoColorBackground::d
private

Definition at line 52 of file KoColorBackground.h.


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