qmlpreview: enable language combobox

Change-Id: Ie1719d620608b94360a3831d138e1be25bae7b10
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Tim Jenssen
2021-10-20 22:50:38 +02:00
parent d2ff57309b
commit bf7cc1fa02

View File

@@ -217,14 +217,13 @@ SwitchLanguageComboboxAction::SwitchLanguageComboboxAction(QObject *parent)
QWidget *SwitchLanguageComboboxAction::createWidget(QWidget *parent) QWidget *SwitchLanguageComboboxAction::createWidget(QWidget *parent)
{ {
QPointer<QComboBox> comboBox = new QComboBox(parent); QPointer<QComboBox> comboBox = new QComboBox(parent);
// FIXME: this combobox does not work at the moment
comboBox->setDisabled(true);
const QString toolTip(tr("Switch the language used by preview.")); const QString toolTip(tr("Switch the language used by preview."));
comboBox->setToolTip(toolTip); comboBox->setToolTip(toolTip);
comboBox->addItem(tr("Default")); comboBox->addItem(tr("Default"));
auto refreshComboBoxFunction = [this, comboBox, toolTip] (ProjectExplorer::Project *project) { auto refreshComboBoxFunction = [this, comboBox, toolTip] (ProjectExplorer::Project *project) {
if (comboBox && project) { if (comboBox && project) {
comboBox->setDisabled(true);
QString errorMessage; QString errorMessage;
auto locales = project->availableQmlPreviewTranslations(&errorMessage); auto locales = project->availableQmlPreviewTranslations(&errorMessage);
if (!errorMessage.isEmpty()) if (!errorMessage.isEmpty())
@@ -234,6 +233,7 @@ QWidget *SwitchLanguageComboboxAction::createWidget(QWidget *parent)
comboBox->addItem(tr("Default")); comboBox->addItem(tr("Default"));
comboBox->addItems(locales); comboBox->addItems(locales);
m_previousLocales = locales; m_previousLocales = locales;
comboBox->setEnabled(true);
} }
} }
}; };