diff options
| author | Tim Jenssen <tim.jenssen@qt.io> | 2023-03-30 13:34:12 +0200 |
|---|---|---|
| committer | Tim Jenssen <tim.jenssen@qt.io> | 2023-03-30 13:30:42 +0000 |
| commit | adb664f52128b3c28323a5d4dccedc204dec8b34 (patch) | |
| tree | 5bc4573e921a37f7ba46d73eba16c6f08db37da4 /src/tools/qml2puppet | |
| parent | 6f765181c9b9e716f3ae746183cdeac2459ac194 (diff) | |
| parent | 5b28748554b3f97c4e163606208878d573f2a655 (diff) | |
| download | qt-creator-adb664f52128b3c28323a5d4dccedc204dec8b34.tar.gz | |
Merge remote-tracking branch 'origin/qds/dev'
Conflicts: src/libs/utils/filepath.cpp
src/plugins/qmldesigner/qmldesignerexternaldependencies.cpp
src/plugins/qmlprojectmanager/cmakegen/generatecmakelists.cpp
tests/unit/unittest/CMakeLists.txt
Change-Id: I017a6075db41a5233487ac855ffe23de2b2bb0ee
Diffstat (limited to 'src/tools/qml2puppet')
10 files changed, 164 insertions, 20 deletions
diff --git a/src/tools/qml2puppet/CMakeLists.txt b/src/tools/qml2puppet/CMakeLists.txt index 4543091ab7..56a05aa000 100644 --- a/src/tools/qml2puppet/CMakeLists.txt +++ b/src/tools/qml2puppet/CMakeLists.txt @@ -203,7 +203,7 @@ extend_qtc_executable(qml2puppet qmlprivategate.cpp qmlprivategate.h ) -if(DEFINED MULTILANGUAGE_SUPPORT_SUBDIRECTORY AND Qt6_VERSION VERSION_GREATER_EQUAL 6.2.1) +if (DEFINED MULTILANGUAGE_SUPPORT_SUBDIRECTORY AND Qt6_VERSION VERSION_GREATER_EQUAL 6.2.1) add_subdirectory(${MULTILANGUAGE_SUPPORT_SUBDIRECTORY} multilanguagesupport_static_build) endif() @@ -224,7 +224,8 @@ extend_qtc_executable(qml2puppet if (Qt6_VERSION VERSION_GREATER_EQUAL 6.4.0) extend_qtc_executable(qml2puppet - DEFINES ENABLE_INTERNAL_QML_RUNTIME + # QT_QML_DEBUG is disabled in release builds, but is necessary to have the preview debug channel + DEFINES ENABLE_INTERNAL_QML_RUNTIME QT_QML_DEBUG PUBLIC_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/qml2puppet/runner SOURCES_PREFIX qml2puppet/runner SOURCES @@ -253,3 +254,29 @@ extend_qtc_executable(qml2puppet ENABLE_CRASHPAD DEPENDS Crashpad::Crashpad ) + +# add application icon +# IDE_LOGO_PATH in a default QtCreator build is empty, all icons are found by relative paths +# So we can not use the icon then. +if (TARGET qml2puppet AND NOT "${IDE_LOGO_PATH}" STREQUAL "") + if (WIN32) + set(RC_APPLICATION_NAME "${IDE_DISPLAY_NAME}") + set(RC_VERSION "${IDE_VERSION}.0") + set(RC_VERSION_STRING "${IDE_VERSION_DISPLAY}") + set(RC_COPYRIGHT "2008-${IDE_COPYRIGHT_YEAR} The Qt Company Ltd") + + string(REPLACE " " "\\x20" RC_APPLICATION_NAME "${RC_APPLICATION_NAME}") + string(REPLACE " " "\\x20" RC_COPYRIGHT "${RC_COPYRIGHT}") + string(REPLACE "." "," RC_VERSION "${RC_VERSION}") + + target_compile_definitions(qml2puppet PRIVATE + RC_APPLICATION_NAME=${RC_APPLICATION_NAME} + RC_VERSION=${RC_VERSION} + RC_VERSION_STRING=${RC_VERSION_STRING} + RC_COPYRIGHT=${RC_COPYRIGHT} + RC_ICON_PATH=${IDE_ICON_PATH} + ) + + target_sources(qml2puppet PRIVATE windows_application_icon/qml2puppet.rc) + endif() +endif() diff --git a/src/tools/qml2puppet/instances/nodeinstanceclientproxy.cpp b/src/tools/qml2puppet/instances/nodeinstanceclientproxy.cpp index f3f2b5c8a4..ffafb7bb00 100644 --- a/src/tools/qml2puppet/instances/nodeinstanceclientproxy.cpp +++ b/src/tools/qml2puppet/instances/nodeinstanceclientproxy.cpp @@ -367,11 +367,11 @@ void NodeInstanceClientProxy::startNanotrace(const StartNanotraceCommand &comman std::string fullFilePath = directory + std::string("/nanotrace_qmlpuppet_") + processName + std::string(".json"); - for (size_t i=0; i<processName.length(); ++i) { - if (i==0 || processName[i]=='m') - processName[i] = std::toupper(processName[i]); + for (int i=0; i<name.length(); ++i) { + if (i==0 || name[i]=='m') + name[i] = name.at(i).toUpper(); } - processName = processName + std::string("Puppet"); + processName = name.toStdString() + std::string("Puppet"); NANOTRACE_INIT(processName.c_str(), "MainThread", fullFilePath); diff --git a/src/tools/qml2puppet/qml2puppet/configcrashpad.h b/src/tools/qml2puppet/qml2puppet/configcrashpad.h index 81cebaeeb1..af82ffca16 100644 --- a/src/tools/qml2puppet/qml2puppet/configcrashpad.h +++ b/src/tools/qml2puppet/qml2puppet/configcrashpad.h @@ -17,13 +17,21 @@ namespace { #if defined(ENABLE_CRASHPAD) && defined(Q_OS_WIN) - bool startCrashpad() + bool startCrashpad(const QString& libexecPath, const QString& crashReportsPath) { using namespace crashpad; // Cache directory that will store crashpad information and minidumps - base::FilePath database(L"crashpad_reports"); - base::FilePath handler(L"crashpad_handler.exe"); + QString databasePath = QDir::cleanPath(crashReportsPath); + QString handlerPath = QDir::cleanPath(libexecPath + "/crashpad_handler"); + #ifdef Q_OS_WIN + handlerPath += ".exe"; + base::FilePath database(databasePath.toStdWString()); + base::FilePath handler(handlerPath.toStdWString()); + #elif defined(Q_OS_MACOS) || defined(Q_OS_LINUX) + base::FilePath database(databasePath.toStdString()); + base::FilePath handler(handlerPath.toStdString()); + #endif // URL used to submit minidumps to std::string url(CRASHPAD_BACKEND_URL); @@ -58,7 +66,7 @@ namespace { QtSystemExceptionHandler systemExceptionHandler(libexecPath); #endif //#ifdef ENABLE_QT_BREAKPAD #else //#if defined(ENABLE_CRASHPAD) && defined(Q_OS_WIN) - bool startCrashpad() + bool startCrashpad(const QString&, const QString&) { return false; } diff --git a/src/tools/qml2puppet/qml2puppet/editor3d/selectionboxgeometry.cpp b/src/tools/qml2puppet/qml2puppet/editor3d/selectionboxgeometry.cpp index f7e2757e60..8a2a244996 100644 --- a/src/tools/qml2puppet/qml2puppet/editor3d/selectionboxgeometry.cpp +++ b/src/tools/qml2puppet/qml2puppet/editor3d/selectionboxgeometry.cpp @@ -131,6 +131,31 @@ QSSGRenderGraphObject *SelectionBoxGeometry::updateSpatialNode(QSSGRenderGraphOb updateGeometry(); } +#if QT_VERSION_MAJOR == 6 && QT_VERSION_MINOR == 4 + if (!node) { + markAllDirty(); + auto geometryNode = new QSSGRenderGeometry(); + node = geometryNode; + emit geometryNodeDirty(); + + // This is a work around for the issue of incorrect geometry objects getting matched for + // cached mesh data in QSSGBufferManager::loadRenderMesh in QtQuick3D in 6.4 (see QDS-8843). + // Each setting of stride value increments the generation id of the geometry node. + // By incrementing generation id by different amounts, we can ensure QSSGBufferManager cache + // never matches wrong mesh data. + // The cache should be cleared of old objects after they are unused for one frame. + // With puppet reset & multiselection, we can create multiple new boxes per frame, + // so there's no count that really guarantees there are no invalid cache matches, but + // even just 8 should make them very unlikely. + // We start count at 12 here to avoid overlapping with gridgeometry cache ids. + static int dirtyCount = 12; + if (++dirtyCount > 20) + dirtyCount = 12; + for (int i = 0; i < dirtyCount; ++i) + geometryNode->setStride(stride()); + } +#endif + return QQuick3DGeometry::updateSpatialNode(node); } diff --git a/src/tools/qml2puppet/qml2puppet/instances/qmlpropertychangesnodeinstance.cpp b/src/tools/qml2puppet/qml2puppet/instances/qmlpropertychangesnodeinstance.cpp index 04439d1c45..8fa29118d7 100644 --- a/src/tools/qml2puppet/qml2puppet/instances/qmlpropertychangesnodeinstance.cpp +++ b/src/tools/qml2puppet/qml2puppet/instances/qmlpropertychangesnodeinstance.cpp @@ -50,7 +50,20 @@ void QmlPropertyChangesNodeInstance::setPropertyBinding(const PropertyName &name if (QmlPrivateGate::PropertyChanges::isNormalProperty(name)) { // 'restoreEntryValues', 'explicit' ObjectNodeInstance::setPropertyBinding(name, expression); } else { + QObject *state = QmlPrivateGate::PropertyChanges::stateObject(object()); + + ServerNodeInstance activeState = nodeInstanceServer()->activeStateInstance(); + auto activeStateInstance = activeState.internalInstance(); + + const bool inState = activeStateInstance && activeStateInstance->object() == state; + + if (inState) + activeState.deactivateState(); + QmlPrivateGate::PropertyChanges::changeExpression(object(), name, expression); + + if (inState) + activeState.activateState(); } } diff --git a/src/tools/qml2puppet/qml2puppet/instances/quickitemnodeinstance.cpp b/src/tools/qml2puppet/qml2puppet/instances/quickitemnodeinstance.cpp index 99bd116158..f4da2fcc7b 100644 --- a/src/tools/qml2puppet/qml2puppet/instances/quickitemnodeinstance.cpp +++ b/src/tools/qml2puppet/qml2puppet/instances/quickitemnodeinstance.cpp @@ -853,9 +853,14 @@ void QuickItemNodeInstance::setPropertyVariant(const PropertyName &name, const Q void QuickItemNodeInstance::setPropertyBinding(const PropertyName &name, const QString &expression) { static QList<PropertyName> anchorsTargets = {"anchors.top", - "acnhors.bottom", + "anchors.bottom", "anchors.left", - "achors.right"}; + "anchors.right", + "anchors.horizontalCenter", + "anchors.verticalCenter", + "anchors.fill", + "anchors.centerIn", + "anchors.baseline"}; if (ignoredProperties().contains(name)) return; diff --git a/src/tools/qml2puppet/qml2puppet/qmlbase.h b/src/tools/qml2puppet/qml2puppet/qmlbase.h index c73bd7fcc6..ae8995f489 100644 --- a/src/tools/qml2puppet/qml2puppet/qmlbase.h +++ b/src/tools/qml2puppet/qml2puppet/qmlbase.h @@ -40,10 +40,12 @@ public: , m_args({argc, argv}) { m_argParser.setApplicationDescription("QML Runtime Provider for QDS"); - m_argParser.addOptions({{"qml-puppet", "Run QML Puppet (default)"}, - {"qml-runtime", "Run QML Runtime"}, - {"appinfo", "Print build information"}, - {"test", "Run test mode"}}); + m_argParser.addOption({"qml-puppet", "Run QML Puppet (default)"}); +#ifdef ENABLE_INTERNAL_QML_RUNTIME + m_argParser.addOption({"qml-runtime", "Run QML Runtime"}); +#endif + m_argParser.addOption({"appinfo", "Print build information"}); + m_argParser.addOption({"test", "Run test mode"}); } int run() @@ -93,8 +95,13 @@ private: QCommandLineOption optVers = m_argParser.addVersionOption(); if (!m_argParser.parse(m_coreApp->arguments())) { - std::cout << "Error: " << m_argParser.errorText().toStdString() << std::endl - << std::endl; + std::cout << "Error: " << m_argParser.errorText().toStdString() << std::endl; + if (m_argParser.errorText().contains("qml-runtime")) { + std::cout << "Note: --qml-runtime is only availabe when Qt is 6.4.x or higher" + << std::endl; + } + std::cout << std::endl; + m_argParser.showHelp(1); } else if (m_argParser.isSet(optVers)) { m_argParser.showVersion(); diff --git a/src/tools/qml2puppet/qml2puppet/qmlpuppet.cpp b/src/tools/qml2puppet/qml2puppet/qmlpuppet.cpp index 4025cae41b..6d3fa2ce36 100644 --- a/src/tools/qml2puppet/qml2puppet/qmlpuppet.cpp +++ b/src/tools/qml2puppet/qml2puppet/qmlpuppet.cpp @@ -8,6 +8,7 @@ #include <sqlitelibraryinitializer.h> #endif +#include <app/app_version.h> #include <qml2puppet/iconrenderer/iconrenderer.h> #include <qml2puppet/import3d/import3d.h> @@ -16,6 +17,7 @@ #include <QFileInfo> #include <QQmlComponent> #include <QQmlEngine> +#include <QSettings> #if defined(Q_OS_WIN) && defined(QT_NO_DEBUG) #include <Windows.h> @@ -75,6 +77,24 @@ void QmlPuppet::populateParser() {"import3dAsset", "Import 3d asset.", "sourceAsset, outDir, importOptJson"}}); } +// should be in sync with coreplugin/icore.cpp -> FilePath ICore::crashReportsPath() +// and src\app\main.cpp +QString crashReportsPath() +{ + QSettings settings( + QSettings::IniFormat, + QSettings::UserScope, + QLatin1String(Core::Constants::IDE_SETTINGSVARIANT_STR), + QLatin1String(Core::Constants::IDE_CASED_ID)); + +#if defined(Q_OS_MACOS) + return QFileInfo(settings.fileName()).path() + "/crashpad_reports"; +#else + return QCoreApplication::applicationDirPath() + + '/' + RELATIVE_LIBEXEC_PATH + "crashpad_reports"; +#endif +} + void QmlPuppet::initQmlRunner() { if (m_coreApp->arguments().count() < 2 @@ -117,7 +137,8 @@ void QmlPuppet::initQmlRunner() Import3D::import3D(sourceAsset, outDir, options); } - startCrashpad(); + startCrashpad(QCoreApplication::applicationDirPath() + + '/' + RELATIVE_LIBEXEC_PATH, crashReportsPath()); new QmlDesigner::Qt5NodeInstanceClientProxy(m_coreApp.get()); diff --git a/src/tools/qml2puppet/qmlprivategate/qmlprivategate.cpp b/src/tools/qml2puppet/qmlprivategate/qmlprivategate.cpp index b9a65bb6b2..7fd4e75dc2 100644 --- a/src/tools/qml2puppet/qmlprivategate/qmlprivategate.cpp +++ b/src/tools/qml2puppet/qmlprivategate/qmlprivategate.cpp @@ -193,6 +193,14 @@ static bool isDelegateModel(QObject *object) return false; } +static bool isConnections(QObject *object) +{ + if (object) + return isMetaObjectofType(object->metaObject(), "QQmlConnections"); + + return false; +} + // This is used in share/qtcreator/qml/qmlpuppet/qml2puppet/instances/objectnodeinstance.cpp QObject *createPrimitive(const QString &typeName, int majorNumber, int minorNumber, QQmlContext *context) { @@ -389,7 +397,7 @@ void doComponentCompleteRecursive(QObject *object, NodeInstanceServer *nodeInsta doComponentCompleteRecursive(child, nodeInstanceServer); } - if (!isQuickStyleItem(object) && !isDelegateModel(object)) { + if (!isQuickStyleItem(object) && !isDelegateModel(object) && !isConnections(object)) { if (item) { static_cast<QQmlParserStatus *>(item)->componentComplete(); } else { diff --git a/src/tools/qml2puppet/windows_application_icon/qml2puppet.rc b/src/tools/qml2puppet/windows_application_icon/qml2puppet.rc new file mode 100644 index 0000000000..b2d07923e3 --- /dev/null +++ b/src/tools/qml2puppet/windows_application_icon/qml2puppet.rc @@ -0,0 +1,30 @@ +#include <windows.h> + +#define STRINGIFY1(x) #x +#define STRINGIFY(x) STRINGIFY1(x) + +#define ICON_PATH STRINGIFY(RC_ICON_PATH/qtcreator.ico) + +IDI_ICON1 ICON DISCARDABLE ICON_PATH + +VS_VERSION_INFO VERSIONINFO + FILEVERSION RC_VERSION + PRODUCTVERSION RC_VERSION +{ + BLOCK "StringFileInfo" + { + // U.S. English - Windows, Multilingual + BLOCK "040904E4" + { + VALUE "FileDescription", STRINGIFY(RC_APPLICATION_NAME) + VALUE "FileVersion", STRINGIFY(RC_VERSION_STRING) + VALUE "ProductName", STRINGIFY(RC_APPLICATION_NAME) + VALUE "ProductVersion", STRINGIFY(RC_VERSION_STRING) + VALUE "LegalCopyright", STRINGIFY(RC_COPYRIGHT) + } + } + BLOCK "VarFileInfo" + { + VALUE "Translation", 0x409, 1252 // 1252 = 0x04E4 + } +} |
