Merge remote-tracking branch 'origin/6.0'

Change-Id: I655155b35747082ac891a4b95e1680871d9b3234
This commit is contained in:
Eike Ziller
2021-10-08 16:00:32 +02:00
179 changed files with 3173 additions and 1098 deletions

View File

@@ -3,7 +3,7 @@ name: CMake Build Matrix
on: [push, pull_request] on: [push, pull_request]
env: env:
QT_VERSION: 5.15.2 QT_VERSION: 6.2.0
CLANG_VERSION: 130 CLANG_VERSION: 130
ELFUTILS_VERSION: 0.175 ELFUTILS_VERSION: 0.175
CMAKE_VERSION: 3.21.1 CMAKE_VERSION: 3.21.1
@@ -111,24 +111,20 @@ jobs:
set(qt_package_arch_suffix "win64_msvc2019_64") set(qt_package_arch_suffix "win64_msvc2019_64")
set(qt_dir_prefix "${qt_version}/msvc2019_64") set(qt_dir_prefix "${qt_version}/msvc2019_64")
set(qt_package_suffix "-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64") set(qt_package_suffix "-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64")
elseif ("${{ matrix.config.environment_script }}" MATCHES "vcvars32.bat")
set(qt_package_arch_suffix "win32_msvc2019")
set(qt_dir_prefix "${qt_version}/msvc2019")
set(qt_package_suffix "-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86")
endif() endif()
elseif ("${{ runner.os }}" STREQUAL "Linux") elseif ("${{ runner.os }}" STREQUAL "Linux")
set(url_os "linux_x64") set(url_os "linux_x64")
set(qt_package_arch_suffix "gcc_64") set(qt_package_arch_suffix "gcc_64")
set(qt_dir_prefix "${qt_version}/gcc_64") set(qt_dir_prefix "${qt_version}/gcc_64")
set(qt_package_suffix "-Linux-RHEL_7_6-GCC-Linux-RHEL_7_6-X86_64") set(qt_package_suffix "-Linux-RHEL_8_2-GCC-Linux-RHEL_8_2-X86_64")
elseif ("${{ runner.os }}" STREQUAL "macOS") elseif ("${{ runner.os }}" STREQUAL "macOS")
set(url_os "mac_x64") set(url_os "mac_x64")
set(qt_package_arch_suffix "clang_64") set(qt_package_arch_suffix "clang_64")
set(qt_dir_prefix "${qt_version}/clang_64") set(qt_dir_prefix "${qt_version}/macos")
set(qt_package_suffix "-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64") set(qt_package_suffix "-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64-ARM64")
endif() endif()
set(qt_base_url "https://\${qt_mirror}/online/qtsdkrepository/${url_os}/desktop/qt5_${qt_version_dotless}") set(qt_base_url "https://\${qt_mirror}/online/qtsdkrepository/${url_os}/desktop/qt6_${qt_version_dotless}")
foreach(qt_mirror $ENV{QT_MIRRORS}) foreach(qt_mirror $ENV{QT_MIRRORS})
cmake_language(EVAL CODE " cmake_language(EVAL CODE "
message(\"Downloading: ${qt_base_url}/Updates.xml\") message(\"Downloading: ${qt_base_url}/Updates.xml\")
@@ -141,13 +137,13 @@ jobs:
endforeach() endforeach()
file(READ ./Updates.xml updates_xml) file(READ ./Updates.xml updates_xml)
string(REGEX MATCH "<Name>qt.qt5.*<Version>([0-9+-.]+)</Version>" updates_xml_output "${updates_xml}") string(REGEX MATCH "<Name>qt.qt6.*<Version>([0-9+-.]+)</Version>" updates_xml_output "${updates_xml}")
set(qt_package_version ${CMAKE_MATCH_1}) set(qt_package_version ${CMAKE_MATCH_1})
file(MAKE_DIRECTORY qt5) file(MAKE_DIRECTORY qt6)
# Save the path for other steps # Save the path for other steps
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qt5/${qt_dir_prefix}" qt_dir) file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/qt6/${qt_dir_prefix}" qt_dir)
message("::set-output name=qt_dir::${qt_dir}") message("::set-output name=qt_dir::${qt_dir}")
function(downloadAndExtract url archive) function(downloadAndExtract url archive)
@@ -161,19 +157,26 @@ jobs:
break() break()
endif() endif()
endforeach() endforeach()
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../${archive} WORKING_DIRECTORY qt5) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ../${archive} WORKING_DIRECTORY qt6)
endfunction() endfunction()
foreach(package qtbase qtdeclarative qttools qtsvg qtserialport qtquickcontrols qtquickcontrols2 qtgraphicaleffects qtlocation qtimageformats qttranslations) foreach(package qtbase qtdeclarative qttools qtsvg qttranslations)
downloadAndExtract( downloadAndExtract(
"${qt_base_url}/qt.qt5.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}${package}${qt_package_suffix}.7z" "${qt_base_url}/qt.qt6.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}${package}${qt_package_suffix}.7z"
${package}.7z ${package}.7z
) )
endforeach() endforeach()
foreach(package qtquicktimeline qtquick3d qtscript) foreach(package qtimageformats qtserialport)
downloadAndExtract( downloadAndExtract(
"${qt_base_url}/qt.qt5.${qt_version_dotless}.${package}.${qt_package_arch_suffix}/${qt_package_version}${package}${qt_package_suffix}.7z" "${qt_base_url}/qt.qt6.${qt_version_dotless}.addons.${package}.${qt_package_arch_suffix}/${qt_package_version}${package}${qt_package_suffix}.7z"
${package}.7z
)
endforeach()
foreach(package qtquicktimeline qtquick3d qt5compat qtshadertools)
downloadAndExtract(
"${qt_base_url}/qt.qt6.${qt_version_dotless}.${package}.${qt_package_arch_suffix}/${qt_package_version}${package}${qt_package_suffix}.7z"
${package}.7z ${package}.7z
) )
endforeach() endforeach()
@@ -181,17 +184,17 @@ jobs:
# uic depends on libicu56.so # uic depends on libicu56.so
if ("${{ runner.os }}" STREQUAL "Linux") if ("${{ runner.os }}" STREQUAL "Linux")
downloadAndExtract( downloadAndExtract(
"${qt_base_url}/qt.qt5.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}icu-linux-Rhel7.2-x64.7z" "${qt_base_url}/qt.qt6.${qt_version_dotless}.${qt_package_arch_suffix}/${qt_package_version}icu-linux-Rhel7.2-x64.7z"
icu.7z icu.7z
) )
endif() endif()
file(READ "qt5/${qt_dir_prefix}/mkspecs/qconfig.pri" qtconfig) file(READ "qt6/${qt_dir_prefix}/mkspecs/qconfig.pri" qtconfig)
string(REPLACE "Enterprise" "OpenSource" qtconfig "${qtconfig}") string(REPLACE "Enterprise" "OpenSource" qtconfig "${qtconfig}")
string(REPLACE "licheck.exe" "" qtconfig "${qtconfig}") string(REPLACE "licheck.exe" "" qtconfig "${qtconfig}")
string(REPLACE "licheck64" "" qtconfig "${qtconfig}") string(REPLACE "licheck64" "" qtconfig "${qtconfig}")
string(REPLACE "licheck_mac" "" qtconfig "${qtconfig}") string(REPLACE "licheck_mac" "" qtconfig "${qtconfig}")
file(WRITE "qt5/${qt_dir_prefix}/mkspecs/qconfig.pri" "${qtconfig}") file(WRITE "qt6/${qt_dir_prefix}/mkspecs/qconfig.pri" "${qtconfig}")
if ("${{ runner.os }}" STREQUAL "Windows") if ("${{ runner.os }}" STREQUAL "Windows")
# deploy "system" runtimes into Qt, so they get deployed as well # deploy "system" runtimes into Qt, so they get deployed as well
@@ -199,7 +202,7 @@ jobs:
# deploy MinGW # deploy MinGW
foreach(file libwinpthread-1.dll libstdc++-6.dll libgcc_s_seh-1.dll) foreach(file libwinpthread-1.dll libstdc++-6.dll libgcc_s_seh-1.dll)
file(INSTALL "C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin/${file}" file(INSTALL "C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin/${file}"
DESTINATION "qt5/${qt_dir_prefix}/bin" DESTINATION "qt6/${qt_dir_prefix}/bin"
USE_SOURCE_PERMISSIONS) USE_SOURCE_PERMISSIONS)
endforeach() endforeach()
else() else()
@@ -207,7 +210,7 @@ jobs:
foreach(file vcruntime140.dll concrt140.dll msvcp140_1.dll msvcp140_2.dll foreach(file vcruntime140.dll concrt140.dll msvcp140_1.dll msvcp140_2.dll
msvcp140_codecvt_ids.dll vcruntime140_1.dll msvcp140.dll) msvcp140_codecvt_ids.dll vcruntime140_1.dll msvcp140.dll)
file(INSTALL "C:/Windows/System32/${file}" file(INSTALL "C:/Windows/System32/${file}"
DESTINATION "qt5/${qt_dir_prefix}/bin") DESTINATION "qt6/${qt_dir_prefix}/bin")
endforeach() endforeach()
endif() endif()
endif() endif()
@@ -377,7 +380,7 @@ jobs:
COMMAND sudo apt update COMMAND sudo apt update
) )
execute_process( execute_process(
COMMAND sudo apt install libgl1-mesa-dev COMMAND sudo apt install libgl1-mesa-dev libvulkan-dev libxcb-xinput-dev libxcb-xinerama0-dev libxkbcommon-dev libxkbcommon-x11-dev
RESULT_VARIABLE result RESULT_VARIABLE result
) )
if (NOT result EQUAL 0) if (NOT result EQUAL 0)

20
dist/changes-6.0.0.md vendored
View File

