| 992 | } |
| 993 | |
| 994 | void 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 | |
| 1022 | void SourceFormatterSelectionEdit::selectFormatter(int index) |
| 1023 | { |
nothing calls this directly
no test coverage detected