forked from qt-creator/qt-creator
QmlDesigner: Fix qbs build and building with Qt6.2
Change-Id: Ic114c9eb830eed5cf0bef890007408694453791e Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -178,15 +178,15 @@ void StudioSettingsPage::apply()
|
|||||||
QSettings *s = Core::ICore::settings();
|
QSettings *s = Core::ICore::settings();
|
||||||
const QString value = m_pathChooserExamples->filePath().toString();
|
const QString value = m_pathChooserExamples->filePath().toString();
|
||||||
|
|
||||||
if (s->value(Paths::exampleDownloadPath, false).toString() != value) {
|
if (s->value(Paths::exampleDownloadPath.toString(), false).toString() != value) {
|
||||||
s->setValue(Paths::exampleDownloadPath, value);
|
s->setValue(Paths::exampleDownloadPath.toString(), value);
|
||||||
emit examplesDownloadPathChanged(value);
|
emit examplesDownloadPathChanged(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString bundlesPath = m_pathChooserBundles->filePath().toString();
|
const QString bundlesPath = m_pathChooserBundles->filePath().toString();
|
||||||
|
|
||||||
if (s->value(Paths::bundlesDownloadPath).toString() != bundlesPath) {
|
if (s->value(Paths::bundlesDownloadPath.toString()).toString() != bundlesPath) {
|
||||||
s->setValue(Paths::bundlesDownloadPath, bundlesPath);
|
s->setValue(Paths::bundlesDownloadPath.toString(), bundlesPath);
|
||||||
emit bundlesDownloadPathChanged(bundlesPath);
|
emit bundlesDownloadPathChanged(bundlesPath);
|
||||||
|
|
||||||
const QString restartText = tr("Changing bundle path will take effect after restart.");
|
const QString restartText = tr("Changing bundle path will take effect after restart.");
|
||||||
|
|||||||
@@ -31,14 +31,14 @@ Utils::FilePath defaultBundlesPath()
|
|||||||
QString examplesPathSetting()
|
QString examplesPathSetting()
|
||||||
{
|
{
|
||||||
return Core::ICore::settings()
|
return Core::ICore::settings()
|
||||||
->value(exampleDownloadPath, defaultExamplesPath().toString())
|
->value(exampleDownloadPath.toString(), defaultExamplesPath().toString())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString bundlesPathSetting()
|
QString bundlesPathSetting()
|
||||||
{
|
{
|
||||||
return Core::ICore::settings()
|
return Core::ICore::settings()
|
||||||
->value(bundlesDownloadPath, defaultBundlesPath().toString())
|
->value(bundlesDownloadPath.toString(), defaultBundlesPath().toString())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,8 @@
|
|||||||
|
|
||||||
#include "texteditor/textdocument.h"
|
#include "texteditor/textdocument.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
namespace QmlProjectManager {
|
namespace QmlProjectManager {
|
||||||
|
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ bool QmlProject::allowOnlySingleProject()
|
|||||||
{
|
{
|
||||||
QSettings *settings = Core::ICore::settings();
|
QSettings *settings = Core::ICore::settings();
|
||||||
auto key = "QML/Designer/AllowMultipleProjects";
|
auto key = "QML/Designer/AllowMultipleProjects";
|
||||||
return !settings->value(key, false).toBool();
|
return !settings->value(QString::fromUtf8(key), false).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace QmlProjectManager
|
} // namespace QmlProjectManager
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ QtcAutotest {
|
|||||||
name: "Files from QmlProjectManager"
|
name: "Files from QmlProjectManager"
|
||||||
prefix: product.fileFormatDir + '/'
|
prefix: product.fileFormatDir + '/'
|
||||||
files: [
|
files: [
|
||||||
|
"converters.cpp",
|
||||||
|
"converters.h",
|
||||||
"filefilteritems.cpp",
|
"filefilteritems.cpp",
|
||||||
"filefilteritems.h",
|
"filefilteritems.h",
|
||||||
"qmlprojectitem.cpp",
|
"qmlprojectitem.cpp",
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
#include "qmlprojectitem.h"
|
#include "qmlprojectitem.h"
|
||||||
#include "filefilteritems.h"
|
|
||||||
#include "qmlprojectfileformat.h"
|
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
@@ -43,29 +41,27 @@ tst_FileFormat::tst_FileFormat()
|
|||||||
const QString testDataDir = QLatin1String(SRCDIR "/data");
|
const QString testDataDir = QLatin1String(SRCDIR "/data");
|
||||||
const FilePath testDataDirPath = FilePath::fromString(testDataDir);
|
const FilePath testDataDirPath = FilePath::fromString(testDataDir);
|
||||||
|
|
||||||
static std::unique_ptr<QmlProjectItem> loadQmlProject(QString name, QString *error)
|
static std::unique_ptr<QmlProjectItem> loadQmlProject(QString name)
|
||||||
{
|
{
|
||||||
return QmlProjectFileFormat::parseProjectFile(
|
return std::unique_ptr<QmlProjectItem>(new QmlProjectItem(
|
||||||
Utils::FilePath::fromString(testDataDir).pathAppended(name + ".qmlproject"), error);
|
testDataDirPath.pathAppended(name + ".qmlproject")));
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_FileFormat::testFileFilter()
|
void tst_FileFormat::testFileFilter()
|
||||||
{
|
{
|
||||||
QString error;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Search for qml files in directory + subdirectories
|
// Search for qml files in directory + subdirectories
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
auto project = loadQmlProject(QLatin1String("testFileFilter1"), &error);
|
auto project = loadQmlProject(QLatin1String("testFileFilter1"));
|
||||||
QVERIFY(project);
|
QVERIFY(project);
|
||||||
QVERIFY(error.isEmpty());
|
QVERIFY(!project->project().isEmpty());
|
||||||
|
|
||||||
project->setSourceDirectory(testDataDirPath);
|
FilePaths expectedFiles{
|
||||||
|
testDataDirPath / "file1.qml",
|
||||||
QStringList expectedFiles(QStringList() << testDataDir + "/file1.qml"
|
testDataDirPath / "file2.qml",
|
||||||
<< testDataDir + "/file2.qml"
|
testDataDirPath / "subdir/file3.qml"
|
||||||
<< testDataDir + "/subdir/file3.qml");
|
};
|
||||||
COMPARE_AS_SETS(project->files(), expectedFiles);
|
COMPARE_AS_SETS(project->files(), expectedFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,14 +69,11 @@ void tst_FileFormat::testFileFilter()
|
|||||||
// search for all qml files in directory
|
// search for all qml files in directory
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
auto project = loadQmlProject(QLatin1String("testFileFilter2"), &error);
|
auto project = loadQmlProject(QLatin1String("testFileFilter2"));
|
||||||
QVERIFY(project);
|
QVERIFY(project);
|
||||||
QVERIFY(error.isEmpty());
|
QVERIFY(!project->project().isEmpty());
|
||||||
|
|
||||||
project->setSourceDirectory(testDataDirPath);
|
FilePaths expectedFiles{ testDataDirPath / "file1.qml", testDataDirPath / "file2.qml" };
|
||||||
|
|
||||||
QStringList expectedFiles(QStringList() << testDataDir + "/file1.qml"
|
|
||||||
<< testDataDir + "/file2.qml");
|
|
||||||
COMPARE_AS_SETS(project->files(), expectedFiles);
|
COMPARE_AS_SETS(project->files(), expectedFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,13 +81,11 @@ void tst_FileFormat::testFileFilter()
|
|||||||
// search for all qml files in subdirectory
|
// search for all qml files in subdirectory
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
auto project = loadQmlProject(QLatin1String("testFileFilter3"), &error);
|
auto project = loadQmlProject(QLatin1String("testFileFilter3"));
|
||||||
QVERIFY(project);
|
QVERIFY(project);
|
||||||
QVERIFY(error.isEmpty());
|
QVERIFY(!project->project().isEmpty());
|
||||||
|
|
||||||
project->setSourceDirectory(testDataDirPath);
|
FilePaths expectedFiles{ testDataDirPath / "subdir/file3.qml" };
|
||||||
|
|
||||||
QStringList expectedFiles(QStringList() << testDataDir + "/subdir/file3.qml");
|
|
||||||
COMPARE_AS_SETS(project->files(), expectedFiles);
|
COMPARE_AS_SETS(project->files(), expectedFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,15 +93,15 @@ void tst_FileFormat::testFileFilter()
|
|||||||
// multiple entries
|
// multiple entries
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
auto project = loadQmlProject(QLatin1String("testFileFilter4"), &error);
|
auto project = loadQmlProject(QLatin1String("testFileFilter4"));
|
||||||
QVERIFY(project);
|
QVERIFY(project);
|
||||||
QVERIFY(error.isEmpty());
|
QVERIFY(!project->project().isEmpty());
|
||||||
|
|
||||||
project->setSourceDirectory(testDataDirPath);
|
FilePaths expectedFiles{
|
||||||
|
testDataDirPath / "file1.qml",
|
||||||
QStringList expectedFiles(QStringList() << testDataDir + "/file1.qml"
|
testDataDirPath / "file2.qml",
|
||||||
<< testDataDir + "/file2.qml"
|
testDataDirPath / "/subdir/file3.qml"
|
||||||
<< testDataDir + "/subdir/file3.qml");
|
};
|
||||||
QCOMPARE(project->files().size(), 3);
|
QCOMPARE(project->files().size(), 3);
|
||||||
COMPARE_AS_SETS(project->files(), expectedFiles);
|
COMPARE_AS_SETS(project->files(), expectedFiles);
|
||||||
}
|
}
|
||||||
@@ -119,14 +110,11 @@ void tst_FileFormat::testFileFilter()
|
|||||||
// include specific list
|
// include specific list
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
auto project = loadQmlProject(QLatin1String("testFileFilter5"), &error);
|
auto project = loadQmlProject(QLatin1String("testFileFilter5"));
|
||||||
QVERIFY(project);
|
QVERIFY(project);
|
||||||
QVERIFY(error.isEmpty());
|
QVERIFY(!project->project().isEmpty());
|
||||||
|
|
||||||
project->setSourceDirectory(testDataDirPath);
|
FilePaths expectedFiles{ testDataDirPath / "file1.qml", testDataDirPath / "file2.qml" };
|
||||||
|
|
||||||
QStringList expectedFiles(QStringList() << testDataDir + "/file1.qml"
|
|
||||||
<< testDataDir + "/file2.qml");
|
|
||||||
COMPARE_AS_SETS(project->files(), expectedFiles);
|
COMPARE_AS_SETS(project->files(), expectedFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,13 +122,11 @@ void tst_FileFormat::testFileFilter()
|
|||||||
// include specific list
|
// include specific list
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
auto project = loadQmlProject(QLatin1String("testFileFilter6"), &error);
|
auto project = loadQmlProject(QLatin1String("testFileFilter6"));
|
||||||
QVERIFY(project);
|
QVERIFY(project);
|
||||||
QVERIFY(error.isEmpty());
|
QVERIFY(!project->project().isEmpty());
|
||||||
|
|
||||||
project->setSourceDirectory(testDataDirPath);
|
FilePaths expectedFiles{ testDataDirPath / "image.gif" };
|
||||||
|
|
||||||
QStringList expectedFiles(QStringList() << testDataDir + "/image.gif");
|
|
||||||
COMPARE_AS_SETS(project->files(), expectedFiles);
|
COMPARE_AS_SETS(project->files(), expectedFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,13 +134,11 @@ void tst_FileFormat::testFileFilter()
|
|||||||
// use wildcards
|
// use wildcards
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
auto project = loadQmlProject(QLatin1String("testFileFilter7"), &error);
|
auto project = loadQmlProject(QLatin1String("testFileFilter7"));
|
||||||
QVERIFY(project);
|
QVERIFY(project);
|
||||||
QVERIFY(error.isEmpty());
|
QVERIFY(!project->project().isEmpty());
|
||||||
|
|
||||||
project->setSourceDirectory(testDataDirPath);
|
FilePaths expectedFiles{ testDataDirPath / "image.gif" };
|
||||||
|
|
||||||
QStringList expectedFiles(QStringList() << testDataDir + "/image.gif");
|
|
||||||
COMPARE_AS_SETS(project->files(), expectedFiles);
|
COMPARE_AS_SETS(project->files(), expectedFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,28 +146,23 @@ void tst_FileFormat::testFileFilter()
|
|||||||
// use Files element (1.1)
|
// use Files element (1.1)
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
auto project = loadQmlProject(QLatin1String("testFileFilter8"), &error);
|
auto project = loadQmlProject(QLatin1String("testFileFilter8"));
|
||||||
QVERIFY(project);
|
QVERIFY(project);
|
||||||
QVERIFY(error.isEmpty());
|
QVERIFY(!project->project().isEmpty());
|
||||||
|
|
||||||
project->setSourceDirectory(testDataDirPath);
|
FilePaths expectedFiles{ testDataDirPath / "image.gif" };
|
||||||
|
|
||||||
QStringList expectedFiles(QStringList() << testDataDir + "/image.gif");
|
|
||||||
COMPARE_AS_SETS(project->files(), expectedFiles);
|
COMPARE_AS_SETS(project->files(), expectedFiles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_FileFormat::testMatchesFile()
|
void tst_FileFormat::testMatchesFile()
|
||||||
{
|
{
|
||||||
QString error;
|
|
||||||
//
|
//
|
||||||
// search for qml files in local directory
|
// search for qml files in local directory
|
||||||
//
|
//
|
||||||
auto project = loadQmlProject(QLatin1String("testMatchesFile"), &error);
|
auto project = loadQmlProject(QLatin1String("testMatchesFile"));
|
||||||
QVERIFY(project);
|
QVERIFY(project);
|
||||||
QVERIFY(error.isEmpty());
|
QVERIFY(!project->project().isEmpty());
|
||||||
|
|
||||||
project->setSourceDirectory(testDataDirPath);
|
|
||||||
|
|
||||||
QVERIFY(project->matchesFile(testDataDir + "/file1.qml"));
|
QVERIFY(project->matchesFile(testDataDir + "/file1.qml"));
|
||||||
QVERIFY(project->matchesFile(testDataDir + "/notyetexistingfile.qml"));
|
QVERIFY(project->matchesFile(testDataDir + "/notyetexistingfile.qml"));
|
||||||
@@ -194,15 +173,12 @@ void tst_FileFormat::testMatchesFile()
|
|||||||
|
|
||||||
void tst_FileFormat::testLibraryPaths()
|
void tst_FileFormat::testLibraryPaths()
|
||||||
{
|
{
|
||||||
QString error;
|
|
||||||
//
|
//
|
||||||
// search for qml files in local directory
|
// search for qml files in local directory
|
||||||
//
|
//
|
||||||
auto project = loadQmlProject(QLatin1String("testLibraryPaths"), &error);
|
auto project = loadQmlProject(QLatin1String("testLibraryPaths"));
|
||||||
QVERIFY(project);
|
QVERIFY(project);
|
||||||
QVERIFY(error.isEmpty());
|
QVERIFY(!project->project().isEmpty());
|
||||||
|
|
||||||
project->setSourceDirectory(testDataDirPath);
|
|
||||||
|
|
||||||
const QDir base(testDataDir);
|
const QDir base(testDataDir);
|
||||||
const QStringList expectedPaths({base.relativeFilePath(SRCDIR "/otherLibrary"),
|
const QStringList expectedPaths({base.relativeFilePath(SRCDIR "/otherLibrary"),
|
||||||
@@ -212,13 +188,12 @@ void tst_FileFormat::testLibraryPaths()
|
|||||||
|
|
||||||
void tst_FileFormat::testMainFile()
|
void tst_FileFormat::testMainFile()
|
||||||
{
|
{
|
||||||
QString error;
|
|
||||||
//
|
//
|
||||||
// search for qml files in local directory
|
// search for qml files in local directory
|
||||||
//
|
//
|
||||||
auto project = loadQmlProject(QLatin1String("testMainFile"), &error);
|
auto project = loadQmlProject(QLatin1String("testMainFile"));
|
||||||
QVERIFY(project);
|
QVERIFY(project);
|
||||||
QVERIFY(error.isEmpty());
|
QVERIFY(!project->project().isEmpty());
|
||||||
|
|
||||||
QCOMPARE(project->mainFile(), QString("file1.qml"));
|
QCOMPARE(project->mainFile(), QString("file1.qml"));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user