| 135 | } |
| 136 | |
| 137 | void InfoElement::init() { |
| 138 | Q_D(InfoElement); |
| 139 | cSystem = dynamic_cast<const CartesianCoordinateSystem*>(d->m_plot->coordinateSystem(m_cSystemIndex)); |
| 140 | |
| 141 | initActions(); |
| 142 | initMenus(); |
| 143 | |
| 144 | connect(this, &InfoElement::childAspectRemoved, this, &InfoElement::childRemoved); |
| 145 | connect(this, &InfoElement::childAspectAdded, this, &InfoElement::childAdded); |
| 146 | |
| 147 | m_title = new TextLabel(i18n("Label"), d->m_plot); |
| 148 | m_title->setHidden(true); |
| 149 | TextLabel::TextWrapper text; |
| 150 | text.allowPlaceholder = true; |
| 151 | m_setTextLabelText = true; |
| 152 | m_title->setUndoAware(false); |
| 153 | m_title->setText(text); // set placeholder to true |
| 154 | m_title->setUndoAware(true); |
| 155 | m_setTextLabelText = false; |
| 156 | addChild(m_title); |
| 157 | |
| 158 | // use the line properties of axis line also for the info element lines |
| 159 | KConfig config; |
| 160 | const auto& group = config.group(QStringLiteral("Axis")); |
| 161 | |
| 162 | // lines |
| 163 | d->verticalLine = new Line(QString()); |
| 164 | d->verticalLine->setHidden(true); |
| 165 | d->verticalLine->setPrefix(QStringLiteral("VerticalLine")); |
| 166 | addChild(d->verticalLine); |
| 167 | d->verticalLine->init(group); |
| 168 | connect(d->verticalLine, &Line::updatePixmapRequested, [=] { |
| 169 | d->update(); |
| 170 | }); |
| 171 | connect(d->verticalLine, &Line::updateRequested, [=] { |
| 172 | d->updateVerticalLine(); |
| 173 | }); |
| 174 | |
| 175 | d->connectionLine = new Line(QString()); |
| 176 | d->connectionLine->setHidden(true); |
| 177 | d->connectionLine->setPrefix(QStringLiteral("ConnectionLine")); |
| 178 | addChild(d->connectionLine); |
| 179 | d->connectionLine->init(group); |
| 180 | connect(d->connectionLine, &Line::updatePixmapRequested, [=] { |
| 181 | d->update(); |
| 182 | }); |
| 183 | connect(d->connectionLine, &Line::updateRequested, [=] { |
| 184 | d->updateConnectionLine(); |
| 185 | }); |
| 186 | } |
| 187 | |
| 188 | void InfoElement::initActions() { |
| 189 | } |
nothing calls this directly
no test coverage detected