Merge "Merge remote-tracking branch 'origin/5.0'"

This commit is contained in:
The Qt Project
2021-09-20 11:51:42 +00:00
152 changed files with 1191 additions and 1506 deletions

View File

@@ -562,7 +562,7 @@ static const char* windowsMessageString(int messageId)
this,
&FloatingDockContainer::close);
#else
setWindowFlags(Qt::Window | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint);
setWindowFlags(Qt::Window | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint | Qt::Tool);
QBoxLayout *boxLayout = new QBoxLayout(QBoxLayout::TopToBottom);
boxLayout->setContentsMargins(0, 0, 0, 0);
boxLayout->setSpacing(0);

View File

@@ -154,7 +154,7 @@ void ProcessReaper::reap(QProcess *process, int timeoutMs)
if (!process)
return;
QTC_ASSERT(QThread::currentThread() == process->thread(), return);
QTC_ASSERT(QThread::currentThread() == process->thread(), return );
process->disconnect();
if (process->state() == QProcess::NotRunning) {

View File

@@ -551,13 +551,13 @@ bool AndroidBuildApkStep::init()
}
m_openPackageLocationForRun = m_openPackageLocation;
const FilePath outputDir = AndroidManager::androidBuildDirectory(target());
if (m_buildAAB) {
const QString bt = buildType() == BuildConfiguration::Release ? QLatin1String("release")
: QLatin1String("debug");
m_packagePath = buildDirectory()
.pathAppended(Constants::ANDROID_BUILDDIRECTORY)
.pathAppended(QString("build/outputs/bundle/%1/android-build-%1.aab").arg(bt));
m_packagePath = outputDir.pathAppended(
QString("build/outputs/bundle/%1/android-build-%1.aab").arg(bt));
} else {
m_packagePath = AndroidManager::apkPath(target());
}
@@ -565,7 +565,6 @@ bool AndroidBuildApkStep::init()
qCDebug(buildapkstepLog) << "APK or AAB path:" << m_packagePath;
FilePath command = version->hostBinPath().pathAppended("androiddeployqt").withExecutableSuffix();
FilePath outputDir = buildDirectory().pathAppended(Constants::ANDROID_BUILDDIRECTORY);
m_inputFile = AndroidQtVersion::androidDeploymentSettings(target());
if (m_inputFile.isEmpty()) {
@@ -641,7 +640,7 @@ void AndroidBuildApkStep::setupOutputFormatter(OutputFormatter *formatter)
if (node)
sourceDirPath = FilePath::fromVariant(node->data(Constants::AndroidPackageSourceDir));
parser->setSourceDirectory(sourceDirPath.canonicalPath());
parser->setBuildDirectory(buildDirectory().pathAppended(Constants::ANDROID_BUILDDIRECTORY));
parser->setBuildDirectory(AndroidManager::androidBuildDirectory(target()));
formatter->addLineParser(parser);
AbstractProcessStep::setupOutputFormatter(formatter);
}
@@ -747,8 +746,10 @@ void AndroidBuildApkStep::doRun()
if (!version)
return false;
const FilePath buildDir = buildDirectory();
const FilePath androidBuildDir = AndroidManager::androidBuildDirectory(target());
for (const auto &abi : androidAbis) {
FilePath androidLibsDir = buildDirectory() / "android-build/libs" / abi;
FilePath androidLibsDir = androidBuildDir / "libs" / abi;
if (!androidLibsDir.exists()) {
if (!androidLibsDir.ensureWritableDir()) {
const QString error = tr("The Android build folder %1 wasn't found and "
@@ -762,7 +763,7 @@ void AndroidBuildApkStep::doRun()
// and now it's made directly with ALL target, so this code below ensures
// these versions are not broken.
const QString fileName = QString("lib%1_%2.so").arg(buildKey, abi);
const FilePath from = buildDirectory() / fileName;
const FilePath from = buildDir / fileName;
const FilePath to = androidLibsDir / fileName;
if (!from.exists() || to.exists())
continue;
@@ -795,7 +796,7 @@ void AndroidBuildApkStep::doRun()
if (!version->supportsMultipleQtAbis()) {
QTC_ASSERT(androidAbis.size() == 1, return false);
applicationBinary = buildSystem()->buildTarget(buildKey).targetFilePath.toString();
FilePath androidLibsDir = buildDirectory() / "android-build/libs" / androidAbis.first();
FilePath androidLibsDir = androidBuildDir / "libs" / androidAbis.first();
for (const FilePath &target : targets) {
if (!copyFileIfNewer(target, androidLibsDir.pathAppended(target.fileName())))
return false;
@@ -813,7 +814,7 @@ void AndroidBuildApkStep::doRun()
applicationBinary.remove(0, 3).chop(targetSuffix.size());
}
FilePath androidLibsDir = buildDirectory() / "android-build/libs" / abi;
FilePath androidLibsDir = androidBuildDir / "libs" / abi;
for (const FilePath &target : targets) {
if (target.endsWith(targetSuffix)) {
if (!copyFileIfNewer(target, androidLibsDir.pathAppended(target.fileName())))

View File

@@ -58,7 +58,7 @@ const char ANDROID_MANIFEST_EDITOR_CONTEXT[] = "Android.AndroidManifestEditor.Id
const char ANDROID_KIT_NDK[] = "Android.NDK";
const char ANDROID_KIT_SDK[] = "Android.SDK";
const char ANDROID_BUILDDIRECTORY[] = "android-build";
const char ANDROID_BUILD_DIRECTORY[] = "android-build";
const char JAVA_EDITOR_ID[] = "java.editor";
const char JLS_SETTINGS_ID[] = "Java::JLSSettingsID";
const char JAVA_MIMETYPE[] = "text/x-java";

View File

@@ -139,11 +139,16 @@ void AndroidDebugSupport::start()
if (qtVersion)
solibSearchPath.append(qtVersion->qtSoPaths());
solibSearchPath.append(uniquePaths(extraLibs));
solibSearchPath.append(runControl()->buildDirectory().toString());
const RunConfiguration *activeRunConfig = target->activeRunConfiguration();
FilePath buildDir;
if (activeRunConfig)
buildDir = activeRunConfig->buildTargetInfo().workingDirectory;
solibSearchPath.append(buildDir.toString());
solibSearchPath.removeDuplicates();
setSolibSearchPath(solibSearchPath);
qCDebug(androidDebugSupportLog) << "SoLibSearchPath: "<<solibSearchPath;
setSymbolFile(runControl()->buildDirectory().pathAppended("app_process"));
setSymbolFile(buildDir.pathAppended("app_process"));
setSkipExecutableValidation(true);
setUseExtendedRemote(true);
QString devicePreferredAbi = AndroidManager::apkDevicePreferredAbi(target);

View File

@@ -188,7 +188,6 @@ bool AndroidDeployQtStep::init()
m_manifestName = AndroidManager::manifestPath(target());
m_useAndroiddeployqt = version->qtVersion() >= QtSupport::QtVersionNumber(5, 4, 0);
if (m_useAndroiddeployqt) {
const QString buildKey = target()->activeBuildKey();
const ProjectNode *node = target()->project()->findNodeForBuildKey(buildKey);
@@ -216,7 +215,7 @@ bool AndroidDeployQtStep::init()
}
m_command = m_command.pathAppended("androiddeployqt").withExecutableSuffix();
m_workingDirectory = bc->buildDirectory().pathAppended(Constants::ANDROID_BUILDDIRECTORY);
m_workingDirectory = AndroidManager::androidBuildDirectory(target());
m_androiddeployqtArgs.addArgs({"--verbose",
"--output", m_workingDirectory.toString(),
@@ -237,7 +236,7 @@ bool AndroidDeployQtStep::init()
m_uninstallPreviousPackageRun = true;
m_command = AndroidConfigurations::currentConfig().adbToolPath();
m_apkPath = AndroidManager::apkPath(target());
m_workingDirectory = bc ? bc->buildDirectory() : FilePath();
m_workingDirectory = bc ? AndroidManager::buildDirectory(target()): FilePath();
}
m_environment = bc ? bc->environment() : Utils::Environment();
@@ -444,9 +443,8 @@ bool AndroidDeployQtStep::runImpl()
void AndroidDeployQtStep::gatherFilesToPull()
{
m_filesToPull.clear();
BuildConfiguration *bc = target()->activeBuildConfiguration();
QString buildDir = bc ? bc->buildDirectory().toString() : QString();
if (bc && !buildDir.endsWith("/")) {
QString buildDir = AndroidManager::buildDirectory(target()).toString();
if (!buildDir.endsWith("/")) {
buildDir += "/";
}

View File

@@ -47,9 +47,13 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/session.h>
#include <projectexplorer/target.h>
#include <projectexplorer/buildsystem.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtsupportconstants.h>
#include <qtsupport/baseqtversion.h>
#include <cmakeprojectmanager/cmakeprojectconstants.h>
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
@@ -242,8 +246,37 @@ bool AndroidManager::isQtCreatorGenerated(const FilePath &deploymentFile)
FilePath AndroidManager::dirPath(const Target *target)
{
if (auto *bc = target->activeBuildConfiguration())
return bc->buildDirectory() / Constants::ANDROID_BUILDDIRECTORY;
return androidBuildDirectory(target);
}
FilePath AndroidManager::androidBuildDirectory(const Target *target)
{
return buildDirectory(target) / Constants::ANDROID_BUILD_DIRECTORY;
}
bool AndroidManager::isQt5CmakeProject(const ProjectExplorer::Target *target)
{
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(target->kit());
const bool isQt5 = qt && qt->qtVersion() < QtSupport::QtVersionNumber{6, 0, 0};
const Core::Context cmakeCtx = Core::Context(CMakeProjectManager::Constants::CMAKE_PROJECT_ID);
const bool isCmakeProject = (target->project()->projectContext() == cmakeCtx);
return isQt5 && isCmakeProject;
}
FilePath AndroidManager::buildDirectory(const Target *target)
{
if (const BuildSystem *bs = target->buildSystem()) {
const QString buildKey = target->activeBuildKey();
const FilePath buildDir = bs->buildTarget(target->activeBuildKey()).workingDirectory;
if (isQt5CmakeProject(target)) {
// Return the main build dir and not the android libs dir
const QString libsDir = QString(Constants::ANDROID_BUILD_DIRECTORY) + "/libs";
Utils::FilePath parentDuildDir = buildDir.parentDir();
if (parentDuildDir.endsWith(libsDir) || libsDir.endsWith(libsDir + "/"))
return parentDuildDir.parentDir().parentDir();
}
return buildDir;
}
return {};
}
@@ -264,7 +297,7 @@ FilePath AndroidManager::apkPath(const Target *target)
else
apkPath += QLatin1String("debug.apk");
return dirPath(target) / apkPath;
return androidBuildDirectory(target) / apkPath;
}
bool AndroidManager::matchedAbis(const QStringList &deviceAbis, const QStringList &appAbis)
@@ -339,7 +372,7 @@ FilePath AndroidManager::manifestPath(const Target *target)
QVariant manifest = target->namedSettings(AndroidManifestName);
if (manifest.isValid())
return manifest.value<FilePath>();
return dirPath(target).pathAppended(AndroidManifestName);
return androidBuildDirectory(target).pathAppended(AndroidManifestName);
}
void AndroidManager::setManifestPath(Target *target, const FilePath &path)
@@ -371,7 +404,7 @@ static QString preferredAbi(const QStringList &appAbis, const Target *target)
QString AndroidManager::apkDevicePreferredAbi(const Target *target)
{
auto libsPath = dirPath(target).pathAppended("libs");
auto libsPath = androidBuildDirectory(target).pathAppended("libs");
if (!libsPath.exists()) {
if (const ProjectNode *node = currentProjectNode(target))
return preferredAbi(node->data(Android::Constants::ANDROID_ABIS).toStringList(),

View File

@@ -93,7 +93,12 @@ public:
static QStringList applicationAbis(const ProjectExplorer::Target *target);
static QString archTriplet(const QString &abi);
static bool isQt5CmakeProject(const ProjectExplorer::Target *target);
// TODO: remove this on 6.0 branch, kept here for binary compatibility for 5.0 release.
static Utils::FilePath dirPath(const ProjectExplorer::Target *target);
static Utils::FilePath androidBuildDirectory(const ProjectExplorer::Target *target);
static Utils::FilePath buildDirectory(const ProjectExplorer::Target *target);
static Utils::FilePath manifestPath(const ProjectExplorer::Target *target);
static void setManifestPath(ProjectExplorer::Target *target, const Utils::FilePath &path);
static Utils::FilePath manifestSourcePath(const ProjectExplorer::Target *target);

View File

@@ -38,6 +38,7 @@
#include <projectexplorer/target.h>
#include <projectexplorer/taskhub.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/buildsystem.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtkitinformation.h>
@@ -67,6 +68,9 @@ public:
QString nativeAndroidBuildPath() const;
Utils::FilePath androidBuildDirectory() const;
Utils::FilePath buildDirectory() const;
private:
bool init() final;
void setupOutputFormatter(OutputFormatter *formatter) final;
@@ -103,6 +107,8 @@ bool AndroidPackageInstallationStep::init()
cmd.addArgs(outerQuoted + " install", CommandLine::Raw);
processParameters()->setCommandLine(cmd);
// This is useful when running an example target from a Qt module project.
processParameters()->setWorkingDirectory(buildDirectory());
m_androidDirsToClean.clear();
// don't remove gradle's cache, it takes ages to rebuild it.
@@ -114,7 +120,7 @@ bool AndroidPackageInstallationStep::init()
QString AndroidPackageInstallationStep::nativeAndroidBuildPath() const
{
QString buildPath = buildDirectory().pathAppended(Constants::ANDROID_BUILDDIRECTORY).toString();
QString buildPath = androidBuildDirectory().toString();
if (HostOsInfo::isWindowsHost())
if (buildEnvironment().searchInPath("sh.exe").isEmpty())
buildPath = QDir::toNativeSeparators(buildPath);
@@ -122,6 +128,18 @@ QString AndroidPackageInstallationStep::nativeAndroidBuildPath() const
return buildPath;
}
FilePath AndroidPackageInstallationStep::androidBuildDirectory() const
{
return buildDirectory() / Constants::ANDROID_BUILD_DIRECTORY;
}
FilePath AndroidPackageInstallationStep::buildDirectory() const
{
if (const BuildSystem *bs = buildSystem())
return buildSystem()->buildTarget(target()->activeBuildKey()).workingDirectory;
return {};
}
void AndroidPackageInstallationStep::setupOutputFormatter(OutputFormatter *formatter)
{
formatter->addLineParser(new GnuMakeParser);

View File

@@ -42,6 +42,7 @@
#include <projectexplorer/kit.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projecttree.h>
#include <projectexplorer/buildsystem.h>
#include <proparser/profileevaluator.h>
@@ -172,19 +173,24 @@ int AndroidQtVersion::minimumNDK() const
Utils::FilePath AndroidQtVersion::androidDeploymentSettings(const Target *target)
{
// Try to fetch the file name from node data as provided by qmake and Qbs
const QString buildKey = target->activeBuildKey();
QString buildKey = target->activeBuildKey();
const ProjectNode *node = target->project()->findNodeForBuildKey(buildKey);
if (node) {
const QString nameFromData = node->data(Constants::AndroidDeploySettingsFile).toString();
if (!nameFromData.isEmpty())
return Utils::FilePath::fromUserInput(nameFromData);
}
// If unavailable, construct the name by ourselves (CMake)
const BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(target->kit());
const bool isQt6 = qt && qt->qtVersion() >= QtSupport::QtVersionNumber{6, 0, 0};
return target->activeBuildConfiguration()->buildDirectory().pathAppended(
isQt6 ? QString::fromLatin1("android-%1-deployment-settings.json").arg(buildKey)
: QLatin1String("android_deployment_settings.json"));
const BuildSystem *bs = target->buildSystem();
if (!bs)
return {};
const QString displayName = bs->buildTarget(buildKey).displayName;
return AndroidManager::buildDirectory(target).pathAppended(
AndroidManager::isQt5CmakeProject(target)
? QLatin1String("android_deployment_settings.json")
: QString::fromLatin1("android-%1-deployment-settings.json")
.arg(displayName));
}
void AndroidQtVersion::parseMkSpec(ProFileEvaluator *evaluator) const

View File

@@ -1,7 +1,11 @@
#include <QtCore>
#include <QtGui>
#ifdef QT_MULTIMEDIA_LIB
#include <QtMultimedia>
#endif
#ifdef QT_MULTIMEDIAWIDGETS_LIB
#include <QtMultimediaWidgets>
#endif
#include <QtNetwork>
#include <QtQml>
#include <QtQuick>

View File

@@ -1,12 +1,18 @@
QT += multimedia \
multimediawidgets \
network \
QT += network \
qml \
quick \
sql \
testlib \
widgets
qtHaveModule(multimedia) {
QT += multimedia
}
qtHaveModule(multimediawidgets) {
QT += multimediawidgets
}
TARGET = qt-essential-includes
TEMPLATE = app
SOURCES += main.cpp

View File

@@ -6,8 +6,6 @@ QtApplication {
Depends {
name: "Qt"
submodules: [
"multimedia",
"multimediawidgets",
"network",
"qml",
"quick",
@@ -17,6 +15,9 @@ QtApplication {
]
}
Depends { name: "Qt.multimedia"; required: false }
Depends { name: "Qt.multimediawidgets"; required: false }
files : [
"main.cpp",
]

View File

@@ -1186,7 +1186,7 @@ QmakeProFile::~QmakeProFile()
m_parseFutureWatcher->cancel();
m_parseFutureWatcher->waitForFinished();
if (m_readerExact)
applyAsyncEvaluate();
applyAsyncEvaluate(false);
delete m_parseFutureWatcher;
}
cleanupProFileReaders();
@@ -1195,8 +1195,9 @@ QmakeProFile::~QmakeProFile()
void QmakeProFile::setupFutureWatcher()
{
m_parseFutureWatcher = new QFutureWatcher<Internal::QmakeEvalResult *>;
QObject::connect(m_parseFutureWatcher, &QFutureWatcherBase::finished,
[this](){ applyAsyncEvaluate(); });
QObject::connect(m_parseFutureWatcher, &QFutureWatcherBase::finished, [this]() {
applyAsyncEvaluate(true);
});
}
bool QmakeProFile::isParent(QmakeProFile *node)
@@ -1640,9 +1641,9 @@ void QmakeProFile::asyncEvaluate(QFutureInterface<QmakeEvalResult *> &fi, QmakeE
fi.reportResult(evalResult);
}
void QmakeProFile::applyAsyncEvaluate()
void QmakeProFile::applyAsyncEvaluate(bool apply)
{
if (m_parseFutureWatcher->isFinished())
if (apply)
applyEvaluate(m_parseFutureWatcher->result());
m_buildSystem->decrementPendingEvaluateFutures();
}

View File

@@ -352,7 +352,7 @@ private:
void setParseInProgress(bool b);
void setValidParseRecursive(bool b);
void applyAsyncEvaluate();
void applyAsyncEvaluate(bool apply);
void setupReader();
Internal::QmakeEvalInput evalInput() const;

View File

@@ -165,7 +165,7 @@ void PropertyEditorView::changeValue(const QString &name)
m_locked = false;
QString errMsg = QmlDesigner::ModelNode::getIdValidityErrorMessage(newId);
if (!errMsg.isEmpty())
Core::AsynchronousMessageBox::warning(tr("Invalid ID"), errMsg.arg(newId));
Core::AsynchronousMessageBox::warning(tr("Invalid ID"), errMsg);
else
Core::AsynchronousMessageBox::warning(tr("Invalid ID"), tr("%1 already exists.").arg(newId));
}

View File

@@ -41,7 +41,7 @@ bool ImageCacheConnectionManager::waitForCapturedData()
disconnect(connections().front().socket.get(), &QIODevice::readyRead, nullptr, nullptr);
while (!m_capturedDataArrived) {
bool dataArrived = connections().front().socket->waitForReadyRead(600000);
bool dataArrived = connections().front().socket->waitForReadyRead(10000);
if (!dataArrived)
return false;

View File

@@ -218,21 +218,21 @@ QString ModelNode::getIdValidityErrorMessage(const QString &id)
return {}; // valid
if (id.at(0).isUpper())
return QObject::tr("ID cannot start with an uppercase character.");
return QObject::tr("ID cannot start with an uppercase character (%1).").arg(id);
if (id.at(0).isDigit())
return QObject::tr("ID cannot start with a number.");
return QObject::tr("ID cannot start with a number (%1).").arg(id);
if (id.contains(' '))
return QObject::tr("ID cannot include whitespace.");
return QObject::tr("ID cannot include whitespace (%1).").arg(id);
if (idIsQmlKeyWord(id))
return QObject::tr("%1 is a reserved QML keyword.");
return QObject::tr("%1 is a reserved QML keyword.").arg(id);
if (isIdToAvoid(id))
return QObject::tr("%1 is a reserved property keyword.");
return QObject::tr("%1 is a reserved property keyword.").arg(id);
return QObject::tr("ID includes invalid characters.");
return QObject::tr("ID includes invalid characters (%1).").arg(id);
}
bool ModelNode::hasId() const

View File

@@ -456,11 +456,13 @@ WelcomeMode::WelcomeMode()
setWidget(m_modeWidget);
QStringList designStudioQchPathes = {Core::HelpManager::documentationPath()
+ "/qtdesignstudio.qch",
Core::HelpManager::documentationPath() + "/qtquick.qch",
Core::HelpManager::documentationPath()
+ "/qtquickcontrols.qch"};
QStringList designStudioQchPathes
= {Core::HelpManager::documentationPath() + "/qtdesignstudio.qch",
Core::HelpManager::documentationPath() + "/qtquick.qch",
Core::HelpManager::documentationPath() + "/qtquickcontrols.qch",
Core::HelpManager::documentationPath() + "/qtquicktimeline.qch",
Core::HelpManager::documentationPath() + "/qtquick3d.qch",
Core::HelpManager::documentationPath() + "/qtqml.qch"};
Core::HelpManager::registerDocumentation(
Utils::filtered(designStudioQchPathes,

View File

@@ -175,7 +175,7 @@ public:
: QWidget(parent), m_iconSource(iconSource), m_title(title), m_openUrl(openUrl)
{
setAutoFillBackground(true);
setMinimumHeight(30);
setMinimumHeight(35);
setToolTip(m_openUrl);
const QString fileName = QString(":/welcome/images/%1.png").arg(iconSource);
@@ -289,7 +289,6 @@ public:
{
auto l = new QVBoxLayout;
l->setContentsMargins(0, 0, 0, 0);
l->setSpacing(5);
l->addWidget(new IconAndLink("download", tr("Get Qt"), "https://www.qt.io/download", this));
l->addWidget(new IconAndLink("qtaccount", tr("Qt Account"), "https://account.qt.io", this));
l->addWidget(new IconAndLink("community", tr("Online Community"), "https://forum.qt.io", this));