forked from qt-creator/qt-creator
QmlDesigner: Add option forceFreeType to qmlproject
This option enforces the usage of FreeType even on Windows for the form editor and live preview. This can be useful when developing for Linux devices. The option can be eanbled by adding 'forceFreeType: true' to the .qmlproject file. Task-number: QDS-1143 Change-Id: I7e749e95584e23202536596ee4f7cdaa09d3a371 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -218,7 +218,21 @@ QProcess *PuppetCreator::puppetProcess(const QString &puppetPath,
|
|||||||
QObject::connect(puppetProcess, SIGNAL(readyRead()), handlerObject, outputSlot);
|
QObject::connect(puppetProcess, SIGNAL(readyRead()), handlerObject, outputSlot);
|
||||||
}
|
}
|
||||||
puppetProcess->setWorkingDirectory(workingDirectory);
|
puppetProcess->setWorkingDirectory(workingDirectory);
|
||||||
puppetProcess->start(puppetPath, {socketToken, puppetMode, "-graphicssystem raster"});
|
|
||||||
|
bool forceFreeType = false;
|
||||||
|
if (Utils::HostOsInfo::isWindowsHost() && m_currentProject && m_currentProject->activeTarget()) {
|
||||||
|
const QVariant customData = m_currentProject->activeTarget()
|
||||||
|
->additionalData("CustomForceFreeType");
|
||||||
|
|
||||||
|
if (customData.isValid())
|
||||||
|
forceFreeType = customData.toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString forceFreeTypeOption;
|
||||||
|
if (forceFreeType)
|
||||||
|
forceFreeTypeOption = "-platform windows:fontengine=freetype";
|
||||||
|
|
||||||
|
puppetProcess->start(puppetPath, {socketToken, puppetMode, "-graphicssystem raster", forceFreeTypeOption });
|
||||||
|
|
||||||
#ifndef QMLDESIGNER_TEST
|
#ifndef QMLDESIGNER_TEST
|
||||||
QString debugPuppet = m_designerSettings.value(DesignerSettingsKey::
|
QString debugPuppet = m_designerSettings.value(DesignerSettingsKey::
|
||||||
|
@@ -93,6 +93,10 @@ QmlProjectItem *QmlProjectFileFormat::parseProjectFile(const Utils::FilePath &fi
|
|||||||
if (fileSelectorsProperty.isValid())
|
if (fileSelectorsProperty.isValid())
|
||||||
projectItem->setFileSelectors(fileSelectorsProperty.toStringList());
|
projectItem->setFileSelectors(fileSelectorsProperty.toStringList());
|
||||||
|
|
||||||
|
const QVariant forceFreeTypeProperty = rootNode->property("forceFreeType");
|
||||||
|
if (forceFreeTypeProperty.isValid())
|
||||||
|
projectItem->setForceFreeType(forceFreeTypeProperty.toBool());
|
||||||
|
|
||||||
const QVariant targetDirectoryPropery = rootNode->property("targetDirectory");
|
const QVariant targetDirectoryPropery = rootNode->property("targetDirectory");
|
||||||
if (targetDirectoryPropery.isValid())
|
if (targetDirectoryPropery.isValid())
|
||||||
projectItem->setTargetDirectory(targetDirectoryPropery.toString());
|
projectItem->setTargetDirectory(targetDirectoryPropery.toString());
|
||||||
|
@@ -97,6 +97,11 @@ bool QmlProjectItem::matchesFile(const QString &filePath) const
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlProjectItem::setForceFreeType(bool b)
|
||||||
|
{
|
||||||
|
m_forceFreeType = b;
|
||||||
|
}
|
||||||
|
|
||||||
Utils::EnvironmentItems QmlProjectItem::environment() const
|
Utils::EnvironmentItems QmlProjectItem::environment() const
|
||||||
{
|
{
|
||||||
return m_environment;
|
return m_environment;
|
||||||
|
@@ -60,6 +60,9 @@ public:
|
|||||||
QStringList files() const;
|
QStringList files() const;
|
||||||
bool matchesFile(const QString &filePath) const;
|
bool matchesFile(const QString &filePath) const;
|
||||||
|
|
||||||
|
bool forceFreeType() const { return m_forceFreeType; };
|
||||||
|
void setForceFreeType(bool);
|
||||||
|
|
||||||
QString mainFile() const { return m_mainFile; }
|
QString mainFile() const { return m_mainFile; }
|
||||||
void setMainFile(const QString &mainFilePath) { m_mainFile = mainFilePath; }
|
void setMainFile(const QString &mainFilePath) { m_mainFile = mainFilePath; }
|
||||||
|
|
||||||
@@ -79,6 +82,7 @@ protected:
|
|||||||
QString m_mainFile;
|
QString m_mainFile;
|
||||||
Utils::EnvironmentItems m_environment;
|
Utils::EnvironmentItems m_environment;
|
||||||
QVector<QmlProjectContentItem *> m_content; // content property
|
QVector<QmlProjectContentItem *> m_content; // content property
|
||||||
|
bool m_forceFreeType = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlProjectManager
|
} // namespace QmlProjectManager
|
||||||
|
@@ -229,6 +229,13 @@ QStringList QmlProject::customFileSelectors() const
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QmlProject::forceFreeType() const
|
||||||
|
{
|
||||||
|
if (m_projectItem)
|
||||||
|
return m_projectItem.data()->forceFreeType();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool QmlProject::addFiles(const QStringList &filePaths)
|
bool QmlProject::addFiles(const QStringList &filePaths)
|
||||||
{
|
{
|
||||||
QStringList toAdd;
|
QStringList toAdd;
|
||||||
@@ -259,6 +266,8 @@ QVariant QmlProject::additionalData(Id id, const Target *) const
|
|||||||
{
|
{
|
||||||
if (id == Constants::customFileSelectorsData)
|
if (id == Constants::customFileSelectorsData)
|
||||||
return customFileSelectors();
|
return customFileSelectors();
|
||||||
|
if (id == Constants::customForceFreeTypeData)
|
||||||
|
return forceFreeType();
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -70,6 +70,7 @@ public:
|
|||||||
Utils::EnvironmentItems environment() const;
|
Utils::EnvironmentItems environment() const;
|
||||||
QStringList customImportPaths() const;
|
QStringList customImportPaths() const;
|
||||||
QStringList customFileSelectors() const;
|
QStringList customFileSelectors() const;
|
||||||
|
bool forceFreeType() const;
|
||||||
|
|
||||||
bool addFiles(const QStringList &filePaths);
|
bool addFiles(const QStringList &filePaths);
|
||||||
|
|
||||||
|
@@ -32,6 +32,7 @@ namespace Constants {
|
|||||||
|
|
||||||
const char * const QMLPROJECT_MIMETYPE = QmlJSTools::Constants::QMLPROJECT_MIMETYPE;
|
const char * const QMLPROJECT_MIMETYPE = QmlJSTools::Constants::QMLPROJECT_MIMETYPE;
|
||||||
const char customFileSelectorsData[] = "CustomFileSelectorsData";
|
const char customFileSelectorsData[] = "CustomFileSelectorsData";
|
||||||
|
const char customForceFreeTypeData[] = "CustomForceFreeType";
|
||||||
|
|
||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
} // namespace QmlProjectManager
|
} // namespace QmlProjectManager
|
||||||
|
@@ -394,6 +394,11 @@ QString QmlProjectRunConfiguration::commandLineArguments() const
|
|||||||
Utils::QtcProcess::addArg(&args, fileSelector, osType);
|
Utils::QtcProcess::addArg(&args, fileSelector, osType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Utils::HostOsInfo::isWindowsHost() && project->forceFreeType()) {
|
||||||
|
Utils::QtcProcess::addArg(&args, "-platform", osType);
|
||||||
|
Utils::QtcProcess::addArg(&args, "windows:fontengine=freetype", osType);
|
||||||
|
}
|
||||||
|
|
||||||
const QString main = project->targetFile(Utils::FilePath::fromString(mainScript()),
|
const QString main = project->targetFile(Utils::FilePath::fromString(mainScript()),
|
||||||
currentTarget).toString();
|
currentTarget).toString();
|
||||||
if (!main.isEmpty())
|
if (!main.isEmpty())
|
||||||
|
Reference in New Issue
Block a user