@@ -24,6 +24,7 @@ Editing
### C++ ### C++
* Updated to LLVM 13
* Added completion and function hint to `clangd` support * Added completion and function hint to `clangd` support
* Added option for saving open files automatically after refactoring * Added option for saving open files automatically after refactoring
(QTCREATORBUG-25924) (QTCREATORBUG-25924)
@@ -36,6 +37,11 @@ Editing
* Improved wizards for Qt 6.2 (QTCREATORBUG-26170) * Improved wizards for Qt 6.2 (QTCREATORBUG-26170)
* Simplified wizards * Simplified wizards
### Language Server Protocol
* Added support for `activeParameter` of signature information
(QTCREATORBUG-26346)
Projects Projects
-------- --------
@@ -56,7 +62,13 @@ Projects
`Issues` pane (QTCREATORBUG-26231) `Issues` pane (QTCREATORBUG-26231)
* Fixed header file handling when mentioned in target sources * Fixed header file handling when mentioned in target sources
(QTCREATORBUG-23783, QTCREATORBUG-23843, QTCREATORBUG-26201, (QTCREATORBUG-23783, QTCREATORBUG-23843, QTCREATORBUG-26201,
QTCREATORBUG-26238) QTCREATORBUG-26238, QTCREATORBUG-21452, QTCREATORBUG-25644,
QTCREATORBUG-25782)
* Fixed that generated files were selected for analyzing (QTCREATORBUG-25125)
### qmake
* Fixed crash when canceling parsing (QTCREATORBUG-26333)
Version Control Systems Version Control Systems
----------------------- -----------------------
@@ -87,6 +99,7 @@ Platforms
* Removed device selection dialog in favor of device selection in target * Removed device selection dialog in favor of device selection in target
selector (QTCREATORBUG-23991) selector (QTCREATORBUG-23991)
* Added details to device settings (QTCREATORBUG-23991) * Added details to device settings (QTCREATORBUG-23991)
* Added filter field for Android SDK manager
### Docker ### Docker
@@ -103,6 +116,7 @@ André Pönitz
Artem Sokolovskii Artem Sokolovskii
Artur Shepilko Artur Shepilko
Assam Boudjelthia Assam Boudjelthia
Christiaan Janssen
Christian Kandeler Christian Kandeler
Christian Stenger Christian Stenger
Cristian Adam Cristian Adam
@@ -112,14 +126,17 @@ Fawzi Mohamed
Henning Gruendl Henning Gruendl
Ihor Dutchak Ihor Dutchak
Jaroslaw Kobus Jaroslaw Kobus
Johanna Vanhatapio
Jonas Karlsson Jonas Karlsson
Kai Köhne Kai Köhne
Kama Wójcik Kama Wójcik
Knud Dollereder
Li Xi Li Xi
Loren Burkholder Loren Burkholder
Mahmoud Badri Mahmoud Badri
Marco Bubke Marco Bubke
Martin Kampas Martin Kampas
Miikka Heikkinen
Miina Puuronen Miina Puuronen
Orgad Shaneh Orgad Shaneh
Petar Perisin Petar Perisin
@@ -129,6 +146,7 @@ Shantanu Tushar
Tasuku Suzuki Tasuku Suzuki
Thiago Macieira Thiago Macieira
Thomas Hartmann Thomas Hartmann
Tim Jenssen
Tony Leinonen Tony Leinonen
Tor Arne Vestbø Tor Arne Vestbø
Vladimir Serdyuk Vladimir Serdyuk

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -12,4 +12,5 @@
images/pEETxSxYazg.jpg \ images/pEETxSxYazg.jpg \
images/V3Po15bNErw.jpg \ images/V3Po15bNErw.jpg \
images/bMXeeQw6BYs.jpg \ images/bMXeeQw6BYs.jpg \
images/u3kZJjlk3CY.jpg images/u3kZJjlk3CY.jpg \
images/9MqUCP6JLCQ.jpg

View File

@@ -86,6 +86,7 @@
\li \l {Morph Target} \li \l {Morph Target}
\li \l {Repeater3D} \li \l {Repeater3D}
\li \l {Loader3D} \li \l {Loader3D}
\li \l {Particles}
\endlist \endlist
When you import 3D scenes from files that you exported from 3D graphics When you import 3D scenes from files that you exported from 3D graphics

View File

@@ -85,6 +85,7 @@
\li \l{Scene Environment} \li \l{Scene Environment}
\li \l{Morph Target} \li \l{Morph Target}
\li \l{Repeater3D} \li \l{Repeater3D}
\li \l{Particles}
\endlist \endlist
For more information about creating your own components, see For more information about creating your own components, see

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

View File

@@ -105,6 +105,14 @@
\li \l{Morph Target} \li \l{Morph Target}
\li \l{Repeater3D} \li \l{Repeater3D}
\li \l{Loader3D} \li \l{Loader3D}
\li \l{Particles}
\list
\li \l {Particle System}
\li \l {Logical Particles}
\li \l {Particle Emitters}
\li \l {Particle Affectors}
\li \l {Particle Directions}
\endlist
\endlist \endlist
\li \l {Creating Component Instances} \li \l {Creating Component Instances}
\li \l {Creating Custom Components} \li \l {Creating Custom Components}

View File

@@ -60,7 +60,7 @@
\li More Information \li More Information
\row \row
\li \inlineimage spot.png \li \inlineimage directional.png
\li Directional Light \li Directional Light
\li \li
\li \l{DirectionalLight}{Light Directional} \li \l{DirectionalLight}{Light Directional}

File diff suppressed because it is too large Load Diff

View File

@@ -397,8 +397,19 @@ void NodeInstanceServer::reparentInstances(const QVector<ReparentContainer> &con
if (hasInstanceForId(container.instanceId())) { if (hasInstanceForId(container.instanceId())) {
ServerNodeInstance instance = instanceForId(container.instanceId()); ServerNodeInstance instance = instanceForId(container.instanceId());
if (instance.isValid()) { if (instance.isValid()) {
instance.reparent(instanceForId(container.oldParentInstanceId()), container.oldParentProperty(), ServerNodeInstance newParent = instanceForId(container.newParentInstanceId());
instanceForId(container.newParentInstanceId()), container.newParentProperty()); PropertyName newParentProperty = container.newParentProperty();
if (!isInformationServer()) {
// Children of the component wraps are left out of the node tree to avoid
// incorrectly rendering them
if (newParent.isComponentWrap()) {
newParent = {};
newParentProperty.clear();
}
}
instance.reparent(instanceForId(container.oldParentInstanceId()),
container.oldParentProperty(),
newParent, newParentProperty);
} }
} }
} }
@@ -1287,8 +1298,15 @@ PixmapChangedCommand NodeInstanceServer::createPixmapChangedCommand(const QList<
QVector<ImageContainer> imageVector; QVector<ImageContainer> imageVector;
for (const ServerNodeInstance &instance : instanceList) { for (const ServerNodeInstance &instance : instanceList) {
if (instance.isValid() && instance.hasContent()) if (!instance.isValid())
imageVector.append(ImageContainer(instance.instanceId(), instance.renderImage(), instance.instanceId())); continue;
QImage renderImage;
// We need to return empty image if instance has no content to correctly update the
// item image in case the instance changed from having content to not having content.
if (instance.hasContent())
renderImage = instance.renderImage();
imageVector.append(ImageContainer(instance.instanceId(), renderImage, instance.instanceId()));
} }
return PixmapChangedCommand(imageVector); return PixmapChangedCommand(imageVector);

View File

@@ -415,6 +415,16 @@ bool ObjectNodeInstance::isLockedInEditor() const
return m_isLockedInEditor; return m_isLockedInEditor;
} }
bool ObjectNodeInstance::isComponentWrap() const
{
return m_isComponentWrap;
}
void ObjectNodeInstance::setComponentWrap(bool wrap)
{
m_isComponentWrap = wrap;
}
void ObjectNodeInstance::setModifiedFlag(bool b) void ObjectNodeInstance::setModifiedFlag(bool b)
{ {
m_isModified = b; m_isModified = b;
@@ -732,6 +742,10 @@ QObject *ObjectNodeInstance::createComponentWrap(const QString &nodeSource, cons
QQmlComponent *component = new QQmlComponent(context->engine()); QQmlComponent *component = new QQmlComponent(context->engine());
QByteArray data(nodeSource.toUtf8()); QByteArray data(nodeSource.toUtf8());
if (data.isEmpty()) {
// Add a fake root element as an empty component is not valid and crashes in some cases
data.append("QtObject{}");
}
data.prepend(importCode); data.prepend(importCode);
component->setData(data, context->baseUrl().resolved(QUrl("createComponent.qml"))); component->setData(data, context->baseUrl().resolved(QUrl("createComponent.qml")));
QObject *object = component; QObject *object = component;

View File

@@ -202,6 +202,9 @@ public:
virtual void setLockedInEditor(bool b); virtual void setLockedInEditor(bool b);
bool isLockedInEditor() const; bool isLockedInEditor() const;
bool isComponentWrap() const;
void setComponentWrap(bool wrap);
void setModifiedFlag(bool b); void setModifiedFlag(bool b);
protected: protected:
@@ -234,6 +237,7 @@ private:
bool m_isModified = false; bool m_isModified = false;
bool m_isLockedInEditor = false; bool m_isLockedInEditor = false;
bool m_isHiddenInEditor = false; bool m_isHiddenInEditor = false;
bool m_isComponentWrap = false;
static QHash<EnumerationName, QVariant> m_enumationValueHash; static QHash<EnumerationName, QVariant> m_enumationValueHash;
}; };

View File

@@ -37,6 +37,7 @@
#include <addimportcontainer.h> #include <addimportcontainer.h>
#include <createscenecommand.h> #include <createscenecommand.h>
#include <reparentinstancescommand.h> #include <reparentinstancescommand.h>
#include <removeinstancescommand.h>
#include <clearscenecommand.h> #include <clearscenecommand.h>
#include <QDebug> #include <QDebug>
@@ -193,6 +194,32 @@ QList<QQuickItem*> Qt5NodeInstanceServer::allItems() const
return QList<QQuickItem*>(); return QList<QQuickItem*>();
} }
void Qt5NodeInstanceServer::markRepeaterParentDirty(qint32 id) const
{
if (!hasInstanceForId(id))
return;
ServerNodeInstance instance = instanceForId(id);
if (!instance.isValid())
return;
ServerNodeInstance parentInstance = instance.parent();
if (!parentInstance.isValid())
return;
// If a Repeater instance was moved/removed, the old parent must be marked dirty to rerender it
const QByteArray type("QQuickRepeater");
if (ServerNodeInstance::isSubclassOf(instance.internalObject(), type))
DesignerSupport::addDirty(parentInstance.rootQuickItem(), QQuickDesignerSupport::Content);
// Repeater's parent must also be dirtied when a child of a repeater was moved/removed.
if (ServerNodeInstance::isSubclassOf(parentInstance.internalObject(), type)) {
ServerNodeInstance parentsParent = parentInstance.parent();
if (parentsParent.isValid())
DesignerSupport::addDirty(parentsParent.rootQuickItem(), QQuickDesignerSupport::Content);
}
}
bool Qt5NodeInstanceServer::initRhi(RenderViewData &viewData) bool Qt5NodeInstanceServer::initRhi(RenderViewData &viewData)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@@ -523,9 +550,23 @@ void Qt5NodeInstanceServer::clearScene(const ClearSceneCommand &command)
void Qt5NodeInstanceServer::reparentInstances(const ReparentInstancesCommand &command) void Qt5NodeInstanceServer::reparentInstances(const ReparentInstancesCommand &command)
{ {
const QVector<ReparentContainer> &containerVector = command.reparentInstances();
for (const ReparentContainer &container : containerVector)
markRepeaterParentDirty(container.instanceId());
NodeInstanceServer::reparentInstances(command.reparentInstances()); NodeInstanceServer::reparentInstances(command.reparentInstances());
startRenderTimer(); startRenderTimer();
} }
void Qt5NodeInstanceServer::removeInstances(const RemoveInstancesCommand &command)
{
const QVector<qint32> &idVector = command.instanceIds();
for (const qint32 id : idVector)
markRepeaterParentDirty(id);
NodeInstanceServer::removeInstances(command);
startRenderTimer();
}
} // QmlDesigner } // QmlDesigner

