| 44 | } |
| 45 | |
| 46 | void Background::init(const KConfigGroup& group) { |
| 47 | Q_D(Background); |
| 48 | |
| 49 | d->type = (Type)group.readEntry(d->prefix + QStringLiteral("Type"), static_cast<int>(Type::Color)); |
| 50 | d->colorStyle = (ColorStyle)group.readEntry(d->prefix + QStringLiteral("ColorStyle"), static_cast<int>(ColorStyle::SingleColor)); |
| 51 | d->imageStyle = (ImageStyle)group.readEntry(d->prefix + QStringLiteral("ImageStyle"), static_cast<int>(ImageStyle::Scaled)); |
| 52 | d->brushStyle = (Qt::BrushStyle)group.readEntry(d->prefix + QStringLiteral("BrushStyle"), static_cast<int>(Qt::SolidPattern)); |
| 53 | d->fileName = group.readEntry(d->prefix + QStringLiteral("FileName"), QString()); |
| 54 | d->firstColor = group.readEntry(d->prefix + QStringLiteral("FirstColor"), QColor(Qt::white)); |
| 55 | d->secondColor = group.readEntry(d->prefix + QStringLiteral("SecondColor"), QColor(Qt::black)); |
| 56 | |
| 57 | double defaultOpacity = 1.0; |
| 58 | auto type = parentAspect()->type(); |
| 59 | if (type == AspectType::Histogram || type == AspectType::BoxPlot) |
| 60 | defaultOpacity = 0.5; |
| 61 | d->opacity = group.readEntry(d->prefix + QStringLiteral("Opacity"), defaultOpacity); |
| 62 | |
| 63 | // optional parameters |
| 64 | if (d->enabledAvailable) |
| 65 | d->enabled = group.readEntry(d->prefix + QStringLiteral("Enabled"), true); |
| 66 | |
| 67 | if (d->positionAvailable) |
| 68 | d->position = (Position)group.readEntry(d->prefix + QStringLiteral("Position"), static_cast<int>(Position::No)); |
| 69 | } |
| 70 | |
| 71 | void Background::draw(QPainter* painter, const QPolygonF& polygon, double radius) const { |
| 72 | Q_D(const Background); |