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

Method removeConfig

plugins/custom-buildsystem/custombuildsystemconfigwidget.cpp:166–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166void CustomBuildSystemConfigWidget::removeConfig()
167{
168 int curidx = ui->currentConfig->currentIndex();
169 Q_ASSERT( curidx < configs.length() && curidx >= 0 );
170 configs.removeAt( curidx );
171 ui->currentConfig->removeItem( curidx );
172
173 // Make sure the new index is valid if possible, removing the first index
174 // would otherwise set the index to -1 and that will cause havoc in changeCurrentConfig
175 // since it clears the config if a negative index comes in. I'm not sure that is actually
176 // correct, but well easier to fix and understand here right now and the combobox should
177 // be dropped ultimately anyway I guess - or at least not be editable anymore.
178 int newidx = curidx > 0 ? curidx - 1 : 0;
179 ui->currentConfig->setCurrentIndex( newidx );
180 changeCurrentConfig( ui->currentConfig->currentIndex() );
181}
182
183void CustomBuildSystemConfigWidget::verify() {
184 Q_ASSERT( ui->currentConfig->count() == configs.count() );

Callers

nothing calls this directly

Calls 4

removeItemMethod · 0.80
setCurrentIndexMethod · 0.80
currentIndexMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected