Stores background data. More...
#include <Qtx.h>
Public Member Functions | |
| BackgroundData () | |
| Default constructor. Creates invalid background data. More... | |
| BackgroundData (const QColor &) | |
| Constructor. Creates background data initialized with the specified color. More... | |
| BackgroundData (int, const QColor &, const QColor &) | |
| Constructor. Creates background data initialized with the specified two-color gradient. More... | |
| BackgroundData (const QGradient &) | |
| Constructor. Creates background data initialized with the arbirtary gradient data. More... | |
| virtual | ~BackgroundData () |
| Destructor. More... | |
| bool | operator== (const BackgroundData &) const |
| Compares two background data objects. More... | |
| bool | operator!= (const BackgroundData &other) const |
| bool | isValid () const |
Returns false if background data is not set (invalid) More... | |
| BackgroundMode | mode () const |
| Get background mode. More... | |
| void | setMode (const BackgroundMode) |
| Set background mode. More... | |
| TextureMode | texture (QString &) const |
| Get file name used as a texture image. More... | |
| void | setTexture (const QString &, TextureMode=Qtx::CenterTexture) |
| Set file name to be used as a texture image. More... | |
| bool | isTextureShown () const |
| Check if "show texture" flag is switched on. More... | |
| void | setTextureShown (bool) |
| Specify if texture should be shown on the background or no. More... | |
| QColor | color () const |
| Get background color. Returns null QColor if color is not set. More... | |
| void | setColor (const QColor &) |
| Set background color and switch to the Qtx::ColorBackground mode. More... | |
| int | gradient (QColor &, QColor &) const |
| Get simple gradient data. Returns -1 and null QColor for c1 and c2 if gradient data is not set. More... | |
| void | setGradient (int, const QColor &, const QColor &) |
| Set simple background gradient data and switch to the Qtx::SimpleGradientBackground mode. More... | |
| const QGradient * | gradient () const |
| Get complex gradient data. Returns QGradient of QGradient::NoGradient if gradient data is not set. More... | |
| void | setGradient (const QGradient &) |
| Set complex background gradient data and switch to the Qtx::CustomGradientBackground mode. More... | |
Private Attributes | |
| BackgroundMode | myMode |
| TextureMode | myTextureMode |
| QString | myFileName |
| QColorList | myColors |
| int | myGradientType |
| QGradient | myGradient |
| bool | myTextureShown |
This class is used to store background data. Depending on the mode, the background can be specified by:
The class stores all the data passed to it, so switching between different modes can be done just by calling setMode() function.
| Qtx::BackgroundData::BackgroundData | ( | ) |
References Qtx::NoBackground, and setMode().
| Qtx::BackgroundData::BackgroundData | ( | const QColor & | c | ) |
| c | color |
References setColor().
| type | gradient type identifier |
| c1 | first gradient color |
| c2 | second gradient color |
References setGradient().
| Qtx::BackgroundData::BackgroundData | ( | const QGradient & | grad | ) |
| grad | gradient data |
References setGradient().
|
virtual |
| QColor Qtx::BackgroundData::color | ( | ) | const |
| int Qtx::BackgroundData::gradient | ( | QColor & | c1, |
| QColor & | c2 | ||
| ) | const |
| c1 | first gradient color is returned via this parameter |
| c2 | second gradient color is returned via this parameter |
| const QGradient * Qtx::BackgroundData::gradient | ( | ) | const |
| bool Qtx::BackgroundData::isTextureShown | ( | ) | const |
true if "show texture" flag is set or false otherwise | bool Qtx::BackgroundData::isValid | ( | ) | const |
true if background data is valid or false otherwise References Qtx::NoBackground.
| Qtx::BackgroundMode Qtx::BackgroundData::mode | ( | ) | const |
|
inline |
References operator==().
| bool Qtx::BackgroundData::operator== | ( | const BackgroundData & | other | ) | const |
References myColors, myFileName, myGradient, myGradientType, myMode, myTextureMode, and myTextureShown.
| void Qtx::BackgroundData::setColor | ( | const QColor & | c | ) |
| type | two-colored gradient mode type identifier |
| c1 | first gradient color is returned via this parameter |
| c2 | second gradient color is returned via this parameter |
References Qtx::SimpleGradientBackground.
| void Qtx::BackgroundData::setGradient | ( | const QGradient & | grad | ) |
| grad | gradient data (QLinearGradient, QRadialGradient or QConicalGradient) |
References Qtx::CustomGradientBackground.
| void Qtx::BackgroundData::setMode | ( | const BackgroundMode | m | ) |
| m | background mode being set |
| void Qtx::BackgroundData::setTexture | ( | const QString & | fileName, |
| const Qtx::TextureMode | m = Qtx::CenterTexture |
||
| ) |
| fileName | path to the texture image file name |
| m | texture mode (Qtx::CenterTexture by default) |
| void Qtx::BackgroundData::setTextureShown | ( | bool | on | ) |
| on | true if texture should be shown or false otherwise |
| Qtx::TextureMode Qtx::BackgroundData::texture | ( | QString & | fileName | ) | const |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |