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

Method selectLanguage

kdevplatform/shell/sourceformatterselectionedit.cpp:994–1020  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

992}
993
994void SourceFormatterSelectionEdit::selectLanguage(int index)
995{
996 Q_D(SourceFormatterSelectionEdit);
997
998 Q_ASSERT(index >= 0);
999 Q_ASSERT(d->ui.cbLanguages->currentIndex() == index);
1000
1001 Q_ASSERT(d->currentLanguagePtr != &d->languageSelectedInUi());
1002 d->currentLanguagePtr = &d->languageSelectedInUi();
1003
1004 {
1005 const QSignalBlocker blocker(d->ui.cbFormatters);
1006 d->ui.cbFormatters->clear();
1007
1008 for (auto* formatter : d->currentLanguage().supportingFormatters()) {
1009 d->ui.cbFormatters->addItem(formatter->formatter().caption(), QVariant::fromValue(formatter));
1010 if (formatter == &d->currentLanguage().selectedFormatter()) {
1011 d->ui.cbFormatters->setCurrentIndex(d->ui.cbFormatters->count() - 1);
1012 }
1013 }
1014 Q_ASSERT_X(&d->currentLanguage().selectedFormatter() == &d->formatterSelectedInUi(), Q_FUNC_INFO,
1015 "The selected formatter is not among the supporting formatters!");
1016 }
1017
1018 d->updateUiForCurrentFormatter();
1019 // Selecting a language does not change configuration => don't emit changed().
1020}
1021
1022void SourceFormatterSelectionEdit::selectFormatter(int index)
1023{

Callers

nothing calls this directly

Calls 7

setCurrentIndexMethod · 0.80
currentIndexMethod · 0.45
clearMethod · 0.45
addItemMethod · 0.45
captionMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected