MCPcopy Create free account
hub / github.com/KDE/kdevelop / setData

Method setData

kdevplatform/shell/launchconfigurationdialog.cpp:736–778  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

734}
735
736bool LaunchConfigurationsModel::setData(const QModelIndex& index, const QVariant& value, int role)
737{
738 if( index.isValid() && index.parent().isValid() && role == Qt::EditRole )
739 {
740 if( index.row() >= 0 && index.row() < rowCount( index.parent() ) )
741 {
742 auto* t = dynamic_cast<LaunchItem*>( static_cast<TreeItem*>( index.internalPointer() ) );
743 if( t )
744 {
745 if( index.column() == 0 )
746 {
747 t->launch->setName( value.toString() );
748 } else if( index.column() == 1 )
749 {
750 if (t->launch->type()->id() != value.toString()) {
751 t->launch->setType( value.toString() );
752 QModelIndex p = indexForConfig(t->launch);
753 qCDebug(SHELL) << data(p);
754 beginRemoveRows( p, 0, t->children.count() );
755 qDeleteAll( t->children );
756 t->children.clear();
757 endRemoveRows();
758 addLaunchModeItemsForLaunchConfig( t );
759 }
760 }
761 emit dataChanged(index, index);
762 return true;
763 }
764 auto* lmi = dynamic_cast<LaunchModeItem*>( static_cast<TreeItem*>( index.internalPointer() ) );
765 if( lmi )
766 {
767 if( index.column() == 1 && index.data(Qt::EditRole)!=value)
768 {
769 LaunchConfiguration* l = configForIndex( index );
770 l->setLauncherForMode( lmi->mode->id(), value.toString() );
771 emit dataChanged(index, index);
772 return true;
773 }
774 }
775 }
776 }
777 return false;
778}
779
780ILaunchMode* LaunchConfigurationsModel::modeForIndex( const QModelIndex& idx ) const
781{

Callers 8

setModelDataMethod · 0.45
launchModeChangedMethod · 0.45
addSessionMethod · 0.45
updateStateMethod · 0.45
addLaunchActionMethod · 0.45
registerJobMethod · 0.45

Calls 14

setLauncherForModeMethod · 0.80
dataFunction · 0.50
isValidMethod · 0.45
parentMethod · 0.45
rowMethod · 0.45
columnMethod · 0.45
setNameMethod · 0.45
toStringMethod · 0.45
idMethod · 0.45
typeMethod · 0.45
setTypeMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected