! * Emits the signal to select or to deselect the workbook item (spreadsheet or matrix) with the index \c index * in the project explorer, if \c selected=true or \c selected=false, respectively. * The signal is handled in \c AspectTreeModel and forwarded to the tree view in \c ProjectExplorer. * This function is called in \c WorkbookView when the current tab was changed */
| 149 | * This function is called in \c WorkbookView when the current tab was changed |
| 150 | */ |
| 151 | void Workbook::setChildSelectedInView(int index, bool selected) { |
| 152 | auto* aspect = child<AbstractAspect>(index); |
| 153 | if (selected) { |
| 154 | Q_EMIT childAspectSelectedInView(aspect); |
| 155 | |
| 156 | // deselect the workbook in the project explorer, if a child (spreadsheet or matrix) was selected. |
| 157 | // prevents unwanted multiple selection with workbook if it was selected before. |
| 158 | Q_EMIT childAspectDeselectedInView(this); |
| 159 | } else { |
| 160 | Q_EMIT childAspectDeselectedInView(aspect); |
| 161 | |
| 162 | // deselect also all children that were potentially selected before (columns of a spreadsheet) |
| 163 | for (auto* child : aspect->children<AbstractAspect>()) |
| 164 | Q_EMIT childAspectDeselectedInView(child); |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | QVector<AspectType> Workbook::pasteTypes() const { |
| 169 | return QVector<AspectType>{AspectType::Spreadsheet, AspectType::Matrix}; |
no outgoing calls
no test coverage detected