MCPcopy Create free account
hub / github.com/KDE/labplot / init

Method init

src/backend/worksheet/Background.cpp:46–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46void 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
71void Background::draw(QPainter* painter, const QPolygonF& polygon, double radius) const {
72 Q_D(const Background);

Callers

nothing calls this directly

Calls 3

QStringClass · 0.50
QColorClass · 0.50
typeMethod · 0.45

Tested by

no test coverage detected