| 49 | } |
| 50 | |
| 51 | void Image::init() { |
| 52 | Q_D(Image); |
| 53 | |
| 54 | KConfig config; |
| 55 | KConfigGroup group = config.group(QStringLiteral("Image")); |
| 56 | |
| 57 | d->embedded = group.readEntry(QStringLiteral("embedded"), true); |
| 58 | d->opacity = group.readEntry(QStringLiteral("opacity"), d->opacity); |
| 59 | |
| 60 | // geometry |
| 61 | d->position.point.setX(group.readEntry(QStringLiteral("PositionXValue"), 0.)); |
| 62 | d->position.point.setY(group.readEntry(QStringLiteral("PositionYValue"), 0.)); |
| 63 | d->position.horizontalPosition = |
| 64 | (WorksheetElement::HorizontalPosition)group.readEntry(QStringLiteral("PositionX"), (int)WorksheetElement::HorizontalPosition::Center); |
| 65 | d->position.verticalPosition = |
| 66 | (WorksheetElement::VerticalPosition)group.readEntry(QStringLiteral("PositionY"), (int)WorksheetElement::VerticalPosition::Center); |
| 67 | d->horizontalAlignment = |
| 68 | (WorksheetElement::HorizontalAlignment)group.readEntry(QStringLiteral("HorizontalAlignment"), (int)WorksheetElement::HorizontalAlignment::Center); |
| 69 | d->verticalAlignment = |
| 70 | (WorksheetElement::VerticalAlignment)group.readEntry(QStringLiteral("VerticalAlignment"), (int)WorksheetElement::VerticalAlignment::Center); |
| 71 | d->setRotation(group.readEntry(QStringLiteral("Rotation"), d->rotation())); |
| 72 | |
| 73 | // border |
| 74 | d->borderLine = new Line(QString()); |
| 75 | d->borderLine->setPrefix(QStringLiteral("Border")); |
| 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 | }); |
| 85 | } |
| 86 | |
| 87 | // no need to delete the d-pointer here - it inherits from QGraphicsItem |
| 88 | // and is deleted during the cleanup in QGraphicsScene |
nothing calls this directly
no test coverage detected