View File

@@ -67,6 +67,7 @@ public:
void createScene(const CreateSceneCommand &command) override; void createScene(const CreateSceneCommand &command) override;
void clearScene(const ClearSceneCommand &command) override; void clearScene(const ClearSceneCommand &command) override;
void reparentInstances(const ReparentInstancesCommand &command) override; void reparentInstances(const ReparentInstancesCommand &command) override;
void removeInstances(const RemoveInstancesCommand &command) override;
QImage grabWindow() override; QImage grabWindow() override;
QImage grabItem(QQuickItem *item) override; QImage grabItem(QQuickItem *item) override;
@@ -79,6 +80,7 @@ protected:
void resetAllItems(); void resetAllItems();
void setupScene(const CreateSceneCommand &command) override; void setupScene(const CreateSceneCommand &command) override;
QList<QQuickItem*> allItems() const; QList<QQuickItem*> allItems() const;
void markRepeaterParentDirty(qint32 id) const;
struct RenderViewData { struct RenderViewData {
QPointer<QQuickWindow> window = nullptr; QPointer<QQuickWindow> window = nullptr;

View File

@@ -101,6 +101,10 @@ void Qt5PreviewNodeInstanceServer::changeState(const ChangeStateCommand &/*comma
QImage Qt5PreviewNodeInstanceServer::renderPreviewImage() QImage Qt5PreviewNodeInstanceServer::renderPreviewImage()
{ {
// Ensure the state preview image is always clipped properly to root item dimensions
if (auto rootItem = qobject_cast<QQuickItem *>(rootNodeInstance().internalObject()))
rootItem->setClip(true);
rootNodeInstance().updateDirtyNodeRecursive(); rootNodeInstance().updateDirtyNodeRecursive();
QRectF boundingRect = rootNodeInstance().boundingRect(); QRectF boundingRect = rootNodeInstance().boundingRect();

View File

@@ -779,6 +779,9 @@ void QuickItemNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParen
ObjectNodeInstance::reparent(oldParentInstance, oldParentProperty, newParentInstance, newParentProperty); ObjectNodeInstance::reparent(oldParentInstance, oldParentProperty, newParentInstance, newParentProperty);
if (!newParentInstance)
quickItem()->setParentItem(nullptr);
if (instanceIsValidLayoutable(newParentInstance, newParentProperty)) { if (instanceIsValidLayoutable(newParentInstance, newParentProperty)) {
setInLayoutable(true); setInLayoutable(true);
setMovable(false); setMovable(false);

View File

@@ -150,6 +150,11 @@ bool ServerNodeInstance::holdsGraphical() const
return m_nodeInstance->isQuickItem(); return m_nodeInstance->isQuickItem();
} }
bool ServerNodeInstance::isComponentWrap() const
{
return m_nodeInstance->isComponentWrap();
}
void ServerNodeInstance::updateDirtyNodeRecursive() void ServerNodeInstance::updateDirtyNodeRecursive()
{ {
m_nodeInstance->updateAllDirtyNodesRecursive(); m_nodeInstance->updateAllDirtyNodesRecursive();
@@ -280,6 +285,8 @@ ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceSe
instance.internalInstance()->setInstanceId(instanceContainer.instanceId()); instance.internalInstance()->setInstanceId(instanceContainer.instanceId());
instance.internalInstance()->setComponentWrap(componentWrap == WrapAsComponent);
instance.internalInstance()->initialize(instance.m_nodeInstance, instanceContainer.metaFlags()); instance.internalInstance()->initialize(instance.m_nodeInstance, instanceContainer.metaFlags());
// Handle hidden state to initialize pickable state // Handle hidden state to initialize pickable state

View File

@@ -178,6 +178,8 @@ public:
void updateDirtyNodeRecursive(); void updateDirtyNodeRecursive();
bool holdsGraphical() const; bool holdsGraphical() const;
bool isComponentWrap() const;
private: // functions private: // functions
ServerNodeInstance(const QSharedPointer<Internal::ObjectNodeInstance> &abstractInstance); ServerNodeInstance(const QSharedPointer<Internal::ObjectNodeInstance> &abstractInstance);

View File

@@ -0,0 +1,106 @@
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
import QtQuick 2.15
import QtQuick.Layouts 1.15
import HelperWidgets 2.0
import StudioTheme 1.0 as StudioTheme
Column {
anchors.left: parent.left
anchors.right: parent.right
Section {
caption: qsTr("Loader")
anchors.left: parent.left
anchors.right: parent.right
SectionLayout {
PropertyLabel {
text: qsTr("Active")
tooltip: qsTr("This property is true if the Loader is currently active.")
}
SecondColumnLayout {
CheckBox {
text: backendValues.active.valueToString
backendValue: backendValues.active
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
}
ExpandingSpacer {}
}
PropertyLabel {
text: qsTr("Source")
tooltip: qsTr("This property holds the URL of the QML component to instantiate.")
}
SecondColumnLayout {
UrlChooser {
filter: "*.qml"
backendValue: backendValues.source
}
ExpandingSpacer {}
}
PropertyLabel {
text: qsTr("Source Component")
tooltip: qsTr("This property holds the component to instantiate.")
}
SecondColumnLayout {
ItemFilterComboBox {
typeFilter: "Component"
validator: RegExpValidator { regExp: /(^$|^[a-z_]\w*)/ }
backendValue: backendValues.sourceComponent
implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
}
ExpandingSpacer {}
}
PropertyLabel {
text: qsTr("Asynchronous")
tooltip: qsTr("This property holds whether the component will be instantiated asynchronously.")
}
SecondColumnLayout {
CheckBox {
text: backendValues.asynchronous.valueToString
backendValue: backendValues.asynchronous
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
}
ExpandingSpacer {}
}
}
}
}

View File

@@ -0,0 +1,77 @@
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
import QtQuick 2.15
import QtQuick.Layouts 1.15
import HelperWidgets 2.0
import StudioTheme 1.0 as StudioTheme
Column {
anchors.left: parent.left
anchors.right: parent.right
Section {
caption: qsTr("Repeater")
anchors.left: parent.left
anchors.right: parent.right
SectionLayout {
PropertyLabel {
text: qsTr("Model")
tooltip: qsTr("The model providing data for the repeater. This can simply specify the number of delegate instances to create or it can be bound to an actual model.")
}
SecondColumnLayout {
LineEdit {
backendValue: backendValues.model
showTranslateCheckBox: false
writeAsExpression: true
implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
width: implicitWidth
}
ExpandingSpacer {}
}
PropertyLabel {
text: qsTr("Delegate")
tooltip: qsTr("The delegate provides a template defining each object instantiated by the repeater.")
}
SecondColumnLayout {
ItemFilterComboBox {
typeFilter: "Component"
validator: RegExpValidator { regExp: /(^$|^[a-z_]\w*)/ }
backendValue: backendValues.delegate
implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
}
ExpandingSpacer {}
}
}
}
}

View File

@@ -14,6 +14,7 @@
"options": "options":
[ [
{ "key": "QmlProjectFileName", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qmlproject')}" }, { "key": "QmlProjectFileName", "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qmlproject')}" },
{ "key": "IsQt6", "value": "%{JS: value('QtVersion').IsQt6}" },
{ "key": "MainQmlFileName", "value": "%{JS: Util.fileName(value('ProjectName'), 'qml')}" }, { "key": "MainQmlFileName", "value": "%{JS: Util.fileName(value('ProjectName'), 'qml')}" },
{ "key": "QtQuickVersion", "value": "%{JS: value('QtVersion').QtQuickVersion}" }, { "key": "QtQuickVersion", "value": "%{JS: value('QtVersion').QtQuickVersion}" },
{ "key": "QtQuickWindowVersion", "value": "%{JS: value('QtVersion').QtQuickWindowVersion}" }, { "key": "QtQuickWindowVersion", "value": "%{JS: value('QtVersion').QtQuickWindowVersion}" },
@@ -50,7 +51,8 @@
{ {
"QtQuickVersion": "", "QtQuickVersion": "",
"QtQuickWindowVersion": "", "QtQuickWindowVersion": "",
"QtQuickVirtualKeyboardImport": "" "QtQuickVirtualKeyboardImport": "",
"IsQt6": true
} }
}, },
{ {
@@ -59,7 +61,8 @@
{ {
"QtQuickVersion": "2.15", "QtQuickVersion": "2.15",
"QtQuickWindowVersion": "2.15", "QtQuickWindowVersion": "2.15",
"QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.15" "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.15",
"IsQt6": false
} }
}, },
{ {
@@ -68,7 +71,8 @@
{ {
"QtQuickVersion": "2.14", "QtQuickVersion": "2.14",
"QtQuickWindowVersion": "2.14", "QtQuickWindowVersion": "2.14",
"QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.14" "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.14",
"IsQt6": false
} }
}, },
{ {
@@ -77,7 +81,8 @@
{ {
"QtQuickVersion": "2.13", "QtQuickVersion": "2.13",
"QtQuickWindowVersion": "2.13", "QtQuickWindowVersion": "2.13",
"QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4" "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4",
"IsQt6": false
} }
}, },
{ {
@@ -86,7 +91,8 @@
{ {
"QtQuickVersion": "2.12", "QtQuickVersion": "2.12",
"QtQuickWindowVersion": "2.12", "QtQuickWindowVersion": "2.12",
"QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4" "QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4",
"IsQt6": false
} }
} }
] ]

View File

@@ -617,7 +617,6 @@ class UnsupportedTypesByQmlUi : public QStringList
{ {
public: public:
UnsupportedTypesByQmlUi() : QStringList({"ShaderEffect", UnsupportedTypesByQmlUi() : QStringList({"ShaderEffect",
"Component",
"Drawer"}) "Drawer"})
{ {
append(UnsupportedTypesByVisualDesigner()); append(UnsupportedTypesByVisualDesigner());

View File

@@ -136,8 +136,7 @@ void Environment::setupEnglishOutput()
set("LANGUAGE", "en_US:en"); set("LANGUAGE", "en_US:en");
} }
static FilePath searchInDirectory(const Environment &env, static FilePath searchInDirectory(const QStringList &execs,
const QStringList &execs,
const FilePath &directory, const FilePath &directory,
QSet<FilePath> &alreadyChecked) QSet<FilePath> &alreadyChecked)
{ {
@@ -226,7 +225,7 @@ static FilePath searchInDirectoriesHelper(const Environment &env,
QSet<FilePath> alreadyChecked; QSet<FilePath> alreadyChecked;
for (const FilePath &dir : dirs) { for (const FilePath &dir : dirs) {
FilePath tmp = searchInDirectory(env, execs, dir, alreadyChecked); FilePath tmp = searchInDirectory(execs, dir, alreadyChecked);
if (!tmp.isEmpty() && (!func || func(tmp))) if (!tmp.isEmpty() && (!func || func(tmp)))
return tmp; return tmp;
} }
@@ -236,7 +235,7 @@ static FilePath searchInDirectoriesHelper(const Environment &env,
return FilePath(); return FilePath();
for (const FilePath &p : env.path()) { for (const FilePath &p : env.path()) {
FilePath tmp = searchInDirectory(env, execs, p, alreadyChecked); FilePath tmp = searchInDirectory(execs, p, alreadyChecked);
if (!tmp.isEmpty() && (!func || func(tmp))) if (!tmp.isEmpty() && (!func || func(tmp)))
return tmp; return tmp;
} }
@@ -281,14 +280,14 @@ FilePaths Environment::findAllInPath(const QString &executable,
QSet<FilePath> result; QSet<FilePath> result;
QSet<FilePath> alreadyChecked; QSet<FilePath> alreadyChecked;
for (const FilePath &dir : additionalDirs) { for (const FilePath &dir : additionalDirs) {
FilePath tmp = searchInDirectory(*this, execs, dir, alreadyChecked); FilePath tmp = searchInDirectory(execs, dir, alreadyChecked);
if (!tmp.isEmpty() && (!func || func(tmp))) if (!tmp.isEmpty() && (!func || func(tmp)))
result << tmp; result << tmp;
} }
if (!executable.contains('/')) { if (!executable.contains('/')) {
for (const FilePath &p : path()) { for (const FilePath &p : path()) {
FilePath tmp = searchInDirectory(*this, execs, p, alreadyChecked); FilePath tmp = searchInDirectory(execs, p, alreadyChecked);
if (!tmp.isEmpty() && (!func || func(tmp))) if (!tmp.isEmpty() && (!func || func(tmp)))
result << tmp; result << tmp;
} }

View File

@@ -130,6 +130,7 @@ PathListEditor::PathListEditor(QWidget *parent) :
}); });
addButton(tr("Delete Line"), this, [this] { deletePathAtCursor(); }); addButton(tr("Delete Line"), this, [this] { deletePathAtCursor(); });
addButton(tr("Clear"), this, [this] { d->edit->clear(); }); addButton(tr("Clear"), this, [this] { d->edit->clear(); });
connect(d->edit, &QPlainTextEdit::textChanged, this, &PathListEditor::changed);
} }
PathListEditor::~PathListEditor() PathListEditor::~PathListEditor()

View File

@@ -58,6 +58,9 @@ public:
void setPathList(const QString &pathString); void setPathList(const QString &pathString);
void setFileDialogTitle(const QString &l); void setFileDialogTitle(const QString &l);
signals:
void changed();
protected: protected:
// Index after which to insert further "Add" buttons // Index after which to insert further "Add" buttons
static const int lastInsertButtonIndex; static const int lastInsertButtonIndex;

View File

@@ -203,6 +203,7 @@ bool AndroidAvdManager::removeAvd(const QString &name) const
qCDebug(avdManagerLog) << "Running command (removeAvd):" << command.toUserOutput(); qCDebug(avdManagerLog) << "Running command (removeAvd):" << command.toUserOutput();
QtcProcess proc; QtcProcess proc;
proc.setTimeoutS(5); proc.setTimeoutS(5);
proc.setEnvironment(AndroidConfigurations::toolsEnvironment(m_config));
proc.setCommand(command); proc.setCommand(command);
proc.runBlocking(); proc.runBlocking();
return proc.result() == QtcProcess::FinishedWithSuccess; return proc.result() == QtcProcess::FinishedWithSuccess;

View File

@@ -196,7 +196,7 @@ QWidget *AndroidBuildApkWidget::createApplicationGroup()
}); });
auto formLayout = new QFormLayout(group); auto formLayout = new QFormLayout(group);
formLayout->addRow(tr("Android build SDK:"), targetSDKComboBox); formLayout->addRow(tr("Android build platform SDK:"), targetSDKComboBox);
auto createAndroidTemplatesButton = new QPushButton(tr("Create Templates")); auto createAndroidTemplatesButton = new QPushButton(tr("Create Templates"));
createAndroidTemplatesButton->setToolTip( createAndroidTemplatesButton->setToolTip(
@@ -939,7 +939,8 @@ QVariant AndroidBuildApkStep::data(Utils::Id id) const
} }
if (id == Constants::SdkLocation) if (id == Constants::SdkLocation)
return QVariant::fromValue(AndroidConfigurations::currentConfig().sdkLocation()); return QVariant::fromValue(AndroidConfigurations::currentConfig().sdkLocation());
if (id == Constants::AndroidABIs)
if (id == Constants::AndroidMkSpecAbis)
return AndroidManager::applicationAbis(target()); return AndroidManager::applicationAbis(target());
return AbstractProcessStep::data(id); return AbstractProcessStep::data(id);

View File

@@ -1127,9 +1127,8 @@ void AndroidConfigurations::removeOldToolChains()
void AndroidConfigurations::removeUnusedDebuggers() void AndroidConfigurations::removeUnusedDebuggers()
{ {
const QList<BaseQtVersion *> qtVersions const QList<BaseQtVersion*> qtVersions = QtVersionManager::versions([](const BaseQtVersion *v) {
= QtVersionManager::versions([](const BaseQtVersion *v) { return v->type() == Constants::ANDROID_QT_TYPE;
return v->type() == Constants::ANDROIDQT;
}); });
QVector<FilePath> uniqueNdks; QVector<FilePath> uniqueNdks;
@@ -1267,8 +1266,8 @@ void AndroidConfigurations::updateAutomaticKitList()
removeUnusedDebuggers(); removeUnusedDebuggers();
QHash<Abi, QList<const BaseQtVersion *> > qtVersionsForArch; QHash<Abi, QList<const BaseQtVersion *> > qtVersionsForArch;
const QList<BaseQtVersion *> qtVersions = QtVersionManager::versions([](const BaseQtVersion *v) { const QList<BaseQtVersion*> qtVersions = QtVersionManager::versions([](const BaseQtVersion *v) {
return v->type() == Constants::ANDROIDQT; return v->type() == Constants::ANDROID_QT_TYPE;
}); });
for (const BaseQtVersion *qtVersion : qtVersions) { for (const BaseQtVersion *qtVersion : qtVersions) {
const Abis qtAbis = qtVersion->qtAbis(); const Abis qtAbis = qtVersion->qtAbis();
@@ -1322,9 +1321,8 @@ void AndroidConfigurations::updateAutomaticKitList()
QStringList abis = static_cast<const AndroidQtVersion *>(qt)->androidAbis(); QStringList abis = static_cast<const AndroidQtVersion *>(qt)->androidAbis();
Debugger::DebuggerKitAspect::setDebugger(k, findOrRegisterDebugger(tc, abis)); Debugger::DebuggerKitAspect::setDebugger(k, findOrRegisterDebugger(tc, abis));
k->setSticky(ToolChainKitAspect::id(), true); BuildDeviceKitAspect::setDeviceId(k, DeviceManager::defaultDesktopDevice()->id());
k->setSticky(QtKitAspect::id(), true); k->setSticky(QtKitAspect::id(), true);
k->setSticky(DeviceKitAspect::id(), true);
k->setMutable(DeviceKitAspect::id(), true); k->setMutable(DeviceKitAspect::id(), true);
k->setSticky(DeviceTypeKitAspect::id(), true); k->setSticky(DeviceTypeKitAspect::id(), true);

View File

@@ -42,9 +42,9 @@ namespace Internal {
namespace Constants { namespace Constants {
const char ANDROID_SETTINGS_ID[] = "BB.Android Configurations"; const char ANDROID_SETTINGS_ID[] = "BB.Android Configurations";
const char ANDROID_TOOLCHAIN_TYPEID[] = "Qt4ProjectManager.ToolChain.Android"; const char ANDROID_TOOLCHAIN_TYPEID[] = "Qt4ProjectManager.ToolChain.Android";
const char ANDROIDQT[] = "Qt4ProjectManager.QtVersion.Android"; const char ANDROID_QT_TYPE[] = "Qt4ProjectManager.QtVersion.Android";
const char ANDROID_AMSTARTARGS[] = "Android.AmStartArgs"; const char ANDROID_AM_START_ARGS[] = "Android.AmStartArgs";
// Note: Can be set on RunConfiguration using an aspect and/or // Note: Can be set on RunConfiguration using an aspect and/or
// the AndroidRunnerWorker using recordData() // the AndroidRunnerWorker using recordData()
const char ANDROID_PRESTARTSHELLCMDLIST[] = "Android.PreStartShellCmdList"; const char ANDROID_PRESTARTSHELLCMDLIST[] = "Android.PreStartShellCmdList";
@@ -67,32 +67,33 @@ const char ANDROID_ARCHITECTURE[] = "Android.Architecture";
const char ANDROID_PACKAGE_SOURCE_DIR[] = "ANDROID_PACKAGE_SOURCE_DIR"; const char ANDROID_PACKAGE_SOURCE_DIR[] = "ANDROID_PACKAGE_SOURCE_DIR";
const char ANDROID_EXTRA_LIBS[] = "ANDROID_EXTRA_LIBS"; const char ANDROID_EXTRA_LIBS[] = "ANDROID_EXTRA_LIBS";
const char ANDROID_ABI[] = "ANDROID_ABI"; const char ANDROID_ABI[] = "ANDROID_ABI";
const char ANDROID_TARGET_ARCH[] = "ANDROID_TARGET_ARCH";
const char ANDROID_ABIS[] = "ANDROID_ABIS"; const char ANDROID_ABIS[] = "ANDROID_ABIS";
const char ANDROID_APPLICATION_ARGUMENTS[] = "ANDROID_APPLICATION_ARGUMENTS"; const char ANDROID_APPLICATION_ARGUMENTS[] = "ANDROID_APPLICATION_ARGUMENTS";
const char QT_ANDROID_APPLICATION_ARGUMENTS[] = "QT_ANDROID_APPLICATION_ARGUMENTS";
const char ANDROID_DEPLOYMENT_SETTINGS_FILE[] = "ANDROID_DEPLOYMENT_SETTINGS_FILE"; const char ANDROID_DEPLOYMENT_SETTINGS_FILE[] = "ANDROID_DEPLOYMENT_SETTINGS_FILE";
const char ANDROID_SO_LIBS_PATHS[] = "ANDROID_SO_LIBS_PATHS"; const char ANDROID_SO_LIBS_PATHS[] = "ANDROID_SO_LIBS_PATHS";
const char ANDROID_PACKAGENAME[] = "Android.PackageName"; const char ANDROID_PACKAGE_INSTALL_STEP_ID[] = "Qt4ProjectManager.AndroidPackageInstallationStep";
const char ANDROID_PACKAGE_INSTALLATION_STEP_ID[]
= "Qt4ProjectManager.AndroidPackageInstallationStep";
const char ANDROID_BUILD_APK_ID[] = "QmakeProjectManager.AndroidBuildApkStep"; const char ANDROID_BUILD_APK_ID[] = "QmakeProjectManager.AndroidBuildApkStep";
const char ANDROID_DEPLOY_QT_ID[] = "Qt4ProjectManager.AndroidDeployQtStep"; const char ANDROID_DEPLOY_QT_ID[] = "Qt4ProjectManager.AndroidDeployQtStep";
const char AndroidPackageSourceDir[] = "AndroidPackageSourceDir"; // QString const char AndroidPackageSourceDir[] = "AndroidPackageSourceDir"; // QString
const char AndroidDeploySettingsFile[] = "AndroidDeploySettingsFile"; // QString const char AndroidDeploySettingsFile[] = "AndroidDeploySettingsFile"; // QString
const char AndroidExtraLibs[] = "AndroidExtraLibs"; // QStringList const char AndroidExtraLibs[] = "AndroidExtraLibs"; // QStringList
// REMOVE ME const char AndroidAbi[] = "AndroidAbi"; // QString
const char AndroidArch[] = "AndroidArch"; // QString const char AndroidAbis[] = "AndroidAbis"; // QStringList
const char AndroidMkSpecAbis[] = "AndroidMkSpecAbis"; // QStringList
const char AndroidSoLibPath[] = "AndroidSoLibPath"; // QStringList const char AndroidSoLibPath[] = "AndroidSoLibPath"; // QStringList
const char AndroidTargets[] = "AndroidTargets"; // QStringList const char AndroidTargets[] = "AndroidTargets"; // QStringList
const char AndroidApplicationArgs[] = "AndroidApplicationArgs"; // QString
// For qbs support
const char AndroidApk[] = "Android.APK"; // QStringList const char AndroidApk[] = "Android.APK"; // QStringList
const char AndroidManifest[] = "Android.Manifest"; // QStringList const char AndroidManifest[] = "Android.Manifest"; // QStringList
const char AndroidNdkPlatform[] = "AndroidNdkPlatform"; //QString const char AndroidNdkPlatform[] = "AndroidNdkPlatform"; //QString
const char NdkLocation[] = "NdkLocation"; // FileName const char NdkLocation[] = "NdkLocation"; // FileName
const char SdkLocation[] = "SdkLocation"; // FileName const char SdkLocation[] = "SdkLocation"; // FileName
const char AndroidABIs[] = "AndroidABIs"; // QString
// Android Device // Android Device
const Utils::Id AndroidSerialNumber = "AndroidSerialNumber"; const Utils::Id AndroidSerialNumber = "AndroidSerialNumber";

View File

@@ -149,14 +149,14 @@ bool AndroidDeployQtStep::init()
info = androidDeployQtStep->m_deviceInfo; info = androidDeployQtStep->m_deviceInfo;
const BuildSystem *bs = buildSystem(); const BuildSystem *bs = buildSystem();
auto selectedAbis = bs->property(Constants::ANDROID_ABIS).toStringList(); auto selectedAbis = bs->property(Constants::AndroidAbis).toStringList();
const QString buildKey = target()->activeBuildKey(); const QString buildKey = target()->activeBuildKey();
if (selectedAbis.isEmpty()) if (selectedAbis.isEmpty())
selectedAbis = bs->extraData(buildKey, Constants::ANDROID_ABIS).toStringList(); selectedAbis = bs->extraData(buildKey, Constants::AndroidAbis).toStringList();
if (selectedAbis.isEmpty()) if (selectedAbis.isEmpty())
selectedAbis.append(bs->extraData(buildKey, Constants::AndroidArch).toString()); selectedAbis.append(bs->extraData(buildKey, Constants::AndroidAbi).toString());
if (!info.isValid()) { if (!info.isValid()) {
const IDevice *dev = DeviceKitAspect::device(kit()).data(); const IDevice *dev = DeviceKitAspect::device(kit()).data();

View File

@@ -408,7 +408,7 @@ QString AndroidManager::apkDevicePreferredAbi(const Target *target)
auto libsPath = androidBuildDirectory(target).pathAppended("libs"); auto libsPath = androidBuildDirectory(target).pathAppended("libs");
if (!libsPath.exists()) { if (!libsPath.exists()) {
if (const ProjectNode *node = currentProjectNode(target)) if (const ProjectNode *node = currentProjectNode(target))
return preferredAbi(node->data(Android::Constants::ANDROID_ABIS).toStringList(), return preferredAbi(node->data(Android::Constants::AndroidAbis).toStringList(),
target); target);
} }
QStringList apkAbis; QStringList apkAbis;

View File

@@ -196,7 +196,7 @@ void AndroidPackageInstallationStep::doRun()
AndroidPackageInstallationFactory::AndroidPackageInstallationFactory() AndroidPackageInstallationFactory::AndroidPackageInstallationFactory()
{ {
registerStep<AndroidPackageInstallationStep>(Constants::ANDROID_PACKAGE_INSTALLATION_STEP_ID); registerStep<AndroidPackageInstallationStep>(Constants::ANDROID_PACKAGE_INSTALL_STEP_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
setSupportedDeviceType(Android::Constants::ANDROID_DEVICE_TYPE); setSupportedDeviceType(Android::Constants::ANDROID_DEVICE_TYPE);
setRepeatable(false); setRepeatable(false);

View File

@@ -74,7 +74,7 @@ bool AndroidPotentialKit::isEnabled() const
} }
return QtSupport::QtVersionManager::version([](const QtSupport::BaseQtVersion *v) { return QtSupport::QtVersionManager::version([](const QtSupport::BaseQtVersion *v) {
return v->isValid() && v->type() == QString::fromLatin1(Constants::ANDROIDQT); return v->isValid() && v->type() == QString::fromLatin1(Constants::ANDROID_QT_TYPE);
}); });
} }

View File

@@ -197,7 +197,7 @@ void AndroidQtVersion::parseMkSpec(ProFileEvaluator *evaluator) const
{ {
m_androidAbis = evaluator->values("ALL_ANDROID_ABIS"); m_androidAbis = evaluator->values("ALL_ANDROID_ABIS");
if (m_androidAbis.isEmpty()) if (m_androidAbis.isEmpty())
m_androidAbis = QStringList{evaluator->value("ANDROID_TARGET_ARCH")}; m_androidAbis = QStringList{evaluator->value(Constants::ANDROID_TARGET_ARCH)};
const QString androidPlatform = evaluator->value("ANDROID_PLATFORM"); const QString androidPlatform = evaluator->value("ANDROID_PLATFORM");
if (!androidPlatform.isEmpty()) { if (!androidPlatform.isEmpty()) {
const QRegularExpression regex("android-(\\d+)"); const QRegularExpression regex("android-(\\d+)");
@@ -232,7 +232,7 @@ QSet<Utils::Id> AndroidQtVersion::targetDeviceTypes() const
AndroidQtVersionFactory::AndroidQtVersionFactory() AndroidQtVersionFactory::AndroidQtVersionFactory()
{ {
setQtVersionCreator([] { return new AndroidQtVersion; }); setQtVersionCreator([] { return new AndroidQtVersion; });
setSupportedType(Constants::ANDROIDQT); setSupportedType(Constants::ANDROID_QT_TYPE);
setPriority(90); setPriority(90);
setRestrictionChecker([](const SetupData &setup) { setRestrictionChecker([](const SetupData &setup) {

View File

@@ -82,13 +82,13 @@ AndroidRunConfiguration::AndroidRunConfiguration(Target *target, Utils::Id id)
if (target->buildConfigurations().first()->buildType() == BuildConfiguration::BuildType::Release) { if (target->buildConfigurations().first()->buildType() == BuildConfiguration::BuildType::Release) {
const QString buildKey = target->activeBuildKey(); const QString buildKey = target->activeBuildKey();
target->buildSystem()->setExtraData(buildKey, target->buildSystem()->setExtraData(buildKey,
Android::Constants::ANDROID_APPLICATION_ARGUMENTS, Android::Constants::AndroidApplicationArgs,
extraAppArgsAspect->arguments(target->macroExpander())); extraAppArgsAspect->arguments(target->macroExpander()));
} }
}); });
auto amStartArgsAspect = addAspect<StringAspect>(); auto amStartArgsAspect = addAspect<StringAspect>();
amStartArgsAspect->setId(Constants::ANDROID_AMSTARTARGS); amStartArgsAspect->setId(Constants::ANDROID_AM_START_ARGS);
amStartArgsAspect->setSettingsKey("Android.AmStartArgsKey"); amStartArgsAspect->setSettingsKey("Android.AmStartArgsKey");
amStartArgsAspect->setLabelText(tr("Activity manager start options:")); amStartArgsAspect->setLabelText(tr("Activity manager start options:"));
amStartArgsAspect->setDisplayStyle(StringAspect::LineEditDisplay); amStartArgsAspect->setDisplayStyle(StringAspect::LineEditDisplay);

View File

@@ -279,7 +279,7 @@ AndroidRunnerWorker::AndroidRunnerWorker(RunWorker *runner, const QString &packa
m_extraAppParams = runControl->runnable().command.arguments(); m_extraAppParams = runControl->runnable().command.arguments();
} }
if (auto aspect = runControl->aspect(Constants::ANDROID_AMSTARTARGS)) { if (auto aspect = runControl->aspect(Constants::ANDROID_AM_START_ARGS)) {
QTC_CHECK(aspect->value().type() == QVariant::String); QTC_CHECK(aspect->value().type() == QVariant::String);
const QString startArgs = aspect->value().toString(); const QString startArgs = aspect->value().toString();
m_amStartExtraArgs = ProcessArgs::splitArgs(startArgs, OsTypeOtherUnix); m_amStartExtraArgs = ProcessArgs::splitArgs(startArgs, OsTypeOtherUnix);

File diff suppressed because it is too large Load Diff

View File

@@ -8,6 +8,7 @@ add_qtc_plugin(ClangFormat
clangformatchecks.ui clangformatchecks.ui
clangformatconfigwidget.cpp clangformatconfigwidget.h clangformatconfigwidget.ui clangformatconfigwidget.cpp clangformatconfigwidget.h clangformatconfigwidget.ui
clangformatconstants.h clangformatconstants.h
clangformatfile.cpp clangformatfile.h
clangformatindenter.cpp clangformatindenter.h clangformatindenter.cpp clangformatindenter.h
clangformatplugin.cpp clangformatplugin.h clangformatplugin.cpp clangformatplugin.h
clangformatsettings.cpp clangformatsettings.h clangformatsettings.cpp clangformatsettings.h

View File

@@ -15,6 +15,7 @@ unix:!macos:QMAKE_LFLAGS += -Wl,--exclude-libs,ALL
SOURCES += \ SOURCES += \
clangformatconfigwidget.cpp \ clangformatconfigwidget.cpp \
clangformatfile.cpp \
clangformatindenter.cpp \ clangformatindenter.cpp \
clangformatplugin.cpp \ clangformatplugin.cpp \
clangformatsettings.cpp \ clangformatsettings.cpp \
@@ -22,6 +23,7 @@ SOURCES += \
HEADERS += \ HEADERS += \
clangformatconfigwidget.h \ clangformatconfigwidget.h \
clangformatfile.h \
clangformatindenter.h \ clangformatindenter.h \
clangformatplugin.h \ clangformatplugin.h \
clangformatsettings.h \ clangformatsettings.h \

View File

@@ -33,6 +33,8 @@ QtcPlugin {
"clangformatconfigwidget.h", "clangformatconfigwidget.h",
"clangformatconfigwidget.ui", "clangformatconfigwidget.ui",
"clangformatconstants.h", "clangformatconstants.h",
"clangformatfile.cpp",
"clangformatfile.h",
"clangformatindenter.cpp", "clangformatindenter.cpp",
"clangformatindenter.h", "clangformatindenter.h",
"clangformatplugin.cpp", "clangformatplugin.cpp",

View File

@@ -27,6 +27,7 @@
#include "clangformatconstants.h" #include "clangformatconstants.h"
#include "clangformatindenter.h" #include "clangformatindenter.h"
#include "clangformatfile.h"
#include "clangformatsettings.h" #include "clangformatsettings.h"
#include "clangformatutils.h" #include "clangformatutils.h"
#include "ui_clangformatchecks.h" #include "ui_clangformatchecks.h"
@@ -121,6 +122,12 @@ ClangFormatConfigWidget::ClangFormatConfigWidget(ProjectExplorer::Project *proje
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
Utils::FilePath filePath = Core::ICore::userResourcePath();
if (m_project)
filePath = filePath / "clang-format/" / currentProjectUniqueId();
filePath = filePath / QLatin1String(Constants::SETTINGS_FILE_NAME);
m_config = std::make_unique<ClangFormatFile>(filePath);
initChecksAndPreview(); initChecksAndPreview();
if (m_project) { if (m_project) {
@@ -147,6 +154,8 @@ ClangFormatConfigWidget::ClangFormatConfigWidget(ProjectExplorer::Project *proje
connectChecks(); connectChecks();
} }
ClangFormatConfigWidget::~ClangFormatConfigWidget() = default;
void ClangFormatConfigWidget::initChecksAndPreview() void ClangFormatConfigWidget::initChecksAndPreview()
{ {
m_checksScrollArea = new QScrollArea(); m_checksScrollArea = new QScrollArea();
@@ -191,7 +200,7 @@ void ClangFormatConfigWidget::connectChecks()
continue; continue;
} }
auto button = qobject_cast<QPushButton *>(child); const auto button = qobject_cast<QPushButton *>(child);
if (button != nullptr) if (button != nullptr)
connect(button, &QPushButton::clicked, this, &ClangFormatConfigWidget::onTableChanged); connect(button, &QPushButton::clicked, this, &ClangFormatConfigWidget::onTableChanged);
} }
@@ -202,15 +211,7 @@ void ClangFormatConfigWidget::onTableChanged()
if (m_disableTableUpdate) if (m_disableTableUpdate)
return; return;
const std::string newConfig = tableToString(sender()); saveChanges(sender());
if (newConfig.empty())
return;
const std::string oldConfig = m_project ? currentProjectConfigText()
: currentGlobalConfigText();
saveConfig(newConfig);
fillTable();
updatePreview();
saveConfig(oldConfig);
} }
void ClangFormatConfigWidget::hideGlobalCheckboxes() void ClangFormatConfigWidget::hideGlobalCheckboxes()
@@ -379,16 +380,17 @@ void ClangFormatConfigWidget::fillTable()
} }
} }
std::string ClangFormatConfigWidget::tableToString(QObject *sender) void ClangFormatConfigWidget::saveChanges(QObject *sender)
{ {
std::stringstream content;
content << "---";
if (sender->objectName() == "BasedOnStyle") { if (sender->objectName() == "BasedOnStyle") {
auto *basedOnStyle = m_checksWidget->findChild<QComboBox *>("BasedOnStyle"); const auto *basedOnStyle = m_checksWidget->findChild<QComboBox *>("BasedOnStyle");
content << "\nBasedOnStyle: " << basedOnStyle->currentText().toStdString() << '\n'; m_config->setBasedOnStyle(basedOnStyle->currentText());
} else { } else {
QList<ClangFormatFile::Field> fields;
for (QObject *child : m_checksWidget->children()) { for (QObject *child : m_checksWidget->children()) {
if (child->objectName() == "BasedOnStyle")
continue;
auto *label = qobject_cast<QLabel *>(child); auto *label = qobject_cast<QLabel *>(child);
if (!label) if (!label)
continue; continue;
@@ -396,7 +398,7 @@ std::string ClangFormatConfigWidget::tableToString(QObject *sender)
QWidget *valueWidget = m_checksWidget->findChild<QWidget *>(label->text().trimmed()); QWidget *valueWidget = m_checksWidget->findChild<QWidget *>(label->text().trimmed());
if (!valueWidget) { if (!valueWidget) {
// Currently BraceWrapping only. // Currently BraceWrapping only.
content << '\n' << label->text().toStdString() << ":"; fields.append({label->text(), ""});
continue; continue;
} }
@@ -410,46 +412,34 @@ std::string ClangFormatConfigWidget::tableToString(QObject *sender)
if (plainText->toPlainText().trimmed().isEmpty()) if (plainText->toPlainText().trimmed().isEmpty())
continue; continue;
content << '\n' << label->text().toStdString() << ":";
std::stringstream content;
QStringList list = plainText->toPlainText().split('\n'); QStringList list = plainText->toPlainText().split('\n');
for (const QString &line : list) for (const QString &line : list)
content << "\n " << line.toStdString(); content << "\n " << line.toStdString();
fields.append({label->text(), QString::fromStdString(content.str())});
} else { } else {
auto *comboBox = qobject_cast<QComboBox *>(valueWidget); QString text;
std::string text; if (auto *comboBox = qobject_cast<QComboBox *>(valueWidget)) {
if (comboBox) { text = comboBox->currentText();
text = comboBox->currentText().toStdString();
} else { } else {
auto *lineEdit = qobject_cast<QLineEdit *>(valueWidget); auto *lineEdit = qobject_cast<QLineEdit *>(valueWidget);
QTC_ASSERT(lineEdit, continue;); QTC_ASSERT(lineEdit, continue;);
text = lineEdit->text().toStdString(); text = lineEdit->text();
} }
if (!text.empty() && text != "Default") if (!text.isEmpty() && text != "Default")
content << '\n' << label->text().toStdString() << ": " << text; fields.append({label->text(), text});
} }
} }
content << '\n'; m_config->changeFields(fields);
} }
std::string text = content.str();
clang::format::FormatStyle style;
style.Language = clang::format::FormatStyle::LK_Cpp;
const std::error_code error = clang::format::parseConfiguration(text, &style);
if (error.value() != static_cast<int>(clang::format::ParseError::Success)) {
QMessageBox::warning(this,
tr("Error in ClangFormat configuration"),
QString::fromStdString(error.message()));
fillTable(); fillTable();
updatePreview(); updatePreview();
return std::string();
}
return text;
} }
ClangFormatConfigWidget::~ClangFormatConfigWidget() = default;
void ClangFormatConfigWidget::apply() void ClangFormatConfigWidget::apply()
{ {
ClangFormatSettings &settings = ClangFormatSettings::instance(); ClangFormatSettings &settings = ClangFormatSettings::instance();
@@ -466,28 +456,7 @@ void ClangFormatConfigWidget::apply()
if (!m_checksWidget->isVisible()) if (!m_checksWidget->isVisible())
return; return;
const std::string config = tableToString(this); saveChanges(this);
if (config.empty())
return;
saveConfig(config);
fillTable();
updatePreview();
}
void ClangFormatConfigWidget::saveConfig(const std::string &text) const
{
QString filePath = Core::ICore::userResourcePath().toString();
if (m_project)
filePath += "/clang-format/" + currentProjectUniqueId();
filePath += "/" + QLatin1String(Constants::SETTINGS_FILE_NAME);
QFile file(filePath);
if (!file.open(QFile::WriteOnly))
return;
file.write(text.c_str());
file.close();
} }
} // namespace ClangFormat } // namespace ClangFormat

View File

@@ -44,6 +44,7 @@ namespace Ui {
class ClangFormatConfigWidget; class ClangFormatConfigWidget;
class ClangFormatChecksWidget; class ClangFormatChecksWidget;
} }
class ClangFormatFile;
class ClangFormatConfigWidget : public TextEditor::CodeStyleEditorWidget class ClangFormatConfigWidget : public TextEditor::CodeStyleEditorWidget
{ {
@@ -66,18 +67,17 @@ private:
void connectChecks(); void connectChecks();
void fillTable(); void fillTable();
std::string tableToString(QObject *sender); void saveChanges(QObject *sender);
void hideGlobalCheckboxes(); void hideGlobalCheckboxes();
void showGlobalCheckboxes(); void showGlobalCheckboxes();
void saveConfig(const std::string &text) const;
void updatePreview(); void updatePreview();
ProjectExplorer::Project *m_project; ProjectExplorer::Project *m_project;
QWidget *m_checksWidget; QWidget *m_checksWidget;
QScrollArea *m_checksScrollArea; QScrollArea *m_checksScrollArea;
TextEditor::SnippetEditorWidget *m_preview; TextEditor::SnippetEditorWidget *m_preview;
std::unique_ptr<ClangFormatFile> m_config;
std::unique_ptr<Ui::ClangFormatChecksWidget> m_checks; std::unique_ptr<Ui::ClangFormatChecksWidget> m_checks;
std::unique_ptr<Ui::ClangFormatConfigWidget> m_ui; std::unique_ptr<Ui::ClangFormatConfigWidget> m_ui;
bool m_disableTableUpdate = false; bool m_disableTableUpdate = false;

View File

@@ -0,0 +1,116 @@
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "clangformatfile.h"
#include <sstream>
using namespace ClangFormat;
ClangFormatFile::ClangFormatFile(Utils::FilePath filePath)
: m_filePath(filePath)
{
if (!m_filePath.exists()) {
resetStyleToLLVM();
return;
}
m_style.Language = clang::format::FormatStyle::LK_Cpp;
const std::error_code error
= clang::format::parseConfiguration(m_filePath.fileContents().toStdString(), &m_style);
if (error.value() != static_cast<int>(clang::format::ParseError::Success)) {
resetStyleToLLVM();
}
}
clang::format::FormatStyle ClangFormatFile::format() {
return m_style;
}
Utils::FilePath ClangFormatFile::filePath()
{
return m_filePath;
}
void ClangFormatFile::setStyle(clang::format::FormatStyle style)
{
m_style = style;
saveNewFormat();
}
void ClangFormatFile::resetStyleToLLVM()
{
m_style = clang::format::getLLVMStyle();
saveNewFormat();
}
void ClangFormatFile::setBasedOnStyle(QString styleName)
{
changeField({"BasedOnStyle", styleName});
saveNewFormat();
}
QString ClangFormatFile::setStyle(QString style)
{
const std::error_code error = clang::format::parseConfiguration(style.toStdString(), &m_style);
if (error.value() != static_cast<int>(clang::format::ParseError::Success)) {
return QString::fromStdString(error.message());
}
saveNewFormat(style.toUtf8());
return "";
}
QString ClangFormatFile::changeField(Field field)
{
return changeFields({field});
}
QString ClangFormatFile::changeFields(QList<Field> fields)
{
std::stringstream content;
content << "---" << "\n";
for (const auto &field : fields) {
content << field.first.toStdString() << ": " << field.second.toStdString() << "\n";
}
return setStyle(QString::fromStdString(content.str()));
}
void ClangFormatFile::saveNewFormat()
{
std::string style = clang::format::configurationAsText(m_style);
// workaround: configurationAsText() add comment "# " before BasedOnStyle line
const int pos = style.find("# BasedOnStyle");
if (pos < style.size())
style.erase(pos, 2);
m_filePath.writeFileContents(QByteArray::fromStdString(style));
}
void ClangFormatFile::saveNewFormat(QByteArray style)
{
m_filePath.writeFileContents(style);
}

View File

@@ -0,0 +1,60 @@
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include "utils/filepath.h"
#include <clang/Format/Format.h>
namespace ClangFormat {
class ClangFormatFile
{
public:
explicit ClangFormatFile(Utils::FilePath file);
clang::format::FormatStyle format();
Utils::FilePath filePath();
void resetStyleToLLVM();
void setBasedOnStyle(QString styleName);
void setStyle(clang::format::FormatStyle style);
QString setStyle(QString style);
void clearBasedOnStyle();
using Field = std::pair<QString, QString>;
QString changeFields(QList<Field> fields);
QString changeField(Field field);
private:
void saveNewFormat();
void saveNewFormat(QByteArray style);
private:
Utils::FilePath m_filePath;
clang::format::FormatStyle m_style;
};
} // namespace ClangFormat

View File

@@ -936,7 +936,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
initialArgs.append("-DCMAKE_TOOLCHAIN_FILE:PATH=" initialArgs.append("-DCMAKE_TOOLCHAIN_FILE:PATH="
+ ndkLocation.pathAppended("build/cmake/android.toolchain.cmake").path()); + ndkLocation.pathAppended("build/cmake/android.toolchain.cmake").path());
auto androidAbis = bs->data(Android::Constants::AndroidABIs).toStringList(); auto androidAbis = bs->data(Android::Constants::AndroidMkSpecAbis).toStringList();
QString preferredAbi; QString preferredAbi;
if (androidAbis.contains(ProjectExplorer::Constants::ANDROID_ABI_ARMEABI_V7A)) { if (androidAbis.contains(ProjectExplorer::Constants::ANDROID_ABI_ARMEABI_V7A)) {
preferredAbi = ProjectExplorer::Constants::ANDROID_ABI_ARMEABI_V7A; preferredAbi = ProjectExplorer::Constants::ANDROID_ABI_ARMEABI_V7A;

View File

@@ -128,20 +128,26 @@ QVariant CMakeTargetNode::data(Utils::Id role) const
return {}; return {};
}; };
if (role == Android::Constants::AndroidAbi)
return value(Android::Constants::ANDROID_ABI);
if (role == Android::Constants::AndroidAbis)
return value(Android::Constants::ANDROID_ABIS);
// TODO: Concerns the variables below. Qt 6 uses target properties which cannot be read
// by the current mechanism, and the variables start with "Qt_" prefix.
if (role == Android::Constants::AndroidPackageSourceDir) if (role == Android::Constants::AndroidPackageSourceDir)
return value(Android::Constants::ANDROID_PACKAGE_SOURCE_DIR); return value(Android::Constants::ANDROID_PACKAGE_SOURCE_DIR);
if (role == Android::Constants::AndroidDeploySettingsFile)
return value(Android::Constants::ANDROID_DEPLOYMENT_SETTINGS_FILE);
if (role == Android::Constants::AndroidExtraLibs) if (role == Android::Constants::AndroidExtraLibs)
return value(Android::Constants::ANDROID_EXTRA_LIBS); return value(Android::Constants::ANDROID_EXTRA_LIBS);
if (role == Android::Constants::ANDROID_APPLICATION_ARGUMENTS) if (role == Android::Constants::AndroidDeploySettingsFile)
return value(Android::Constants::QT_ANDROID_APPLICATION_ARGUMENTS); return value(Android::Constants::ANDROID_DEPLOYMENT_SETTINGS_FILE);
if (role == Android::Constants::AndroidArch) if (role == Android::Constants::AndroidApplicationArgs)
return value(Android::Constants::ANDROID_ABI); return value(Android::Constants::ANDROID_APPLICATION_ARGUMENTS);
if (role == Android::Constants::ANDROID_ABIS) if (role == Android::Constants::ANDROID_ABIS)
return value(Android::Constants::ANDROID_ABIS); return value(Android::Constants::ANDROID_ABIS);
@@ -152,6 +158,9 @@ QVariant CMakeTargetNode::data(Utils::Id role) const
if (role == Android::Constants::AndroidTargets) if (role == Android::Constants::AndroidTargets)
return values("TARGETS_BUILD_PATH"); return values("TARGETS_BUILD_PATH");
if (role == Android::Constants::AndroidApk)
return {};
if (role == Ios::Constants::IosTarget) { if (role == Ios::Constants::IosTarget) {
// For some reason the artifact is e.g. "Debug/untitled.app/untitled" which is wrong. // For some reason the artifact is e.g. "Debug/untitled.app/untitled" which is wrong.
// It actually is e.g. "Debug-iphonesimulator/untitled.app/untitled". // It actually is e.g. "Debug-iphonesimulator/untitled.app/untitled".

View File

@@ -360,7 +360,7 @@ Utils::optional<CMakeTool::ReaderType> CMakeTool::readerType() const
FilePath CMakeTool::searchQchFile(const FilePath &executable) FilePath CMakeTool::searchQchFile(const FilePath &executable)
{ {
if (executable.isEmpty()) if (executable.isEmpty() || executable.needsDevice()) // do not register docs from devices
return {}; return {};
FilePath prefixDir = executable.parentDir().parentDir(); FilePath prefixDir = executable.parentDir().parentDir();

View File

@@ -322,8 +322,14 @@ static QStringList splitFragments(const QStringList &fragments)
return result; return result;
} }
bool isPchFile(const FilePath &buildDirectory, const FilePath &path)
{
return path.isChildOf(buildDirectory) && path.fileName().startsWith("cmake_pch");
}
RawProjectParts generateRawProjectParts(const PreprocessedData &input, RawProjectParts generateRawProjectParts(const PreprocessedData &input,
const FilePath &sourceDirectory) const FilePath &sourceDirectory,
const FilePath &buildDirectory)
{ {
RawProjectParts rpps; RawProjectParts rpps;
@@ -331,8 +337,12 @@ RawProjectParts generateRawProjectParts(const PreprocessedData &input,
for (const TargetDetails &t : input.targetDetails) { for (const TargetDetails &t : input.targetDetails) {
QDir sourceDir(sourceDirectory.toString()); QDir sourceDir(sourceDirectory.toString());
// Do not tread generated files and CMake precompiled headers as project files
const auto sourceFiles = Utils::filtered(t.sources, [buildDirectory](const SourceInfo &si) {
return !si.isGenerated && !isPchFile(buildDirectory, FilePath::fromString(si.path));
});
CppEditor::ProjectFileCategorizer CppEditor::ProjectFileCategorizer
categorizer({}, transform<QList>(t.sources, [&sourceDir](const SourceInfo &si) { categorizer({}, transform<QList>(sourceFiles, [&sourceDir](const SourceInfo &si) {
return sourceDir.absoluteFilePath(si.path); return sourceDir.absoluteFilePath(si.path);
})); }));
@@ -531,6 +541,11 @@ void addCompileGroups(ProjectNode *targetRoot,
auto node = std::make_unique<FileNode>(sourcePath, Node::fileTypeForFileName(sourcePath)); auto node = std::make_unique<FileNode>(sourcePath, Node::fileTypeForFileName(sourcePath));
node->setIsGenerated(si.isGenerated); node->setIsGenerated(si.isGenerated);
// CMake pch files are generated at configured time, but not marked as generated
// so that a "clean" step won't remove them and at a subsequent build they won't exist.
if (isPchFile(buildDirectory, sourcePath))
node->setIsGenerated(true);
// Where does the file node need to go? // Where does the file node need to go?
if (sourcePath.isChildOf(buildDirectory) && !inSourceBuild) { if (sourcePath.isChildOf(buildDirectory) && !inSourceBuild) {
buildFileNodes.emplace_back(std::move(node)); buildFileNodes.emplace_back(std::move(node));
@@ -638,9 +653,16 @@ std::unique_ptr<CMakeProjectNode> generateRootProjectNode(
void setupLocationInfoForTargets(CMakeProjectNode *rootNode, const QList<CMakeBuildTarget> &targets) void setupLocationInfoForTargets(CMakeProjectNode *rootNode, const QList<CMakeBuildTarget> &targets)
{ {
const QSet<QString> titles = Utils::transform<QSet>(targets, &CMakeBuildTarget::title);
QHash<QString, FolderNode *> buildKeyToNode;
rootNode->forEachGenericNode([&buildKeyToNode, &titles](Node *node) {
FolderNode *folderNode = node->asFolderNode();
const QString &buildKey = node->buildKey();
if (folderNode && titles.contains(buildKey))
buildKeyToNode.insert(buildKey, folderNode);
});
for (const CMakeBuildTarget &t : targets) { for (const CMakeBuildTarget &t : targets) {
FolderNode *folderNode = static_cast<FolderNode *>( FolderNode *folderNode = buildKeyToNode.value(t.title);
rootNode->findNode(Utils::equal(&Node::buildKey, t.title)));
if (folderNode) { if (folderNode) {
QSet<std::pair<FilePath, int>> locations; QSet<std::pair<FilePath, int>> locations;
auto dedup = [&locations](const Backtrace &bt) { auto dedup = [&locations](const Backtrace &bt) {
@@ -705,7 +727,7 @@ FileApiQtcData extractData(FileApiData &input,
result.buildTargets = generateBuildTargets(data, sourceDirectory, buildDirectory, haveLibrariesRelativeToBuildDirectory); result.buildTargets = generateBuildTargets(data, sourceDirectory, buildDirectory, haveLibrariesRelativeToBuildDirectory);
result.cmakeFiles = std::move(data.cmakeFiles); result.cmakeFiles = std::move(data.cmakeFiles);
result.projectParts = generateRawProjectParts(data, sourceDirectory); result.projectParts = generateRawProjectParts(data, sourceDirectory, buildDirectory);
auto rootProjectNode = generateRootProjectNode(data, sourceDirectory, buildDirectory); auto rootProjectNode = generateRootProjectNode(data, sourceDirectory, buildDirectory);
ProjectTree::applyTreeManager(rootProjectNode.get()); // QRC nodes ProjectTree::applyTreeManager(rootProjectNode.get()); // QRC nodes

View File

@@ -32,7 +32,6 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/utilsicons.h> #include <utils/utilsicons.h>
#include <QAbstractProxyModel>
#include <QDebug> #include <QDebug>
#include <QItemDelegate> #include <QItemDelegate>
#include <QKeyEvent> #include <QKeyEvent>

View File

@@ -176,8 +176,9 @@ void FileSystemFilter::accept(LocatorFilterEntry selection,
{ {
Q_UNUSED(selectionLength) Q_UNUSED(selectionLength)
if (selection.filePath.isDir()) { if (selection.filePath.isDir()) {
const QString value = shortcutString() + ' ' const QString value
+ selection.filePath.absoluteFilePath().toUserOutput() + '/'; = shortcutString() + ' '
+ selection.filePath.absoluteFilePath().cleanPath().pathAppended("/").toUserOutput();
*newText = value; *newText = value;
*selectionStart = value.length(); *selectionStart = value.length();
} else { } else {

View File

@@ -73,14 +73,20 @@ bool styleEnabled(const QWidget *widget)
return true; return true;
} }
static bool isInDialogOrPopup(const QWidget *widget)
{
// Do not style dialogs or explicitly ignored widgets
const Qt::WindowType windowType = widget->window()->windowType();
return (windowType == Qt::Dialog || windowType == Qt::Popup);
}
// Consider making this a QStyle state // Consider making this a QStyle state
bool panelWidget(const QWidget *widget) bool panelWidget(const QWidget *widget)
{ {
if (!widget) if (!widget)
return false; return false;
// Do not style dialogs or explicitly ignored widgets if (isInDialogOrPopup(widget))
if ((widget->window()->windowFlags() & Qt::WindowType_Mask) == Qt::Dialog)
return false; return false;
if (qobject_cast<const FancyMainWindow *>(widget)) if (qobject_cast<const FancyMainWindow *>(widget))
@@ -107,8 +113,7 @@ bool lightColored(const QWidget *widget)
if (!widget) if (!widget)
return false; return false;
// Don't style dialogs or explicitly ignored widgets if (isInDialogOrPopup(widget))
if ((widget->window()->windowFlags() & Qt::WindowType_Mask) == Qt::Dialog)
return false; return false;
const QWidget *p = widget; const QWidget *p = widget;

Some files were not shown because too many files have changed in this diff Show More