! * handle the renames of child aspects to adjust the names of the tabs accordingly. */
| 153 | * handle the renames of child aspects to adjust the names of the tabs accordingly. |
| 154 | */ |
| 155 | void 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 | |
| 179 | void DatapickerView::handleAspectAdded(const AbstractAspect* aspect) { |
| 180 | int index = 0; |
nothing calls this directly
no test coverage detected