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

Method handleDescriptionChanged

src/frontend/datapicker/DatapickerView.cpp:155–177  ·  view source on GitHub ↗

! * handle the renames of child aspects to adjust the names of the tabs accordingly. */

Source from the content-addressed store, hash-verified

153 * handle the renames of child aspects to adjust the names of the tabs accordingly.
154 */
155void DatapickerView::handleDescriptionChanged(const AbstractAspect* aspect) {
156 // nothing to do if the parent itself was renamed, we only need to handle curves and data spreadsheets.
157 if (aspect == m_datapicker || aspect == m_datapicker->image())
158 return;
159
160 // determine the child that was changed and adjust the name of the corresponding tab widget
161 int index = -1;
162 QString name;
163 if (aspect->parentAspect() == m_datapicker) {
164 // datapicker curve was renamed
165 index = m_datapicker->indexOfChild<AbstractAspect>(aspect, AbstractAspect::ChildIndexFlag::IncludeHidden);
166 if (index != -1)
167 name = aspect->name() + QStringLiteral(": ") + aspect->children<Spreadsheet>().constFirst()->name();
168 } else {
169 // data spreadsheet was renamed or one of its columns, which is not relevant here
170 index = m_datapicker->indexOfChild<AbstractAspect>(aspect->parentAspect(), AbstractAspect::ChildIndexFlag::IncludeHidden);
171 if (index != -1)
172 name = aspect->parentAspect()->name() + QStringLiteral(": ") + aspect->name();
173 }
174
175 if (index != -1)
176 m_tabWidget->setTabText(index, name);
177}
178
179void DatapickerView::handleAspectAdded(const AbstractAspect* aspect) {
180 int index = 0;

Callers

nothing calls this directly

Calls 3

imageMethod · 0.80
parentAspectMethod · 0.80
nameMethod · 0.45

Tested by

no test coverage detected