Merge remote-tracking branch 'origin/6.0'
Change-Id: I655155b35747082ac891a4b95e1680871d9b3234
49
.github/workflows/build_cmake.yml
vendored
@@ -3,7 +3,7 @@ name: CMake Build Matrix
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
QT_VERSION: 5.15.2
|
||||
QT_VERSION: 6.2.0
|
||||
CLANG_VERSION: 130
|
||||
ELFUTILS_VERSION: 0.175
|
||||
CMAKE_VERSION: 3.21.1
|
||||
@@ -111,24 +111,20 @@ jobs:
|
||||
set(qt_package_arch_suffix "win64_msvc2019_64")
|
||||
set(qt_dir_prefix "${qt_version}/msvc2019_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()
|
||||
elseif ("${{ runner.os }}" STREQUAL "Linux")
|
||||
set(url_os "linux_x64")
|
||||
set(qt_package_arch_suffix "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")
|
||||
set(url_os "mac_x64")
|
||||
set(qt_package_arch_suffix "clang_64")
|
||||
set(qt_dir_prefix "${qt_version}/clang_64")
|
||||
set(qt_package_suffix "-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64")
|
||||
set(qt_dir_prefix "${qt_version}/macos")
|
||||
set(qt_package_suffix "-MacOS-MacOS_11_00-Clang-MacOS-MacOS_11_00-X86_64-ARM64")
|
||||
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})
|
||||
cmake_language(EVAL CODE "
|
||||
message(\"Downloading: ${qt_base_url}/Updates.xml\")
|
||||
@@ -141,13 +137,13 @@ jobs:
|
||||
endforeach()
|
||||
|
||||
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})
|
||||
|
||||
file(MAKE_DIRECTORY qt5)
|
||||
file(MAKE_DIRECTORY qt6)
|
||||
|
||||
# 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}")
|
||||
|
||||
function(downloadAndExtract url archive)
|
||||
@@ -161,19 +157,26 @@ jobs:
|
||||
break()
|
||||
endif()
|
||||
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()
|
||||
|
||||
foreach(package qtbase qtdeclarative qttools qtsvg qtserialport qtquickcontrols qtquickcontrols2 qtgraphicaleffects qtlocation qtimageformats qttranslations)
|
||||
foreach(package qtbase qtdeclarative qttools qtsvg qttranslations)
|
||||
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
|
||||
)
|
||||
endforeach()
|
||||
|
||||
foreach(package qtquicktimeline qtquick3d qtscript)
|
||||
foreach(package qtimageformats qtserialport)
|
||||
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
|
||||
)
|
||||
endforeach()
|
||||
@@ -181,17 +184,17 @@ jobs:
|
||||
# uic depends on libicu56.so
|
||||
if ("${{ runner.os }}" STREQUAL "Linux")
|
||||
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
|
||||
)
|
||||
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 "licheck.exe" "" qtconfig "${qtconfig}")
|
||||
string(REPLACE "licheck64" "" 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")
|
||||
# deploy "system" runtimes into Qt, so they get deployed as well
|
||||
@@ -199,7 +202,7 @@ jobs:
|
||||
# deploy MinGW
|
||||
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}"
|
||||
DESTINATION "qt5/${qt_dir_prefix}/bin"
|
||||
DESTINATION "qt6/${qt_dir_prefix}/bin"
|
||||
USE_SOURCE_PERMISSIONS)
|
||||
endforeach()
|
||||
else()
|
||||
@@ -207,7 +210,7 @@ jobs:
|
||||
foreach(file vcruntime140.dll concrt140.dll msvcp140_1.dll msvcp140_2.dll
|
||||
msvcp140_codecvt_ids.dll vcruntime140_1.dll msvcp140.dll)
|
||||
file(INSTALL "C:/Windows/System32/${file}"
|
||||
DESTINATION "qt5/${qt_dir_prefix}/bin")
|
||||
DESTINATION "qt6/${qt_dir_prefix}/bin")
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
@@ -377,7 +380,7 @@ jobs:
|
||||
COMMAND sudo apt update
|
||||
)
|
||||
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
|
||||
)
|
||||
if (NOT result EQUAL 0)
|
||||
|
20
dist/changes-6.0.0.md
vendored
@@ -24,6 +24,7 @@ Editing
|
||||
|
||||
### C++
|
||||
|
||||
* Updated to LLVM 13
|
||||
* Added completion and function hint to `clangd` support
|
||||
* Added option for saving open files automatically after refactoring
|
||||
(QTCREATORBUG-25924)
|
||||
@@ -36,6 +37,11 @@ Editing
|
||||
* Improved wizards for Qt 6.2 (QTCREATORBUG-26170)
|
||||
* Simplified wizards
|
||||
|
||||
### Language Server Protocol
|
||||
|
||||
* Added support for `activeParameter` of signature information
|
||||
(QTCREATORBUG-26346)
|
||||
|
||||
Projects
|
||||
--------
|
||||
|
||||
@@ -56,7 +62,13 @@ Projects
|
||||
`Issues` pane (QTCREATORBUG-26231)
|
||||
* Fixed header file handling when mentioned in target sources
|
||||
(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
|
||||
-----------------------
|
||||
@@ -87,6 +99,7 @@ Platforms
|
||||
* Removed device selection dialog in favor of device selection in target
|
||||
selector (QTCREATORBUG-23991)
|
||||
* Added details to device settings (QTCREATORBUG-23991)
|
||||
* Added filter field for Android SDK manager
|
||||
|
||||
### Docker
|
||||
|
||||
@@ -103,6 +116,7 @@ André Pönitz
|
||||
Artem Sokolovskii
|
||||
Artur Shepilko
|
||||
Assam Boudjelthia
|
||||
Christiaan Janssen
|
||||
Christian Kandeler
|
||||
Christian Stenger
|
||||
Cristian Adam
|
||||
@@ -112,14 +126,17 @@ Fawzi Mohamed
|
||||
Henning Gruendl
|
||||
Ihor Dutchak
|
||||
Jaroslaw Kobus
|
||||
Johanna Vanhatapio
|
||||
Jonas Karlsson
|
||||
Kai Köhne
|
||||
Kama Wójcik
|
||||
Knud Dollereder
|
||||
Li Xi
|
||||
Loren Burkholder
|
||||
Mahmoud Badri
|
||||
Marco Bubke
|
||||
Martin Kampas
|
||||
Miikka Heikkinen
|
||||
Miina Puuronen
|
||||
Orgad Shaneh
|
||||
Petar Perisin
|
||||
@@ -129,6 +146,7 @@ Shantanu Tushar
|
||||
Tasuku Suzuki
|
||||
Thiago Macieira
|
||||
Thomas Hartmann
|
||||
Tim Jenssen
|
||||
Tony Leinonen
|
||||
Tor Arne Vestbø
|
||||
Vladimir Serdyuk
|
||||
|
BIN
doc/qtcreator/images/extraimages/images/9MqUCP6JLCQ.jpg
Normal file
After Width: | Height: | Size: 9.2 KiB |
@@ -12,4 +12,5 @@
|
||||
images/pEETxSxYazg.jpg \
|
||||
images/V3Po15bNErw.jpg \
|
||||
images/bMXeeQw6BYs.jpg \
|
||||
images/u3kZJjlk3CY.jpg
|
||||
images/u3kZJjlk3CY.jpg \
|
||||
images/9MqUCP6JLCQ.jpg
|
||||
|
@@ -86,6 +86,7 @@
|
||||
\li \l {Morph Target}
|
||||
\li \l {Repeater3D}
|
||||
\li \l {Loader3D}
|
||||
\li \l {Particles}
|
||||
\endlist
|
||||
|
||||
When you import 3D scenes from files that you exported from 3D graphics
|
||||
|
@@ -85,6 +85,7 @@
|
||||
\li \l{Scene Environment}
|
||||
\li \l{Morph Target}
|
||||
\li \l{Repeater3D}
|
||||
\li \l{Particles}
|
||||
\endlist
|
||||
|
||||
For more information about creating your own components, see
|
||||
|
BIN
doc/qtdesignstudio/images/icons/attractor-16px.png
Normal file
After Width: | Height: | Size: 288 B |
BIN
doc/qtdesignstudio/images/icons/emit-burst-16px.png
Normal file
After Width: | Height: | Size: 381 B |
BIN
doc/qtdesignstudio/images/icons/emitter-16px.png
Normal file
After Width: | Height: | Size: 318 B |
BIN
doc/qtdesignstudio/images/icons/gravity-16px.png
Normal file
After Width: | Height: | Size: 328 B |
BIN
doc/qtdesignstudio/images/icons/item-ellipse-16px.png
Normal file
After Width: | Height: | Size: 272 B |
BIN
doc/qtdesignstudio/images/icons/item-polygon-16px.png
Normal file
After Width: | Height: | Size: 320 B |
BIN
doc/qtdesignstudio/images/icons/model-blend-particle-16px.png
Normal file
After Width: | Height: | Size: 384 B |
BIN
doc/qtdesignstudio/images/icons/model-particle-16px.png
Normal file
After Width: | Height: | Size: 448 B |
BIN
doc/qtdesignstudio/images/icons/model-shape-16px.png
Normal file
After Width: | Height: | Size: 367 B |
BIN
doc/qtdesignstudio/images/icons/particle-shape-16px.png
Normal file
After Width: | Height: | Size: 331 B |
BIN
doc/qtdesignstudio/images/icons/particle-system-16px.png
Normal file
After Width: | Height: | Size: 334 B |
BIN
doc/qtdesignstudio/images/icons/point-rotator-16px.png
Normal file
After Width: | Height: | Size: 421 B |
BIN
doc/qtdesignstudio/images/icons/sprite-particle-16px.png
Normal file
After Width: | Height: | Size: 393 B |
BIN
doc/qtdesignstudio/images/icons/sprite-sequence-16px.png
Normal file
After Width: | Height: | Size: 299 B |
BIN
doc/qtdesignstudio/images/icons/target-direction-16px.png
Normal file
After Width: | Height: | Size: 253 B |
BIN
doc/qtdesignstudio/images/icons/trail-emitter-16px.png
Normal file
After Width: | Height: | Size: 359 B |
BIN
doc/qtdesignstudio/images/icons/vector-direction-16px.png
Normal file
After Width: | Height: | Size: 323 B |
BIN
doc/qtdesignstudio/images/icons/wander-16px.png
Normal file
After Width: | Height: | Size: 334 B |
After Width: | Height: | Size: 8.7 KiB |
BIN
doc/qtdesignstudio/images/studio-3d-particles-fire-assets.png
Normal file
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 12 KiB |
BIN
doc/qtdesignstudio/images/studio-3d-particles-fire-emitter1.png
Normal file
After Width: | Height: | Size: 8.5 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 9.9 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 8.6 KiB |
BIN
doc/qtdesignstudio/images/studio-3d-particles-fire.gif
Normal file
After Width: | Height: | Size: 317 KiB |
BIN
doc/qtdesignstudio/images/studio-3d-particles.png
Normal file
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 9.9 KiB |
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 7.6 KiB |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 3.3 KiB |
BIN
doc/qtdesignstudio/images/studio-3d-properties-particle.png
Normal file
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 9.8 KiB |
@@ -105,6 +105,14 @@
|
||||
\li \l{Morph Target}
|
||||
\li \l{Repeater3D}
|
||||
\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
|
||||
\li \l {Creating Component Instances}
|
||||
\li \l {Creating Custom Components}
|
||||
|
@@ -60,7 +60,7 @@
|
||||
\li More Information
|
||||
|
||||
\row
|
||||
\li \inlineimage spot.png
|
||||
\li \inlineimage directional.png
|
||||
\li Directional Light
|
||||
\li
|
||||
\li \l{DirectionalLight}{Light Directional}
|
||||
|
@@ -397,8 +397,19 @@ void NodeInstanceServer::reparentInstances(const QVector<ReparentContainer> &con
|
||||
if (hasInstanceForId(container.instanceId())) {
|
||||
ServerNodeInstance instance = instanceForId(container.instanceId());
|
||||
if (instance.isValid()) {
|
||||
instance.reparent(instanceForId(container.oldParentInstanceId()), container.oldParentProperty(),
|
||||
instanceForId(container.newParentInstanceId()), container.newParentProperty());
|
||||
ServerNodeInstance newParent = instanceForId(container.newParentInstanceId());
|
||||
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;
|
||||
|
||||
for (const ServerNodeInstance &instance : instanceList) {
|
||||
if (instance.isValid() && instance.hasContent())
|
||||
imageVector.append(ImageContainer(instance.instanceId(), instance.renderImage(), instance.instanceId()));
|
||||
if (!instance.isValid())
|
||||
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);
|
||||
|
@@ -415,6 +415,16 @@ bool ObjectNodeInstance::isLockedInEditor() const
|
||||
return m_isLockedInEditor;
|
||||
}
|
||||
|
||||
bool ObjectNodeInstance::isComponentWrap() const
|
||||
{
|
||||
return m_isComponentWrap;
|
||||
}
|
||||
|
||||
void ObjectNodeInstance::setComponentWrap(bool wrap)
|
||||
{
|
||||
m_isComponentWrap = wrap;
|
||||
}
|
||||
|
||||
void ObjectNodeInstance::setModifiedFlag(bool b)
|
||||
{
|
||||
m_isModified = b;
|
||||
@@ -732,6 +742,10 @@ QObject *ObjectNodeInstance::createComponentWrap(const QString &nodeSource, cons
|
||||
QQmlComponent *component = new QQmlComponent(context->engine());
|
||||
|
||||
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);
|
||||
component->setData(data, context->baseUrl().resolved(QUrl("createComponent.qml")));
|
||||
QObject *object = component;
|
||||
|
@@ -202,6 +202,9 @@ public:
|
||||
virtual void setLockedInEditor(bool b);
|
||||
bool isLockedInEditor() const;
|
||||
|
||||
bool isComponentWrap() const;
|
||||
void setComponentWrap(bool wrap);
|
||||
|
||||
void setModifiedFlag(bool b);
|
||||
|
||||
protected:
|
||||
@@ -234,6 +237,7 @@ private:
|
||||
bool m_isModified = false;
|
||||
bool m_isLockedInEditor = false;
|
||||
bool m_isHiddenInEditor = false;
|
||||
bool m_isComponentWrap = false;
|
||||
static QHash<EnumerationName, QVariant> m_enumationValueHash;
|
||||
};
|
||||
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#include <addimportcontainer.h>
|
||||
#include <createscenecommand.h>
|
||||
#include <reparentinstancescommand.h>
|
||||
#include <removeinstancescommand.h>
|
||||
#include <clearscenecommand.h>
|
||||
|
||||
#include <QDebug>
|
||||
@@ -193,6 +194,32 @@ QList<QQuickItem*> Qt5NodeInstanceServer::allItems() const
|
||||
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)
|
||||
{
|
||||
#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)
|
||||
{
|
||||
const QVector<ReparentContainer> &containerVector = command.reparentInstances();
|
||||
for (const ReparentContainer &container : containerVector)
|
||||
markRepeaterParentDirty(container.instanceId());
|
||||
|
||||
NodeInstanceServer::reparentInstances(command.reparentInstances());
|
||||
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
|
||||
|
@@ -67,6 +67,7 @@ public:
|
||||
void createScene(const CreateSceneCommand &command) override;
|
||||
void clearScene(const ClearSceneCommand &command) override;
|
||||
void reparentInstances(const ReparentInstancesCommand &command) override;
|
||||
void removeInstances(const RemoveInstancesCommand &command) override;
|
||||
|
||||
QImage grabWindow() override;
|
||||
QImage grabItem(QQuickItem *item) override;
|
||||
@@ -79,6 +80,7 @@ protected:
|
||||
void resetAllItems();
|
||||
void setupScene(const CreateSceneCommand &command) override;
|
||||
QList<QQuickItem*> allItems() const;
|
||||
void markRepeaterParentDirty(qint32 id) const;
|
||||
|
||||
struct RenderViewData {
|
||||
QPointer<QQuickWindow> window = nullptr;
|
||||
|
@@ -101,6 +101,10 @@ void Qt5PreviewNodeInstanceServer::changeState(const ChangeStateCommand &/*comma
|
||||
|
||||
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();
|
||||
|
||||
QRectF boundingRect = rootNodeInstance().boundingRect();
|
||||
|
@@ -779,6 +779,9 @@ void QuickItemNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParen
|
||||
|
||||
ObjectNodeInstance::reparent(oldParentInstance, oldParentProperty, newParentInstance, newParentProperty);
|
||||
|
||||
if (!newParentInstance)
|
||||
quickItem()->setParentItem(nullptr);
|
||||
|
||||
if (instanceIsValidLayoutable(newParentInstance, newParentProperty)) {
|
||||
setInLayoutable(true);
|
||||
setMovable(false);
|
||||
|
@@ -150,6 +150,11 @@ bool ServerNodeInstance::holdsGraphical() const
|
||||
return m_nodeInstance->isQuickItem();
|
||||
}
|
||||
|
||||
bool ServerNodeInstance::isComponentWrap() const
|
||||
{
|
||||
return m_nodeInstance->isComponentWrap();
|
||||
}
|
||||
|
||||
void ServerNodeInstance::updateDirtyNodeRecursive()
|
||||
{
|
||||
m_nodeInstance->updateAllDirtyNodesRecursive();
|
||||
@@ -280,6 +285,8 @@ ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceSe
|
||||
|
||||
instance.internalInstance()->setInstanceId(instanceContainer.instanceId());
|
||||
|
||||
instance.internalInstance()->setComponentWrap(componentWrap == WrapAsComponent);
|
||||
|
||||
instance.internalInstance()->initialize(instance.m_nodeInstance, instanceContainer.metaFlags());
|
||||
|
||||
// Handle hidden state to initialize pickable state
|
||||
|
@@ -178,6 +178,8 @@ public:
|
||||
void updateDirtyNodeRecursive();
|
||||
bool holdsGraphical() const;
|
||||
|
||||
bool isComponentWrap() const;
|
||||
|
||||
private: // functions
|
||||
ServerNodeInstance(const QSharedPointer<Internal::ObjectNodeInstance> &abstractInstance);
|
||||
|
||||
|
@@ -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 {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -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 {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -14,6 +14,7 @@
|
||||
"options":
|
||||
[
|
||||
{ "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": "QtQuickVersion", "value": "%{JS: value('QtVersion').QtQuickVersion}" },
|
||||
{ "key": "QtQuickWindowVersion", "value": "%{JS: value('QtVersion').QtQuickWindowVersion}" },
|
||||
@@ -50,7 +51,8 @@
|
||||
{
|
||||
"QtQuickVersion": "",
|
||||
"QtQuickWindowVersion": "",
|
||||
"QtQuickVirtualKeyboardImport": ""
|
||||
"QtQuickVirtualKeyboardImport": "",
|
||||
"IsQt6": true
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -59,7 +61,8 @@
|
||||
{
|
||||
"QtQuickVersion": "2.15",
|
||||
"QtQuickWindowVersion": "2.15",
|
||||
"QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.15"
|
||||
"QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.15",
|
||||
"IsQt6": false
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -68,7 +71,8 @@
|
||||
{
|
||||
"QtQuickVersion": "2.14",
|
||||
"QtQuickWindowVersion": "2.14",
|
||||
"QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.14"
|
||||
"QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.14",
|
||||
"IsQt6": false
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -77,7 +81,8 @@
|
||||
{
|
||||
"QtQuickVersion": "2.13",
|
||||
"QtQuickWindowVersion": "2.13",
|
||||
"QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4"
|
||||
"QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4",
|
||||
"IsQt6": false
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -86,7 +91,8 @@
|
||||
{
|
||||
"QtQuickVersion": "2.12",
|
||||
"QtQuickWindowVersion": "2.12",
|
||||
"QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4"
|
||||
"QtQuickVirtualKeyboardImport": "QtQuick.VirtualKeyboard 2.4",
|
||||
"IsQt6": false
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@@ -617,7 +617,6 @@ class UnsupportedTypesByQmlUi : public QStringList
|
||||
{
|
||||
public:
|
||||
UnsupportedTypesByQmlUi() : QStringList({"ShaderEffect",
|
||||
"Component",
|
||||
"Drawer"})
|
||||
{
|
||||
append(UnsupportedTypesByVisualDesigner());
|
||||
|
@@ -136,8 +136,7 @@ void Environment::setupEnglishOutput()
|
||||
set("LANGUAGE", "en_US:en");
|
||||
}
|
||||
|
||||
static FilePath searchInDirectory(const Environment &env,
|
||||
const QStringList &execs,
|
||||
static FilePath searchInDirectory(const QStringList &execs,
|
||||
const FilePath &directory,
|
||||
QSet<FilePath> &alreadyChecked)
|
||||
{
|
||||
@@ -226,7 +225,7 @@ static FilePath searchInDirectoriesHelper(const Environment &env,
|
||||
|
||||
QSet<FilePath> alreadyChecked;
|
||||
for (const FilePath &dir : dirs) {
|
||||
FilePath tmp = searchInDirectory(env, execs, dir, alreadyChecked);
|
||||
FilePath tmp = searchInDirectory(execs, dir, alreadyChecked);
|
||||
if (!tmp.isEmpty() && (!func || func(tmp)))
|
||||
return tmp;
|
||||
}
|
||||
@@ -236,7 +235,7 @@ static FilePath searchInDirectoriesHelper(const Environment &env,
|
||||
return FilePath();
|
||||
|
||||
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)))
|
||||
return tmp;
|
||||
}
|
||||
@@ -281,14 +280,14 @@ FilePaths Environment::findAllInPath(const QString &executable,
|
||||
QSet<FilePath> result;
|
||||
QSet<FilePath> alreadyChecked;
|
||||
for (const FilePath &dir : additionalDirs) {
|
||||
FilePath tmp = searchInDirectory(*this, execs, dir, alreadyChecked);
|
||||
FilePath tmp = searchInDirectory(execs, dir, alreadyChecked);
|
||||
if (!tmp.isEmpty() && (!func || func(tmp)))
|
||||
result << tmp;
|
||||
}
|
||||
|
||||
if (!executable.contains('/')) {
|
||||
for (const FilePath &p : path()) {
|
||||
FilePath tmp = searchInDirectory(*this, execs, p, alreadyChecked);
|
||||
FilePath tmp = searchInDirectory(execs, p, alreadyChecked);
|
||||
if (!tmp.isEmpty() && (!func || func(tmp)))
|
||||
result << tmp;
|
||||
}
|
||||
|
@@ -130,6 +130,7 @@ PathListEditor::PathListEditor(QWidget *parent) :
|
||||
});
|
||||
addButton(tr("Delete Line"), this, [this] { deletePathAtCursor(); });
|
||||
addButton(tr("Clear"), this, [this] { d->edit->clear(); });
|
||||
connect(d->edit, &QPlainTextEdit::textChanged, this, &PathListEditor::changed);
|
||||
}
|
||||
|
||||
PathListEditor::~PathListEditor()
|
||||
|
@@ -58,6 +58,9 @@ public:
|
||||
void setPathList(const QString &pathString);
|
||||
void setFileDialogTitle(const QString &l);
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
|
||||
protected:
|
||||
// Index after which to insert further "Add" buttons
|
||||
static const int lastInsertButtonIndex;
|
||||
|
@@ -203,6 +203,7 @@ bool AndroidAvdManager::removeAvd(const QString &name) const
|
||||
qCDebug(avdManagerLog) << "Running command (removeAvd):" << command.toUserOutput();
|
||||
QtcProcess proc;
|
||||
proc.setTimeoutS(5);
|
||||
proc.setEnvironment(AndroidConfigurations::toolsEnvironment(m_config));
|
||||
proc.setCommand(command);
|
||||
proc.runBlocking();
|
||||
return proc.result() == QtcProcess::FinishedWithSuccess;
|
||||
|
@@ -196,7 +196,7 @@ QWidget *AndroidBuildApkWidget::createApplicationGroup()
|
||||
});
|
||||
|
||||
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"));
|
||||
createAndroidTemplatesButton->setToolTip(
|
||||
@@ -939,7 +939,8 @@ QVariant AndroidBuildApkStep::data(Utils::Id id) const
|
||||
}
|
||||
if (id == Constants::SdkLocation)
|
||||
return QVariant::fromValue(AndroidConfigurations::currentConfig().sdkLocation());
|
||||
if (id == Constants::AndroidABIs)
|
||||
|
||||
if (id == Constants::AndroidMkSpecAbis)
|
||||
return AndroidManager::applicationAbis(target());
|
||||
|
||||
return AbstractProcessStep::data(id);
|
||||
|
@@ -1127,10 +1127,9 @@ void AndroidConfigurations::removeOldToolChains()
|
||||
|
||||
void AndroidConfigurations::removeUnusedDebuggers()
|
||||
{
|
||||
const QList<BaseQtVersion *> qtVersions
|
||||
= QtVersionManager::versions([](const BaseQtVersion *v) {
|
||||
return v->type() == Constants::ANDROIDQT;
|
||||
});
|
||||
const QList<BaseQtVersion*> qtVersions = QtVersionManager::versions([](const BaseQtVersion *v) {
|
||||
return v->type() == Constants::ANDROID_QT_TYPE;
|
||||
});
|
||||
|
||||
QVector<FilePath> uniqueNdks;
|
||||
for (const BaseQtVersion *qt : qtVersions) {
|
||||
@@ -1267,8 +1266,8 @@ void AndroidConfigurations::updateAutomaticKitList()
|
||||
removeUnusedDebuggers();
|
||||
|
||||
QHash<Abi, QList<const BaseQtVersion *> > qtVersionsForArch;
|
||||
const QList<BaseQtVersion *> qtVersions = QtVersionManager::versions([](const BaseQtVersion *v) {
|
||||
return v->type() == Constants::ANDROIDQT;
|
||||
const QList<BaseQtVersion*> qtVersions = QtVersionManager::versions([](const BaseQtVersion *v) {
|
||||
return v->type() == Constants::ANDROID_QT_TYPE;
|
||||
});
|
||||
for (const BaseQtVersion *qtVersion : qtVersions) {
|
||||
const Abis qtAbis = qtVersion->qtAbis();
|
||||
@@ -1322,9 +1321,8 @@ void AndroidConfigurations::updateAutomaticKitList()
|
||||
QStringList abis = static_cast<const AndroidQtVersion *>(qt)->androidAbis();
|
||||
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(DeviceKitAspect::id(), true);
|
||||
k->setMutable(DeviceKitAspect::id(), true);
|
||||
k->setSticky(DeviceTypeKitAspect::id(), true);
|
||||
|
||||
|
@@ -42,9 +42,9 @@ namespace Internal {
|
||||
namespace Constants {
|
||||
const char ANDROID_SETTINGS_ID[] = "BB.Android Configurations";
|
||||
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
|
||||
// the AndroidRunnerWorker using recordData()
|
||||
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_EXTRA_LIBS[] = "ANDROID_EXTRA_LIBS";
|
||||
const char ANDROID_ABI[] = "ANDROID_ABI";
|
||||
const char ANDROID_TARGET_ARCH[] = "ANDROID_TARGET_ARCH";
|
||||
const char ANDROID_ABIS[] = "ANDROID_ABIS";
|
||||
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_SO_LIBS_PATHS[] = "ANDROID_SO_LIBS_PATHS";
|
||||
|
||||
const char ANDROID_PACKAGENAME[] = "Android.PackageName";
|
||||
const char ANDROID_PACKAGE_INSTALLATION_STEP_ID[]
|
||||
= "Qt4ProjectManager.AndroidPackageInstallationStep";
|
||||
const char ANDROID_PACKAGE_INSTALL_STEP_ID[] = "Qt4ProjectManager.AndroidPackageInstallationStep";
|
||||
const char ANDROID_BUILD_APK_ID[] = "QmakeProjectManager.AndroidBuildApkStep";
|
||||
const char ANDROID_DEPLOY_QT_ID[] = "Qt4ProjectManager.AndroidDeployQtStep";
|
||||
|
||||
const char AndroidPackageSourceDir[] = "AndroidPackageSourceDir"; // QString
|
||||
const char AndroidDeploySettingsFile[] = "AndroidDeploySettingsFile"; // QString
|
||||
const char AndroidExtraLibs[] = "AndroidExtraLibs"; // QStringList
|
||||
// REMOVE ME
|
||||
const char AndroidArch[] = "AndroidArch"; // QString
|
||||
const char AndroidAbi[] = "AndroidAbi"; // QString
|
||||
const char AndroidAbis[] = "AndroidAbis"; // QStringList
|
||||
const char AndroidMkSpecAbis[] = "AndroidMkSpecAbis"; // QStringList
|
||||
const char AndroidSoLibPath[] = "AndroidSoLibPath"; // QStringList
|
||||
const char AndroidTargets[] = "AndroidTargets"; // QStringList
|
||||
const char AndroidApplicationArgs[] = "AndroidApplicationArgs"; // QString
|
||||
|
||||
// For qbs support
|
||||
const char AndroidApk[] = "Android.APK"; // QStringList
|
||||
const char AndroidManifest[] = "Android.Manifest"; // QStringList
|
||||
|
||||
const char AndroidNdkPlatform[] = "AndroidNdkPlatform"; //QString
|
||||
const char NdkLocation[] = "NdkLocation"; // FileName
|
||||
const char SdkLocation[] = "SdkLocation"; // FileName
|
||||
const char AndroidABIs[] = "AndroidABIs"; // QString
|
||||
|
||||
// Android Device
|
||||
const Utils::Id AndroidSerialNumber = "AndroidSerialNumber";
|
||||
|
@@ -149,14 +149,14 @@ bool AndroidDeployQtStep::init()
|
||||
info = androidDeployQtStep->m_deviceInfo;
|
||||
|
||||
const BuildSystem *bs = buildSystem();
|
||||
auto selectedAbis = bs->property(Constants::ANDROID_ABIS).toStringList();
|
||||
auto selectedAbis = bs->property(Constants::AndroidAbis).toStringList();
|
||||
|
||||
const QString buildKey = target()->activeBuildKey();
|
||||
if (selectedAbis.isEmpty())
|
||||
selectedAbis = bs->extraData(buildKey, Constants::ANDROID_ABIS).toStringList();
|
||||
selectedAbis = bs->extraData(buildKey, Constants::AndroidAbis).toStringList();
|
||||
|
||||
if (selectedAbis.isEmpty())
|
||||
selectedAbis.append(bs->extraData(buildKey, Constants::AndroidArch).toString());
|
||||
selectedAbis.append(bs->extraData(buildKey, Constants::AndroidAbi).toString());
|
||||
|
||||
if (!info.isValid()) {
|
||||
const IDevice *dev = DeviceKitAspect::device(kit()).data();
|
||||
|
@@ -408,7 +408,7 @@ QString AndroidManager::apkDevicePreferredAbi(const Target *target)
|
||||
auto libsPath = androidBuildDirectory(target).pathAppended("libs");
|
||||
if (!libsPath.exists()) {
|
||||
if (const ProjectNode *node = currentProjectNode(target))
|
||||
return preferredAbi(node->data(Android::Constants::ANDROID_ABIS).toStringList(),
|
||||
return preferredAbi(node->data(Android::Constants::AndroidAbis).toStringList(),
|
||||
target);
|
||||
}
|
||||
QStringList apkAbis;
|
||||
|
@@ -196,7 +196,7 @@ void AndroidPackageInstallationStep::doRun()
|
||||
|
||||
AndroidPackageInstallationFactory::AndroidPackageInstallationFactory()
|
||||
{
|
||||
registerStep<AndroidPackageInstallationStep>(Constants::ANDROID_PACKAGE_INSTALLATION_STEP_ID);
|
||||
registerStep<AndroidPackageInstallationStep>(Constants::ANDROID_PACKAGE_INSTALL_STEP_ID);
|
||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
setSupportedDeviceType(Android::Constants::ANDROID_DEVICE_TYPE);
|
||||
setRepeatable(false);
|
||||
|
@@ -74,7 +74,7 @@ bool AndroidPotentialKit::isEnabled() const
|
||||
}
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -197,7 +197,7 @@ void AndroidQtVersion::parseMkSpec(ProFileEvaluator *evaluator) const
|
||||
{
|
||||
m_androidAbis = evaluator->values("ALL_ANDROID_ABIS");
|
||||
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");
|
||||
if (!androidPlatform.isEmpty()) {
|
||||
const QRegularExpression regex("android-(\\d+)");
|
||||
@@ -232,7 +232,7 @@ QSet<Utils::Id> AndroidQtVersion::targetDeviceTypes() const
|
||||
AndroidQtVersionFactory::AndroidQtVersionFactory()
|
||||
{
|
||||
setQtVersionCreator([] { return new AndroidQtVersion; });
|
||||
setSupportedType(Constants::ANDROIDQT);
|
||||
setSupportedType(Constants::ANDROID_QT_TYPE);
|
||||
setPriority(90);
|
||||
|
||||
setRestrictionChecker([](const SetupData &setup) {
|
||||
|
@@ -82,13 +82,13 @@ AndroidRunConfiguration::AndroidRunConfiguration(Target *target, Utils::Id id)
|
||||
if (target->buildConfigurations().first()->buildType() == BuildConfiguration::BuildType::Release) {
|
||||
const QString buildKey = target->activeBuildKey();
|
||||
target->buildSystem()->setExtraData(buildKey,
|
||||
Android::Constants::ANDROID_APPLICATION_ARGUMENTS,
|
||||
extraAppArgsAspect->arguments(target->macroExpander()));
|
||||
Android::Constants::AndroidApplicationArgs,
|
||||
extraAppArgsAspect->arguments(target->macroExpander()));
|
||||
}
|
||||
});
|
||||
|
||||
auto amStartArgsAspect = addAspect<StringAspect>();
|
||||
amStartArgsAspect->setId(Constants::ANDROID_AMSTARTARGS);
|
||||
amStartArgsAspect->setId(Constants::ANDROID_AM_START_ARGS);
|
||||
amStartArgsAspect->setSettingsKey("Android.AmStartArgsKey");
|
||||
amStartArgsAspect->setLabelText(tr("Activity manager start options:"));
|
||||
amStartArgsAspect->setDisplayStyle(StringAspect::LineEditDisplay);
|
||||
|
@@ -279,7 +279,7 @@ AndroidRunnerWorker::AndroidRunnerWorker(RunWorker *runner, const QString &packa
|
||||
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);
|
||||
const QString startArgs = aspect->value().toString();
|
||||
m_amStartExtraArgs = ProcessArgs::splitArgs(startArgs, OsTypeOtherUnix);
|
||||
|
@@ -8,6 +8,7 @@ add_qtc_plugin(ClangFormat
|
||||
clangformatchecks.ui
|
||||
clangformatconfigwidget.cpp clangformatconfigwidget.h clangformatconfigwidget.ui
|
||||
clangformatconstants.h
|
||||
clangformatfile.cpp clangformatfile.h
|
||||
clangformatindenter.cpp clangformatindenter.h
|
||||
clangformatplugin.cpp clangformatplugin.h
|
||||
clangformatsettings.cpp clangformatsettings.h
|
||||
|
@@ -15,6 +15,7 @@ unix:!macos:QMAKE_LFLAGS += -Wl,--exclude-libs,ALL
|
||||
|
||||
SOURCES += \
|
||||
clangformatconfigwidget.cpp \
|
||||
clangformatfile.cpp \
|
||||
clangformatindenter.cpp \
|
||||
clangformatplugin.cpp \
|
||||
clangformatsettings.cpp \
|
||||
@@ -22,6 +23,7 @@ SOURCES += \
|
||||
|
||||
HEADERS += \
|
||||
clangformatconfigwidget.h \
|
||||
clangformatfile.h \
|
||||
clangformatindenter.h \
|
||||
clangformatplugin.h \
|
||||
clangformatsettings.h \
|
||||
|
@@ -33,6 +33,8 @@ QtcPlugin {
|
||||
"clangformatconfigwidget.h",
|
||||
"clangformatconfigwidget.ui",
|
||||
"clangformatconstants.h",
|
||||
"clangformatfile.cpp",
|
||||
"clangformatfile.h",
|
||||
"clangformatindenter.cpp",
|
||||
"clangformatindenter.h",
|
||||
"clangformatplugin.cpp",
|
||||
|
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "clangformatconstants.h"
|
||||
#include "clangformatindenter.h"
|
||||
#include "clangformatfile.h"
|
||||
#include "clangformatsettings.h"
|
||||
#include "clangformatutils.h"
|
||||
#include "ui_clangformatchecks.h"
|
||||
@@ -121,6 +122,12 @@ ClangFormatConfigWidget::ClangFormatConfigWidget(ProjectExplorer::Project *proje
|
||||
{
|
||||
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();
|
||||
|
||||
if (m_project) {
|
||||
@@ -147,6 +154,8 @@ ClangFormatConfigWidget::ClangFormatConfigWidget(ProjectExplorer::Project *proje
|
||||
connectChecks();
|
||||
}
|
||||
|
||||
ClangFormatConfigWidget::~ClangFormatConfigWidget() = default;
|
||||
|
||||
void ClangFormatConfigWidget::initChecksAndPreview()
|
||||
{
|
||||
m_checksScrollArea = new QScrollArea();
|
||||
@@ -191,7 +200,7 @@ void ClangFormatConfigWidget::connectChecks()
|
||||
continue;
|
||||
}
|
||||
|
||||
auto button = qobject_cast<QPushButton *>(child);
|
||||
const auto button = qobject_cast<QPushButton *>(child);
|
||||
if (button != nullptr)
|
||||
connect(button, &QPushButton::clicked, this, &ClangFormatConfigWidget::onTableChanged);
|
||||
}
|
||||
@@ -202,15 +211,7 @@ void ClangFormatConfigWidget::onTableChanged()
|
||||
if (m_disableTableUpdate)
|
||||
return;
|
||||
|
||||
const std::string newConfig = tableToString(sender());
|
||||
if (newConfig.empty())
|
||||
return;
|
||||
const std::string oldConfig = m_project ? currentProjectConfigText()
|
||||
: currentGlobalConfigText();
|
||||
saveConfig(newConfig);
|
||||
fillTable();
|
||||
updatePreview();
|
||||
saveConfig(oldConfig);
|
||||
saveChanges(sender());
|
||||
}
|
||||
|
||||
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") {
|
||||
auto *basedOnStyle = m_checksWidget->findChild<QComboBox *>("BasedOnStyle");
|
||||
content << "\nBasedOnStyle: " << basedOnStyle->currentText().toStdString() << '\n';
|
||||
const auto *basedOnStyle = m_checksWidget->findChild<QComboBox *>("BasedOnStyle");
|
||||
m_config->setBasedOnStyle(basedOnStyle->currentText());
|
||||
} else {
|
||||
QList<ClangFormatFile::Field> fields;
|
||||
|
||||
for (QObject *child : m_checksWidget->children()) {
|
||||
if (child->objectName() == "BasedOnStyle")
|
||||
continue;
|
||||
auto *label = qobject_cast<QLabel *>(child);
|
||||
if (!label)
|
||||
continue;
|
||||
@@ -396,7 +398,7 @@ std::string ClangFormatConfigWidget::tableToString(QObject *sender)
|
||||
QWidget *valueWidget = m_checksWidget->findChild<QWidget *>(label->text().trimmed());
|
||||
if (!valueWidget) {
|
||||
// Currently BraceWrapping only.
|
||||
content << '\n' << label->text().toStdString() << ":";
|
||||
fields.append({label->text(), ""});
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -410,46 +412,34 @@ std::string ClangFormatConfigWidget::tableToString(QObject *sender)
|
||||
if (plainText->toPlainText().trimmed().isEmpty())
|
||||
continue;
|
||||
|
||||
content << '\n' << label->text().toStdString() << ":";
|
||||
|
||||
std::stringstream content;
|
||||
QStringList list = plainText->toPlainText().split('\n');
|
||||
for (const QString &line : list)
|
||||
content << "\n " << line.toStdString();
|
||||
|
||||
fields.append({label->text(), QString::fromStdString(content.str())});
|
||||
} else {
|
||||
auto *comboBox = qobject_cast<QComboBox *>(valueWidget);
|
||||
std::string text;
|
||||
if (comboBox) {
|
||||
text = comboBox->currentText().toStdString();
|
||||
QString text;
|
||||
if (auto *comboBox = qobject_cast<QComboBox *>(valueWidget)) {
|
||||
text = comboBox->currentText();
|
||||
} else {
|
||||
auto *lineEdit = qobject_cast<QLineEdit *>(valueWidget);
|
||||
QTC_ASSERT(lineEdit, continue;);
|
||||
text = lineEdit->text().toStdString();
|
||||
text = lineEdit->text();
|
||||
}
|
||||
|
||||
if (!text.empty() && text != "Default")
|
||||
content << '\n' << label->text().toStdString() << ": " << text;
|
||||
if (!text.isEmpty() && text != "Default")
|
||||
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();
|
||||
updatePreview();
|
||||
return std::string();
|
||||
}
|
||||
|
||||
return text;
|
||||
fillTable();
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
ClangFormatConfigWidget::~ClangFormatConfigWidget() = default;
|
||||
|
||||
void ClangFormatConfigWidget::apply()
|
||||
{
|
||||
ClangFormatSettings &settings = ClangFormatSettings::instance();
|
||||
@@ -466,28 +456,7 @@ void ClangFormatConfigWidget::apply()
|
||||
if (!m_checksWidget->isVisible())
|
||||
return;
|
||||
|
||||
const std::string config = tableToString(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();
|
||||
saveChanges(this);
|
||||
}
|
||||
|
||||
} // namespace ClangFormat
|
||||
|
@@ -44,6 +44,7 @@ namespace Ui {
|
||||
class ClangFormatConfigWidget;
|
||||
class ClangFormatChecksWidget;
|
||||
}
|
||||
class ClangFormatFile;
|
||||
|
||||
class ClangFormatConfigWidget : public TextEditor::CodeStyleEditorWidget
|
||||
{
|
||||
@@ -66,18 +67,17 @@ private:
|
||||
void connectChecks();
|
||||
|
||||
void fillTable();
|
||||
std::string tableToString(QObject *sender);
|
||||
void saveChanges(QObject *sender);
|
||||
|
||||
void hideGlobalCheckboxes();
|
||||
void showGlobalCheckboxes();
|
||||
|
||||
void saveConfig(const std::string &text) const;
|
||||
void updatePreview();
|
||||
|
||||
ProjectExplorer::Project *m_project;
|
||||
QWidget *m_checksWidget;
|
||||
QScrollArea *m_checksScrollArea;
|
||||
TextEditor::SnippetEditorWidget *m_preview;
|
||||
std::unique_ptr<ClangFormatFile> m_config;
|
||||
std::unique_ptr<Ui::ClangFormatChecksWidget> m_checks;
|
||||
std::unique_ptr<Ui::ClangFormatConfigWidget> m_ui;
|
||||
bool m_disableTableUpdate = false;
|
||||
|
116
src/plugins/clangformat/clangformatfile.cpp
Normal 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);
|
||||
}
|
60
src/plugins/clangformat/clangformatfile.h
Normal 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
|
@@ -936,7 +936,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
|
||||
initialArgs.append("-DCMAKE_TOOLCHAIN_FILE: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;
|
||||
if (androidAbis.contains(ProjectExplorer::Constants::ANDROID_ABI_ARMEABI_V7A)) {
|
||||
preferredAbi = ProjectExplorer::Constants::ANDROID_ABI_ARMEABI_V7A;
|
||||
|
@@ -128,20 +128,26 @@ QVariant CMakeTargetNode::data(Utils::Id role) const
|
||||
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)
|
||||
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)
|
||||
return value(Android::Constants::ANDROID_EXTRA_LIBS);
|
||||
|
||||
if (role == Android::Constants::ANDROID_APPLICATION_ARGUMENTS)
|
||||
return value(Android::Constants::QT_ANDROID_APPLICATION_ARGUMENTS);
|
||||
if (role == Android::Constants::AndroidDeploySettingsFile)
|
||||
return value(Android::Constants::ANDROID_DEPLOYMENT_SETTINGS_FILE);
|
||||
|
||||
if (role == Android::Constants::AndroidArch)
|
||||
return value(Android::Constants::ANDROID_ABI);
|
||||
if (role == Android::Constants::AndroidApplicationArgs)
|
||||
return value(Android::Constants::ANDROID_APPLICATION_ARGUMENTS);
|
||||
|
||||
if (role == 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)
|
||||
return values("TARGETS_BUILD_PATH");
|
||||
|
||||
if (role == Android::Constants::AndroidApk)
|
||||
return {};
|
||||
|
||||
if (role == Ios::Constants::IosTarget) {
|
||||
// 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".
|
||||
|
@@ -360,7 +360,7 @@ Utils::optional<CMakeTool::ReaderType> CMakeTool::readerType() const
|
||||
|
||||
FilePath CMakeTool::searchQchFile(const FilePath &executable)
|
||||
{
|
||||
if (executable.isEmpty())
|
||||
if (executable.isEmpty() || executable.needsDevice()) // do not register docs from devices
|
||||
return {};
|
||||
|
||||
FilePath prefixDir = executable.parentDir().parentDir();
|
||||
|
@@ -322,8 +322,14 @@ static QStringList splitFragments(const QStringList &fragments)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool isPchFile(const FilePath &buildDirectory, const FilePath &path)
|
||||
{
|
||||
return path.isChildOf(buildDirectory) && path.fileName().startsWith("cmake_pch");
|
||||
}
|
||||
|
||||
RawProjectParts generateRawProjectParts(const PreprocessedData &input,
|
||||
const FilePath &sourceDirectory)
|
||||
const FilePath &sourceDirectory,
|
||||
const FilePath &buildDirectory)
|
||||
{
|
||||
RawProjectParts rpps;
|
||||
|
||||
@@ -331,8 +337,12 @@ RawProjectParts generateRawProjectParts(const PreprocessedData &input,
|
||||
for (const TargetDetails &t : input.targetDetails) {
|
||||
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
|
||||
categorizer({}, transform<QList>(t.sources, [&sourceDir](const SourceInfo &si) {
|
||||
categorizer({}, transform<QList>(sourceFiles, [&sourceDir](const SourceInfo &si) {
|
||||
return sourceDir.absoluteFilePath(si.path);
|
||||
}));
|
||||
|
||||
@@ -531,6 +541,11 @@ void addCompileGroups(ProjectNode *targetRoot,
|
||||
auto node = std::make_unique<FileNode>(sourcePath, Node::fileTypeForFileName(sourcePath));
|
||||
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?
|
||||
if (sourcePath.isChildOf(buildDirectory) && !inSourceBuild) {
|
||||
buildFileNodes.emplace_back(std::move(node));
|
||||
@@ -638,9 +653,16 @@ std::unique_ptr<CMakeProjectNode> generateRootProjectNode(
|
||||
|
||||
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) {
|
||||
FolderNode *folderNode = static_cast<FolderNode *>(
|
||||
rootNode->findNode(Utils::equal(&Node::buildKey, t.title)));
|
||||
FolderNode *folderNode = buildKeyToNode.value(t.title);
|
||||
if (folderNode) {
|
||||
QSet<std::pair<FilePath, int>> locations;
|
||||
auto dedup = [&locations](const Backtrace &bt) {
|
||||
@@ -705,7 +727,7 @@ FileApiQtcData extractData(FileApiData &input,
|
||||
|
||||
result.buildTargets = generateBuildTargets(data, sourceDirectory, buildDirectory, haveLibrariesRelativeToBuildDirectory);
|
||||
result.cmakeFiles = std::move(data.cmakeFiles);
|
||||
result.projectParts = generateRawProjectParts(data, sourceDirectory);
|
||||
result.projectParts = generateRawProjectParts(data, sourceDirectory, buildDirectory);
|
||||
|
||||
auto rootProjectNode = generateRootProjectNode(data, sourceDirectory, buildDirectory);
|
||||
ProjectTree::applyTreeManager(rootProjectNode.get()); // QRC nodes
|
||||
|
@@ -32,7 +32,6 @@
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
#include <QAbstractProxyModel>
|
||||
#include <QDebug>
|
||||
#include <QItemDelegate>
|
||||
#include <QKeyEvent>
|
||||
|
@@ -176,8 +176,9 @@ void FileSystemFilter::accept(LocatorFilterEntry selection,
|
||||
{
|
||||
Q_UNUSED(selectionLength)
|
||||
if (selection.filePath.isDir()) {
|
||||
const QString value = shortcutString() + ' '
|
||||
+ selection.filePath.absoluteFilePath().toUserOutput() + '/';
|
||||
const QString value
|
||||
= shortcutString() + ' '
|
||||
+ selection.filePath.absoluteFilePath().cleanPath().pathAppended("/").toUserOutput();
|
||||
*newText = value;
|
||||
*selectionStart = value.length();
|
||||
} else {
|
||||
|
@@ -73,14 +73,20 @@ bool styleEnabled(const QWidget *widget)
|
||||
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
|
||||
bool panelWidget(const QWidget *widget)
|
||||
{
|
||||
if (!widget)
|
||||
return false;
|
||||
|
||||
// Do not style dialogs or explicitly ignored widgets
|
||||
if ((widget->window()->windowFlags() & Qt::WindowType_Mask) == Qt::Dialog)
|
||||
if (isInDialogOrPopup(widget))
|
||||
return false;
|
||||
|
||||
if (qobject_cast<const FancyMainWindow *>(widget))
|
||||
@@ -107,8 +113,7 @@ bool lightColored(const QWidget *widget)
|
||||
if (!widget)
|
||||
return false;
|
||||
|
||||
// Don't style dialogs or explicitly ignored widgets
|
||||
if ((widget->window()->windowFlags() & Qt::WindowType_Mask) == Qt::Dialog)
|
||||
if (isInDialogOrPopup(widget))
|
||||
return false;
|
||||
|
||||
const QWidget *p = widget;
|
||||
|