| 48 | PlotArea::~PlotArea() = default; |
| 49 | |
| 50 | void PlotArea::init() { |
| 51 | Q_D(PlotArea); |
| 52 | |
| 53 | setHidden(true); // we don't show PlotArea aspect in the model view. |
| 54 | d->rect = QRectF(0, 0, 1, 1); |
| 55 | d->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); |
| 56 | |
| 57 | KConfig config; |
| 58 | KConfigGroup group = config.group(QStringLiteral("PlotArea")); |
| 59 | |
| 60 | // Background |
| 61 | d->background = new Background(QStringLiteral("background")); |
| 62 | addChild(d->background); |
| 63 | d->background->setHidden(true); |
| 64 | d->background->init(group); |
| 65 | connect(d->background, &Background::updateRequested, [=] { |
| 66 | d->update(); |
| 67 | }); |
| 68 | |
| 69 | // Border |
| 70 | PlotArea::BorderType type; // default value |
| 71 | d->borderType = static_cast<PlotArea::BorderType>(group.readEntry(QStringLiteral("BorderType"), static_cast<int>(type))); |
| 72 | |
| 73 | d->borderLine = new Line(QStringLiteral("borderLine")); |
| 74 | d->borderLine->setPrefix(QStringLiteral("Border")); |
| 75 | d->borderLine->setCreateXmlElement(false); |
| 76 | d->borderLine->setHidden(true); |
| 77 | addChild(d->borderLine); |
| 78 | d->borderLine->init(group); |
| 79 | connect(d->borderLine, &Line::updatePixmapRequested, [=] { |
| 80 | d->update(); |
| 81 | }); |
| 82 | connect(d->borderLine, &Line::updateRequested, [=] { |
| 83 | d->recalcShapeAndBoundingRect(); |
| 84 | Q_EMIT changed(); |
| 85 | }); |
| 86 | |
| 87 | d->borderCornerRadius = group.readEntry(QStringLiteral("BorderCornerRadius"), 0.0); |
| 88 | } |
| 89 | |
| 90 | QGraphicsItem* PlotArea::graphicsItem() const { |
| 91 | return d_ptr; |
nothing calls this directly
no test coverage detected