| 941 | |
| 942 | |
| 943 | QWidget* LaunchConfigurationModelDelegate::createEditor ( QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const |
| 944 | { |
| 945 | const auto* model = static_cast<const LaunchConfigurationsModel*>(index.model()); |
| 946 | ILaunchMode* mode = model->modeForIndex( index ); |
| 947 | LaunchConfiguration* config = model->configForIndex( index ); |
| 948 | if( index.column() == 1 && mode && config ) |
| 949 | { |
| 950 | auto* box = new KComboBox( parent ); |
| 951 | const QList<ILauncher*> launchers = config->type()->launchers(); |
| 952 | for (auto* launcher : launchers) { |
| 953 | if (launcher->supportedModes().contains(mode->id())) { |
| 954 | box->addItem(launcher->name(), launcher->id()); |
| 955 | } |
| 956 | } |
| 957 | return box; |
| 958 | } else if( !mode && config && index.column() == 1 ) |
| 959 | { |
| 960 | auto* box = new KComboBox( parent ); |
| 961 | const QList<LaunchConfigurationType*> types = Core::self()->runController()->launchConfigurationTypes(); |
| 962 | for (auto* type : types) { |
| 963 | box->addItem(type->name(), type->id()); |
| 964 | } |
| 965 | return box; |
| 966 | } |
| 967 | return QStyledItemDelegate::createEditor ( parent, option, index ); |
| 968 | } |
| 969 | |
| 970 | void LaunchConfigurationModelDelegate::setEditorData ( QWidget* editor, const QModelIndex& index ) const |
| 971 | { |
nothing calls this directly
no test coverage detected