| 55 | CartesianPlotLegend::~CartesianPlotLegend() = default; |
| 56 | |
| 57 | void CartesianPlotLegend::init() { |
| 58 | Q_D(CartesianPlotLegend); |
| 59 | |
| 60 | KConfig config; |
| 61 | KConfigGroup group = config.group(QStringLiteral("CartesianPlotLegend")); |
| 62 | |
| 63 | d->labelFont = group.readEntry(QStringLiteral("LabelsFont"), QFont()); |
| 64 | d->labelFont.setPointSizeF(Worksheet::convertToSceneUnits(10, Worksheet::Unit::Point)); |
| 65 | d->usePlotColor = group.readEntry(QStringLiteral("UsePlotColor"), true); |
| 66 | d->labelColor = group.readEntry(QStringLiteral("FontColor"), QColor(Qt::black)); |
| 67 | d->labelColumnMajor = true; |
| 68 | d->lineSymbolWidth = group.readEntry(QStringLiteral("LineSymbolWidth"), Worksheet::convertToSceneUnits(1, Worksheet::Unit::Centimeter)); |
| 69 | d->rowCount = 0; |
| 70 | d->columnCount = 0; |
| 71 | |
| 72 | d->position.horizontalPosition = WorksheetElement::HorizontalPosition::Right; |
| 73 | d->position.verticalPosition = WorksheetElement::VerticalPosition::Top; |
| 74 | d->horizontalAlignment = WorksheetElement::HorizontalAlignment::Right; |
| 75 | d->verticalAlignment = WorksheetElement::VerticalAlignment::Top; |
| 76 | d->position.point = QPointF(0, 0); |
| 77 | |
| 78 | d->setRotation(group.readEntry(QStringLiteral("Rotation"), 0.0)); |
| 79 | |
| 80 | // Title |
| 81 | d->title = new TextLabel(this->name(), TextLabel::Type::PlotLegendTitle); |
| 82 | d->title->setBorderShape(TextLabel::BorderShape::NoBorder); |
| 83 | addChild(d->title); |
| 84 | d->title->setHidden(true); |
| 85 | d->title->setParentGraphicsItem(d); |
| 86 | d->title->graphicsItem()->setFlag(QGraphicsItem::ItemIsMovable, false); |
| 87 | d->title->graphicsItem()->setFlag(QGraphicsItem::ItemIsFocusable, false); |
| 88 | connect(d->title, &TextLabel::changed, this, &CartesianPlotLegend::retransform); |
| 89 | |
| 90 | // Background |
| 91 | d->background = new Background(QStringLiteral("background")); |
| 92 | addChild(d->background); |
| 93 | d->background->setHidden(true); |
| 94 | d->background->init(group); |
| 95 | connect(d->background, &Background::updateRequested, [=] { |
| 96 | d->update(); |
| 97 | }); |
| 98 | |
| 99 | // Border |
| 100 | d->borderLine = new Line(QStringLiteral("border")); |
| 101 | d->borderLine->setPrefix(QStringLiteral("Border")); |
| 102 | d->borderLine->setCreateXmlElement(false); |
| 103 | d->borderLine->setHidden(true); |
| 104 | addChild(d->borderLine); |
| 105 | d->borderLine->init(group); |
| 106 | connect(d->borderLine, &Line::updatePixmapRequested, [=] { |
| 107 | d->update(); |
| 108 | }); |
| 109 | connect(d->borderLine, &Line::updateRequested, [=] { |
| 110 | d->recalcShapeAndBoundingRect(); |
| 111 | }); |
| 112 | |
| 113 | d->borderCornerRadius = group.readEntry(QStringLiteral("BorderCornerRadius"), 0.0); |
| 114 |
nothing calls this directly
no test coverage detected