qmlpreview: add QT_MULTILANGUAGE_DATABASE feature

Change-Id: If6d1d95eb994eea5fe801a3aa5e7343f7764b2a0
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Tim Jenssen
2020-05-20 04:35:18 +02:00
parent 61a63b9449
commit f0bcc1e96a
2 changed files with 7 additions and 1 deletions

View File

@@ -152,7 +152,7 @@ void QmlPreviewPlugin::setZoomFactor(float zoomFactor)
void QmlPreviewPlugin::setLanguageLocale(const QString &locale) void QmlPreviewPlugin::setLanguageLocale(const QString &locale)
{ {
if (s_previewPlugin) if (auto s_previewPlugin = getPreviewPlugin())
s_previewPlugin->setProperty("locale", locale); s_previewPlugin->setProperty("locale", locale);
} }

View File

@@ -151,6 +151,12 @@ LocalQmlPreviewSupport::LocalQmlPreviewSupport(ProjectExplorer::RunControl *runC
runnable.setCommandLine(commandLine); runnable.setCommandLine(commandLine);
} }
if (runControl->project()) {
auto multilanguageDatabaseFilePath = runControl->project()->projectDirectory().pathAppended("/multilanguage-experimental-v1.db");
if (multilanguageDatabaseFilePath.exists())
runnable.environment.set("QT_MULTILANGUAGE_DATABASE", multilanguageDatabaseFilePath.toString());
}
Utils::QtcProcess::addArg(&runnable.commandLineArguments, Utils::QtcProcess::addArg(&runnable.commandLineArguments,
QmlDebug::qmlDebugLocalArguments(QmlDebug::QmlPreviewServices, QmlDebug::qmlDebugLocalArguments(QmlDebug::QmlPreviewServices,
serverUrl.path())); serverUrl.path()));