| 734 | } |
| 735 | |
| 736 | bool 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 | |
| 780 | ILaunchMode* LaunchConfigurationsModel::modeForIndex( const QModelIndex& idx ) const |
| 781 | { |
no test coverage detected