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

Method init

src/backend/worksheet/InfoElement.cpp:137–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135}
136
137void 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
188void InfoElement::initActions() {
189}

Callers

nothing calls this directly

Calls 12

setFlagFunction · 0.85
setUndoAwareMethod · 0.80
updateVerticalLineMethod · 0.80
updateConnectionLineMethod · 0.80
QStringClass · 0.50
QPointFClass · 0.50
coordinateSystemMethod · 0.45
setHiddenMethod · 0.45
setTextMethod · 0.45
groupMethod · 0.45
setPrefixMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected