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

Method selectionChanged

src/frontend/datasources/ImportProjectDialog.cpp:385–409  ·  view source on GitHub ↗

############################################################################## ################################# SLOTS #################################### ##############################################################################

Source from the content-addressed store, hash-verified

383// ################################# SLOTS ####################################
384// ##############################################################################
385void ImportProjectDialog::selectionChanged(const QItemSelection& selected, const QItemSelection& /*deselected*/) {
386 // determine the dependent objects and select/deselect them too
387 const QModelIndexList& indexes = selected.indexes();
388 if (indexes.isEmpty())
389 return;
390
391 // for the just selected aspect, determine all the objects it depends on and select them, too
392 // TODO: we need a better "selection", maybe with tri-state check boxes in the tree view
393 const auto* aspect = static_cast<const AbstractAspect*>(indexes.at(0).internalPointer());
394 const QVector<AbstractAspect*> aspects = aspect->dependsOn();
395
396 const auto* model = reinterpret_cast<AspectTreeModel*>(ui.tvPreview->model());
397 for (const auto* aspect : aspects) {
398 QModelIndex index = model->modelIndexOfAspect(aspect, 0);
399 ui.tvPreview->selectionModel()->select(index, QItemSelectionModel::Select | QItemSelectionModel::Rows);
400 }
401
402 // Ok-button is only enabled if some project objects were selected
403 bool enable = (selected.indexes().size() != 0);
404 m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(enable);
405 if (enable)
406 m_buttonBox->button(QDialogButtonBox::Ok)->setToolTip(i18n("Close the dialog and import the selected objects."));
407 else
408 m_buttonBox->button(QDialogButtonBox::Ok)->setToolTip(i18n("Select object(s) to be imported."));
409}
410
411class OPJFilterProxyModel : public QSortFilterProxyModel {
412protected:

Callers

nothing calls this directly

Calls 9

modelIndexOfAspectMethod · 0.80
selectionModelMethod · 0.80
buttonMethod · 0.80
setToolTipMethod · 0.80
isEmptyMethod · 0.45
dependsOnMethod · 0.45
modelMethod · 0.45
sizeMethod · 0.45
setEnabledMethod · 0.45

Tested by

no test coverage detected