diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index 6d2ff5c545a..92ce88f52cc 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -372,7 +372,7 @@ jobs: - name: ccache cache files - uses: actions/cache@v1.1.0 + uses: actions/cache@v1 with: path: .ccache key: ${{ matrix.config.name }}-ccache-${{ steps.ccache_cache_timestamp.outputs.ide_major_version }}-${{ steps.ccache_cache_timestamp.outputs.timestamp }} @@ -432,7 +432,7 @@ jobs: COMMAND git log --format=%B -n 1 ${{ github.event.after }} OUTPUT_VARIABLE git_commit_msg ) - if (${git_commit_msg} MATCHES "ccache:[ ]*clea[r|n]") + if ("${git_commit_msg}" MATCHES "ccache:[ ]*clea[r|n]") execute_process(COMMAND ccache --clear COMMAND_ECHO STDOUT) endif() diff --git a/doc/qtcreator/config/qtcreator-project.qdocconf b/doc/qtcreator/config/qtcreator-project.qdocconf index ed35b4e41ee..b190e87ea12 100644 --- a/doc/qtcreator/config/qtcreator-project.qdocconf +++ b/doc/qtcreator/config/qtcreator-project.qdocconf @@ -4,6 +4,7 @@ url = http://doc.qt.io/$IDE_ID #Words to ignore for auto-linking ignorewords += \ + Boot2Qt \ macOS \ WebChannel \ WebSocket \ diff --git a/doc/qtcreator/images/beautifier_editor.png b/doc/qtcreator/images/beautifier_editor.png index 52d0ded29f0..cddae8b5412 100644 Binary files a/doc/qtcreator/images/beautifier_editor.png and b/doc/qtcreator/images/beautifier_editor.png differ diff --git a/doc/qtcreator/images/beautifier_options.png b/doc/qtcreator/images/beautifier_options.png index 00b65a9fd9e..9fe23ef7df9 100644 Binary files a/doc/qtcreator/images/beautifier_options.png and b/doc/qtcreator/images/beautifier_options.png differ diff --git a/doc/qtcreator/images/qt-creator-beautifier-options-general.png b/doc/qtcreator/images/qt-creator-beautifier-options-general.png index 3f476be156f..5a33d6c7abc 100644 Binary files a/doc/qtcreator/images/qt-creator-beautifier-options-general.png and b/doc/qtcreator/images/qt-creator-beautifier-options-general.png differ diff --git a/doc/qtcreator/images/qtcreator-beautifier-options-clangformat.png b/doc/qtcreator/images/qtcreator-beautifier-options-clangformat.png new file mode 100644 index 00000000000..d9d2b4c6f5b Binary files /dev/null and b/doc/qtcreator/images/qtcreator-beautifier-options-clangformat.png differ diff --git a/doc/qtcreator/src/analyze/cpu-usage-analyzer.qdoc b/doc/qtcreator/src/analyze/cpu-usage-analyzer.qdoc index 2e931ee0499..5c668c1163e 100644 --- a/doc/qtcreator/src/analyze/cpu-usage-analyzer.qdoc +++ b/doc/qtcreator/src/analyze/cpu-usage-analyzer.qdoc @@ -460,7 +460,7 @@ \list 1 \li Perf events may be globally disabled on your system. The - preconfigured Boot2Qt images come with perf events enabled. For + preconfigured \l Boot2Qt images come with perf events enabled. For a custom configuration you need to make sure that the file \c {/proc/sys/kernel/perf_event_paranoid} contains a value smaller than \c {2}. For maximum flexibility in recording traces you can diff --git a/doc/qtcreator/src/editors/creator-coding.qdoc b/doc/qtcreator/src/editors/creator-coding.qdoc index 3638a431fb0..1824e720639 100644 --- a/doc/qtcreator/src/editors/creator-coding.qdoc +++ b/doc/qtcreator/src/editors/creator-coding.qdoc @@ -32,7 +32,7 @@ /*! \page creator-coding.html \if defined(qtdesignstudio) - \previouspage studio-implementing-applications.html + \previouspage studio-designer-developer-workflow.html \else \previouspage creator-usability.html \endif diff --git a/doc/qtcreator/src/editors/creator-only/creator-beautifier.qdoc b/doc/qtcreator/src/editors/creator-only/creator-beautifier.qdoc index f8699d0da24..3debec6131b 100644 --- a/doc/qtcreator/src/editors/creator-only/creator-beautifier.qdoc +++ b/doc/qtcreator/src/editors/creator-only/creator-beautifier.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Creator documentation. @@ -82,7 +82,7 @@ automatically beautify files when you save them using the tool you select in the \uicontrol Tool field. - \image qt-creator-beautifier-options-general.png + \image qt-creator-beautifier-options-general.png "General Beautifier options" \li In the \uicontrol {Restrict to MIME types} field, define the MIME types of the files to beautify, separated by semicolons. Leave the @@ -101,7 +101,7 @@ \uicontrol Uncrustify to specify settings for the tool you want to use. - \image beautifier_options.png + \image beautifier_options.png "Uncrustify Beautifier options" \li In the \uicontrol Configuration group, specify the path to the tool executable in the \uicontrol {Artistic Style command}, @@ -119,27 +119,28 @@ \list - \li Select the \uicontrol {Use file defined in project files} - option to use the configuration file defined in the qmake - DISTFILES variable as the configuration file for the - selected tool. This option is available for Artistic Style - and Uncrustify. + \li Select \uicontrol {Use file *.astylerc defined in project files} + or \uicontrol {Use file uncrustify.cfg defined in project files}, + to use the configuration file defined in the qmake DISTFILES + variable as the configuration file for the selected tool. - \li Select the \uicontrol {Use specific config file} option to + \li Select \uicontrol {Use specific config file} or + \uicontrol {Use file specific uncrustify.cfg} to use the specified file as the configuration file for the - selected tool. This option is available for Artistic Style - and Uncrustify. + selected tool. - \li Select the \uicontrol {Use file in $HOME} option to use the - specified file in the user's home directory as the - configuration file for the selected tool. This option is - available for Artistic Style and Uncrustify. + \li Select \uicontrol {Use file uncrustify.cfg in <$HOME>} or + \uicontrol {Use file .astylerc or acstylerc in <$HOME>} to + use the specified file in the user's home directory as the + configuration file for the selected tool. \li For Clang Format, you can use a predefined style, by selecting the \uicontrol {Use predefined style} radio button, and then selecting the style to use from the list of available styles. + \image qtcreator-beautifier-options-clangformat.png "Clang Format Beautifier options" + Select \uicontrol File to load the style configuration from the \c .clang-format or \c _clang-format file located in the same directory as the source file or in one of its parent @@ -158,7 +159,7 @@ highlighting, auto-completion, and context-sensitive help. For these features, you must have the tool installed. - \image beautifier_editor.png + \image beautifier_editor.png "Add Configuration dialog" \endlist @@ -172,13 +173,13 @@ \endlist - In addition to the \uicontrol {Format Current File} command, ClangFormat - and Uncrustify provide additional commands. + In addition, ClangFormat provides the \uicontrol {Format at Cursor} command. If you select it when no text is selected, the syntactic entity under the cursor is formatted. The \uicontrol {Disable Formatting for Selected Text} command wraps selected lines within \c {// clang-format off} and \c {// clang-format on}. + Uncrustify provides the \uicontrol {Format Selected Text} command. If you select it when no text is selected, the whole file is formatted by default. To disable this behavior, deselect the diff --git a/doc/qtcreator/src/editors/creator-only/creator-text-editing-macros.qdoc b/doc/qtcreator/src/editors/creator-only/creator-text-editing-macros.qdoc index 99f5f00e379..17b15106276 100644 --- a/doc/qtcreator/src/editors/creator-only/creator-text-editing-macros.qdoc +++ b/doc/qtcreator/src/editors/creator-only/creator-text-editing-macros.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Creator documentation. @@ -32,9 +32,9 @@ To record a text editing macro, select \uicontrol Tools > \uicontrol {Text Editing Macros} > \uicontrol {Record Macro} - or press \key {Alt+(}. To stop recording, select \uicontrol Tools > + or press \key {Alt+[}. To stop recording, select \uicontrol Tools > \uicontrol {Text Editing Macros} > \uicontrol {Stop Recording Macro} or - press \key {Alt+)}. + press \key {Alt+]}. \note The macro recorder does not support code completion. diff --git a/doc/qtcreator/src/howto/creator-keyboard-shortcuts.qdoc b/doc/qtcreator/src/howto/creator-keyboard-shortcuts.qdoc index 56d78ffcd3b..8ac3aff9aa1 100644 --- a/doc/qtcreator/src/howto/creator-keyboard-shortcuts.qdoc +++ b/doc/qtcreator/src/howto/creator-keyboard-shortcuts.qdoc @@ -505,10 +505,10 @@ \if defined(qtcreator) \row \li Record a text-editing macro - \li Alt+( + \li Alt+[ \row \li Stop recording a macro - \li Alt+) + \li Alt+] \row \li Play last macro \li Alt+R diff --git a/doc/qtcreator/src/howto/creator-only/qtcreator-faq.qdoc b/doc/qtcreator/src/howto/creator-only/qtcreator-faq.qdoc index 9be304d7165..a79e2238bdb 100644 --- a/doc/qtcreator/src/howto/creator-only/qtcreator-faq.qdoc +++ b/doc/qtcreator/src/howto/creator-only/qtcreator-faq.qdoc @@ -282,8 +282,8 @@ \uicontrol{Application Output} pane. However, only one output pane tab may be open at a time or the output is not displayed correctly. You can use an external debug output viewer, such as the - \l{http://technet.microsoft.com/en-us/sysinternals/bb896647}{DebugView for Windows} - to display output from GUI applications. + \l{https://technet.microsoft.com/en-us/sysinternals/bb896647} + {DebugView for Windows} to display output from GUI applications. \section1 Questions about New Features diff --git a/doc/qtcreator/src/linux-mobile/b2qtdev.qdoc b/doc/qtcreator/src/linux-mobile/b2qtdev.qdoc index 5a4943030ee..e9d4e470f9f 100644 --- a/doc/qtcreator/src/linux-mobile/b2qtdev.qdoc +++ b/doc/qtcreator/src/linux-mobile/b2qtdev.qdoc @@ -33,22 +33,22 @@ You can connect \l{Boot2Qt} devices to the development PC to run, debug, and analyze applications built for them from \QC. - If you have a tool chain for building applications for \Boot2Qt devices + If you have a tool chain for building applications for Boot2Qt devices installed on the development PC, you can add it to \QC. You can then - select a \l{glossary-buildandrun-kit}{kit} with the \uicontrol \Boot2Qt + select a \l{glossary-buildandrun-kit}{kit} with the \uicontrol Boot2Qt device type to build applications for and run them on the devices. - To be able to run and debug applications on \Boot2Qt devices, + To be able to run and debug applications on Boot2Qt devices, you must add devices and select them in the \QC \l{glossary-buildandrun-kit}{kit}. \section1 Enabling the Boot2Qt Plugin - To enable the \Boot2Qt plugin: + To enable the Boot2Qt plugin: \list 1 \li Select \uicontrol Help > \uicontrol {About Plugins} > - \uicontrol {Device Support} > \uicontrol \Boot2Qt to + \uicontrol {Device Support} > \uicontrol Boot2Qt to enable the plugin. \li Select \uicontrol {Restart Now} to restart \QC and load the plugin. \endlist @@ -93,7 +93,7 @@ \section1 Flashing Boot2Qt Devices - To flash the \Boot2Qt image to an SD card with Flashing Wizard, select + To flash the Boot2Qt image to an SD card with Flashing Wizard, select \uicontrol Tools > \uicontrol {Flash Boot to Qt Device} and follow the instructions of the wizard. @@ -101,7 +101,7 @@ \section1 Configuring Connections - To configure connections between \QC and a \Boot2Qt device and to + To configure connections between \QC and a Boot2Qt device and to specify build and run settings for the device: \list 1 @@ -109,19 +109,19 @@ connect it with a USB connection. \li Select \uicontrol Tools > \uicontrol Options > \uicontrol Kits > \uicontrol {Qt Versions} > \uicontrol Add to add the Qt version - for \Boot2Qt. + for Boot2Qt. \li Select \uicontrol Tools > \uicontrol Options > \uicontrol Kits > \uicontrol Compilers > \uicontrol Add to add the compiler for building the applications. \li Select \uicontrol Tools > \uicontrol {Flash Boot to Qt Device} - to flash the \Boot2Qt image to an SD card with Flashing Wizard. + to flash the Boot2Qt image to an SD card with Flashing Wizard. \li To deploy applications and run them remotely on devices, specify parameters for connecting to the devices over the network (\QC automatically detects devices connected with USB): \list 1 \li Select \uicontrol Tools > \uicontrol Options > \uicontrol Devices > \uicontrol Devices > \uicontrol Add > - \uicontrol \Boot2Qt > \uicontrol {Finish}. + \uicontrol Boot2Qt > \uicontrol {Finish}. \image qtcreator-devices-boot2qt.png "Boot2Qt Network Device Setup wizard" \li In the \uicontrol {Device name} field, enter a name for the connection. @@ -139,7 +139,7 @@ \li Select \uicontrol Tools > \uicontrol Options > \uicontrol Kits > \uicontrol Add to add a kit for building applications for the device. Select the Qt version, compiler, and device that you - added above, and choose \uicontrol \Boot2Qt as the device type. + added above, and choose \uicontrol Boot2Qt as the device type. \li To specify build settings: \list 1 \li Open a project for an application you want to develop for the diff --git a/doc/qtcreator/src/linux-mobile/creator-projects-settings-run-b2qt.qdocinc b/doc/qtcreator/src/linux-mobile/creator-projects-settings-run-b2qt.qdocinc index 167de0044ce..864a449bcc6 100644 --- a/doc/qtcreator/src/linux-mobile/creator-projects-settings-run-b2qt.qdocinc +++ b/doc/qtcreator/src/linux-mobile/creator-projects-settings-run-b2qt.qdocinc @@ -28,7 +28,7 @@ \section1 Specifying Run Settings for Boot2Qt Devices - To run and debug an application on a Boot2Qt device (commercial only), you + To run and debug an application on a \l Boot2Qt device (commercial only), you must create connections from the development host to the device and add the device configurations to \l{glossary-buildandrun-kit}{kits}. Select \uicontrol {Manage Kits} to add devices to kits. For more information, see diff --git a/doc/qtcreator/src/qtquick/qtquick-from-qmlproject-to-pro.qdoc b/doc/qtcreator/src/qtquick/qtquick-from-qmlproject-to-pro.qdoc index 9a6a39645c7..b1c7c4d3ce9 100644 --- a/doc/qtcreator/src/qtquick/qtquick-from-qmlproject-to-pro.qdoc +++ b/doc/qtcreator/src/qtquick/qtquick-from-qmlproject-to-pro.qdoc @@ -29,7 +29,7 @@ \previouspage studio-porting-projects.html \nextpage creator-editor-external.html \else - \previouspage quick-projects.html + \previouspage creator-qtquickdesigner-plugin.html \nextpage creator-quick-ui-forms.html \endif @@ -39,9 +39,9 @@ use them for application development in Qt Creator you have to add: \list - \li Project configuration file (.pro) + \li Project configuration file (CMakeLists.txt or .pro) \li C++ code (.cpp) - \li Resource files (.qrc) + \li Resource files \li Code needed for deploying applications to \l{glossary-device} {devices} \endlist @@ -49,9 +49,22 @@ For more information about integrating QML and C++, see \l{Overview - QML and C++ Integration}. - You can use a Qt Creator wizard template to create a Qt Quick application - that is built using the qmake build system and then copy the source files - from the Qt UI Quick project to the application project. + \note Since \QDS 2.3.0, \QDS project wizard templates generate projects that + can be built with CMake. You can open the \e CMakeLists.txt project file in + Qt Creator to continue developing the project. + + \if defined(qtdesignstudio) + For more information, see \l{Designer-Developer Workflow}. + \else + For more information about using \QDS to create projects, see + \l{Qt Design Studio Manual}. + \endif + + + If you want to use qmake as the build system, you can use a Qt Creator + wizard template to create a Qt Quick application that is built using the + qmake build system and then copy the source files from the Qt UI Quick + project to the application project. You can use the \c RESOURCES option in the project configuration file to automatically add all the QML files and related assets to a @@ -80,7 +93,7 @@ your Qt to be able to build your project. For more information, see \l{Adding Qt Quick Timeline Module to Qt Installations}. - \section1 Converting Projects + \section1 Converting into qmake Projects To convert a project that has a .qmlproject file to one that has a .pro file: diff --git a/doc/qtdesignstudio/images/studio-project-structure.png b/doc/qtdesignstudio/images/studio-project-structure.png new file mode 100644 index 00000000000..347b74b0a36 Binary files /dev/null and b/doc/qtdesignstudio/images/studio-project-structure.png differ diff --git a/doc/qtdesignstudio/src/developers/studio-designer-developer-workflow.qdoc b/doc/qtdesignstudio/src/developers/studio-designer-developer-workflow.qdoc new file mode 100644 index 00000000000..45314db2106 --- /dev/null +++ b/doc/qtdesignstudio/src/developers/studio-designer-developer-workflow.qdoc @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Studio documentation. +** +** 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 Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** +****************************************************************************/ + +/*! + \page studio-designer-developer-workflow.html + \previouspage studio-implementing-applications.html + \nextpage creator-coding.html + + \title Designer-Developer Workflow + + \QDS enables designers and developers to work together on common + projects to develop applications. Designers use the \l{Design Views}{views} + in the \uicontrol Design mode to modify \l{UI Files}{UI files} (\e .ui.qml), + whereas developers use Qt Creator to work on the Qt Quick (\e .qml) and + other files that are needed to implement the application logic and to + prepare the application for production. + + Use the \l{Using Git}{Git} version control system to ensure that changes + are not lost when files are passed back and forth between designers and + developers. + + \QDS \l{Creating Projects}{projects} come with boilerplate code for a + working Qt 6 application that you can build and run in Qt Creator using + CMake. Therefore, you can open, build, and run the projects with Qt Creator. + + \QDS continues to use the \e .qmlproject file format, while \QC uses a + \e CMakeLists.txt file as the project file. This enables you to share + your project as a fully working C++ application with developers. + + If you add or remove QML files in \QDS, you have to regenerate the + \e CMakeLists.txt project configuration file by selecting \uicontrol Build + > \uicontrol Run > \uicontrol {Generate CMakeLists.txt Files}. + + If you use Git, you can clone an example project + \l{https://git.qt.io/public-demos/qtdesign-studio/-/tree/master/playground/AuroraCluster0} + {here}. + + The following image shows the example project structure and contents in the + \l Projects and \l {File System} views in \QDS and Qt Creator: + + \image studio-project-structure.png "\QDS project in \QDS and Qt Creator views" +*/ diff --git a/doc/qtdesignstudio/src/qtdesignstudio-implementing-applications.qdoc b/doc/qtdesignstudio/src/qtdesignstudio-implementing-applications.qdoc index ccb3d2999f4..e1f617ada30 100644 --- a/doc/qtdesignstudio/src/qtdesignstudio-implementing-applications.qdoc +++ b/doc/qtdesignstudio/src/qtdesignstudio-implementing-applications.qdoc @@ -26,7 +26,7 @@ /*! \previouspage studio-optimized-3d-scenes.html \page studio-implementing-applications.html - \nextpage creator-coding.html + \nextpage studio-designer-developer-workflow.html \title Implementing Applications @@ -38,13 +38,19 @@ the default configuration allows you to start wireframing, prototyping, and validating UIs with very little effort. - However, you might want to use the \l{Text Editor} view - sometimes to edit your component files (.qml). If you use - JavaScript, you might also want to debug and profile you - UIs to find and fix problems in them. + You can use the \l{Text Editor} view to edit your component + files (.qml). If you use JavaScript, you can debug and profile + your UIs to find and fix problems in them. \endtable \list + + \li \l{Designer-Developer Workflow} + + In \QDS projects, you work on \l{UI Files}{UI files} (.ui.qml), + while developers work on the .qml and C++ source files in + Qt Creator to create an application that you can build and + run on target hardware. \li \l{Coding} You can use the code editor in the \uicontrol {Text Editor} view or diff --git a/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc b/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc index dc8dea8f13f..52ba3915318 100644 --- a/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc +++ b/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc @@ -207,9 +207,7 @@ \endlist \li \l{Implementing Applications} \list - \omit - \li Using Flows in Production - \endomit + \li \l{Designer-Developer Workflow} \li \l{Coding}{Cross-Platform Development} \list \li \l{Writing Code} @@ -245,15 +243,6 @@ \li \l{Debugging a Qt Quick Example Application} \li \l{Profiling QML Applications} \endlist - \omit - \li \l{Designer-Developer Workflow} - \list - \li \l{Reusable Prototypes and Full UI Implementation} - \li \l{Optimizing Specification and Implementation} - \li \l{Parallel Development} - \li \l{One Toolchain} - \endlist - \endomit \endlist \li \l{Advanced Designer Topics} \list diff --git a/doc/qtdesignstudio/src/qtdesignstudio.qdoc b/doc/qtdesignstudio/src/qtdesignstudio.qdoc index 3a1306300dc..22057fb4105 100644 --- a/doc/qtdesignstudio/src/qtdesignstudio.qdoc +++ b/doc/qtdesignstudio/src/qtdesignstudio.qdoc @@ -87,6 +87,7 @@ \row \li \b {\l{Implementing Applications}} \list + \li \l{Designer-Developer Workflow} \li \l{Coding}{Cross-Platform Development} \li \l{Debugging and Profiling} \endlist diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp index 545457ccbec..6eb7a7146e0 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.cpp @@ -104,6 +104,12 @@ #endif #endif +#ifdef QUICK3D_PARTICLES_MODULE +#include +#include +#include +#endif + #ifdef IMPORT_QUICK3D_ASSETS #include #endif @@ -147,12 +153,6 @@ static bool imageHasContent(const QImage &image) return false; } -static bool isQuick3DMode() -{ - static bool mode3D = qEnvironmentVariableIsSet("QMLDESIGNER_QUICK3D_MODE"); - return mode3D; -} - static QObjectList toObjectList(const QVariant &variantList) { QObjectList objList; @@ -325,7 +325,7 @@ void Qt5InformationNodeInstanceServer::updateRotationBlocks(const QVector blockedNodes; QSet unblockedNodes; - const PropertyName propName = "rotBlocked@internal"; + const PropertyName propName = "rotBlocked@Internal"; for (const auto &container : valueChanges) { if (container.name() == propName) { ServerNodeInstance instance = instanceForId(container.instanceId()); @@ -418,7 +418,7 @@ void Qt5InformationNodeInstanceServer::resetParticleSystem() void Qt5InformationNodeInstanceServer::handleParticleSystemSelected(QQuick3DParticleSystem* targetParticleSystem) { - if (!m_particleAnimationDriver) + if (!m_particleAnimationDriver || targetParticleSystem == m_targetParticleSystem) return; m_particleAnimationDriver->reset(); @@ -459,7 +459,46 @@ static QString baseProperty(const QString &property) return property; } -void Qt5InformationNodeInstanceServer::handleParticleSystemDeselected() +template +static QQuick3DParticleSystem *systemProperty(QObject *object) +{ + return qobject_cast(object) ? qobject_cast(object)->system() : nullptr; +} + +static QQuick3DParticleSystem *getSystemOrSystemProperty(QObject *selectedObject) +{ + QQuick3DParticleSystem *system = nullptr; + system = qobject_cast(selectedObject); + if (system) + return system; + system = systemProperty(selectedObject); + if (system) + return system; + system = systemProperty(selectedObject); + if (system) + return system; + system = systemProperty(selectedObject); + if (system) + return system; + return nullptr; +} + +static QQuick3DParticleSystem *parentParticleSystem(QObject *selectedObject) +{ + auto *ps = getSystemOrSystemProperty(selectedObject); + if (ps) + return ps; + QObject *parent = selectedObject->parent(); + while (parent) { + ps = getSystemOrSystemProperty(parent); + if (ps) + return ps; + parent = parent->parent(); + } + return nullptr; +} + +void Qt5InformationNodeInstanceServer::handleParticleSystemDeselected(QObject *selectedObject) { m_targetParticleSystem = nullptr; const auto anim = animations(); @@ -1830,9 +1869,7 @@ void Qt5InformationNodeInstanceServer::changeSelection(const ChangeSelectionComm { if (!m_editView3DSetupDone) return; -#ifdef QUICK3D_PARTICLES_MODULE - resetParticleSystem(); -#endif + m_lastSelectionChangeCommand = command; if (m_selectionChangeTimer.isActive()) { // If selection was recently changed by puppet, hold updating the selection for a bit to @@ -1861,10 +1898,17 @@ void Qt5InformationNodeInstanceServer::changeSelection(const ChangeSelectionComm #ifdef QUICK3D_PARTICLES_MODULE auto particlesystem = qobject_cast(instance.internalObject()); - if (particlesystem) + if (particlesystem) { handleParticleSystemSelected(particlesystem); - else - handleParticleSystemDeselected(); + } else { + particlesystem = parentParticleSystem(instance.internalObject()); + if (particlesystem) { + if (particlesystem != m_targetParticleSystem) + handleParticleSystemSelected(particlesystem); + } else { + handleParticleSystemDeselected(instance.internalObject()); + } + } #endif auto isSelectableAsRoot = [&]() -> bool { #ifdef QUICK3D_MODULE diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h index 25a4b900ce8..ef6f576dac9 100644 --- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h +++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5informationnodeinstanceserver.h @@ -149,7 +149,7 @@ private: #ifdef QUICK3D_PARTICLES_MODULE void handleParticleSystemSelected(QQuick3DParticleSystem* targetParticleSystem); void resetParticleSystem(); - void handleParticleSystemDeselected(); + void handleParticleSystemDeselected(QObject *selectedObject); #endif RenderViewData m_editView3DData; diff --git a/share/qtcreator/qmldesigner/newprojectdialog/imports/NewProjectDialog/Details.qml b/share/qtcreator/qmldesigner/newprojectdialog/imports/NewProjectDialog/Details.qml index 7399db69149..9c4f2596484 100644 --- a/share/qtcreator/qmldesigner/newprojectdialog/imports/NewProjectDialog/Details.qml +++ b/share/qtcreator/qmldesigner/newprojectdialog/imports/NewProjectDialog/Details.qml @@ -73,6 +73,10 @@ Item { color: DialogValues.textColor selectByMouse: true + onEditingFinished: { + text = text.charAt(0).toUpperCase() + text.slice(1) + } + font.pixelSize: DialogValues.paneTitlePixelSize } diff --git a/src/libs/qmljs/qmljscheck.cpp b/src/libs/qmljs/qmljscheck.cpp index 1bfd9e9701d..f280b53c01a 100644 --- a/src/libs/qmljs/qmljscheck.cpp +++ b/src/libs/qmljs/qmljscheck.cpp @@ -810,6 +810,8 @@ bool Check::visit(UiObjectInitializer *) void Check::endVisit(UiObjectInitializer *uiObjectInitializer) { + Q_UNUSED(uiObjectInitializer) + m_propertyStack.pop(); const QString type = m_typeStack.pop(); diff --git a/src/libs/qtcreatorcdbext/eventcallback.cpp b/src/libs/qtcreatorcdbext/eventcallback.cpp index caafd9c3e2f..2e887f5de92 100644 --- a/src/libs/qtcreatorcdbext/eventcallback.cpp +++ b/src/libs/qtcreatorcdbext/eventcallback.cpp @@ -173,14 +173,14 @@ STDMETHODIMP EventCallback::Exception( __in ULONG FirstChance ) { + const ExtensionContext::StopReasonMap parameters = exceptionParameters(*Ex, FirstChance); + ExtensionContext::instance().setStopReason(parameters, "exception"); if ((FirstChance && ExtensionContext::instance().parameters().firstChanceException != 0) || (!FirstChance && ExtensionContext::instance().parameters().secondChanceException != 0)) { // Report the exception as GBMI and set potential stop reason - const ExtensionContext::StopReasonMap parameters = exceptionParameters(*Ex, FirstChance); std::ostringstream str; formatGdbmiHash(str, parameters); - ExtensionContext::instance().setStopReason(parameters, "exception"); ExtensionContext::instance().report('E', 0, 0, "exception", "%s", str.str().c_str()); } return m_wrapped ? m_wrapped->Exception(Ex, FirstChance) : S_OK; diff --git a/src/libs/utils/infobar.cpp b/src/libs/utils/infobar.cpp index 230473b31bb..f481113b4eb 100644 --- a/src/libs/utils/infobar.cpp +++ b/src/libs/utils/infobar.cpp @@ -344,7 +344,7 @@ void InfoBarDisplay::update() if (info.m_cancelButtonCallBack) connect(infoWidgetCloseButton, &QAbstractButton::clicked, info.m_cancelButtonCallBack); connect(infoWidgetCloseButton, &QAbstractButton::clicked, this, [this, id] { - m_infoBar->suppressInfo(id); + m_infoBar->removeInfo(id); }); } diff --git a/src/plugins/android/androidqmlpreviewworker.cpp b/src/plugins/android/androidqmlpreviewworker.cpp index ced1c06f5fa..60372f33dce 100644 --- a/src/plugins/android/androidqmlpreviewworker.cpp +++ b/src/plugins/android/androidqmlpreviewworker.cpp @@ -35,6 +35,7 @@ #include #include +#include #include #include #include @@ -56,7 +57,7 @@ namespace Internal { using namespace Utils; -#define APP_ID "io.qt.designviewer" +#define APP_ID "io.qt.qtdesignviewer" class ApkInfo { public: @@ -91,7 +92,7 @@ FilePath AndroidQmlPreviewWorker::designViewerApkPath(const QString &abi) const return {}; if (apkInfo()->abis.contains(abi)) { - return Core::ICore::resourcePath(QString("android/qtdesignviewer/designviewer_%1.apk") + return Core::ICore::resourcePath(QString("android/qtdesignviewer/qtdesignviewer_%1.apk") .arg(abi)); } return {}; @@ -424,9 +425,14 @@ bool AndroidQmlPreviewWorker::startPreviewApp() const QDir destDir(apkInfo()->uploadDir); const QString qmlrcPath = destDir.filePath(m_uploadInfo.uploadPackage.baseName() + packageSuffix); - const QStringList command{"am", "start", - "-n", apkInfo()->activityId, - "-e", "extraappparams", QLatin1String(qmlrcPath.toUtf8().toBase64())}; + const QStringList envVars = m_rc->aspect()->environment().toStringList(); + + const QStringList command { + "am", "start", + "-n", apkInfo()->activityId, + "-e", "extraappparams", QLatin1String(qmlrcPath.toUtf8().toBase64()), + "-e", "extraenvvars", QLatin1String(envVars.join('\t').toUtf8().toBase64()) + }; const SdkToolResult result = runAdbShellCommand(command); if (result.success()) appendMessage(tr("%1 is running.").arg(apkInfo()->name), NormalMessageFormat); diff --git a/src/plugins/android/avddialog.cpp b/src/plugins/android/avddialog.cpp index 795537e1db7..0f9f25e2295 100644 --- a/src/plugins/android/avddialog.cpp +++ b/src/plugins/android/avddialog.cpp @@ -51,9 +51,9 @@ static Q_LOGGING_CATEGORY(avdDialogLog, "qtc.android.avdDialog", QtWarningMsg) AvdDialog::AvdDialog(const AndroidConfig &config, QWidget *parent) : QDialog(parent), + m_allowedNameChars(QLatin1String("[a-z|A-Z|0-9|._-]*")), m_androidConfig(config), - m_sdkManager(m_androidConfig), - m_allowedNameChars(QLatin1String("[a-z|A-Z|0-9|._-]*")) + m_sdkManager(m_androidConfig) { m_avdDialog.setupUi(this); m_hideTipTimer.setInterval(2000); diff --git a/src/plugins/clangcodemodel/clangdclient.cpp b/src/plugins/clangcodemodel/clangdclient.cpp index 130d3e33384..b89ab7a8296 100644 --- a/src/plugins/clangcodemodel/clangdclient.cpp +++ b/src/plugins/clangcodemodel/clangdclient.cpp @@ -2518,8 +2518,10 @@ static void semanticHighlighter(QFutureInterface &future, while (!firstChildTree.isEmpty()) { const AstNode n = firstChildTree.takeFirst(); const QString detail = n.detail().value_or(QString()); - if (detail.startsWith("operator")) - return !detail.contains('='); + if (detail.startsWith("operator")) { + return !detail.contains('=') && !detail.contains("++") + && !detail.contains("--"); + } firstChildTree << n.children().value_or(QList()); } return true; @@ -2965,19 +2967,27 @@ void ClangdCompletionItem::apply(TextDocumentManipulatorInterface &manipulator, if (!edit) return; + const int labelOpenParenOffset = item.label().indexOf('('); + const int labelClosingParenOffset = item.label().indexOf(')'); const auto kind = static_cast( item.kind().value_or(CompletionItemKind::Text)); + const bool isMacroCall = kind == CompletionItemKind::Text && labelOpenParenOffset != -1 + && labelClosingParenOffset > labelOpenParenOffset; // Heuristic const bool isFunctionLike = kind == CompletionItemKind::Function - || kind == CompletionItemKind::Method || kind == CompletionItemKind::Constructor; + || kind == CompletionItemKind::Method || kind == CompletionItemKind::Constructor + || isMacroCall; + QString rawInsertText = edit->newText(); // Some preparation for our magic involving (non-)insertion of parentheses and // cursor placement. if (isFunctionLike && !rawInsertText.contains('(')) { - if (item.label().contains("()")) // function takes no arguments - rawInsertText += "()"; - else if (item.label().contains('(')) // function takes arguments - rawInsertText += "( )"; + if (labelOpenParenOffset != -1) { + if (labelClosingParenOffset == labelOpenParenOffset + 1) // function takes no arguments + rawInsertText += "()"; + else // function takes arguments + rawInsertText += "( )"; + } } const int firstParenOffset = rawInsertText.indexOf('('); @@ -3010,8 +3020,8 @@ void ClangdCompletionItem::apply(TextDocumentManipulatorInterface &manipulator, } if (!abandonParen) abandonParen = isAtUsingDeclaration(manipulator, rangeStart); - if (!abandonParen && matchPreviousWord(manipulator, cursor, detail)) // function definition? - abandonParen = true; + if (!abandonParen && !isMacroCall && matchPreviousWord(manipulator, cursor, detail)) + abandonParen = true; // function definition if (!abandonParen) { if (completionSettings.m_spaceAfterFunctionName) extraCharacters += ' '; diff --git a/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp b/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp index 371fb224524..1d8a3f8af2e 100644 --- a/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp +++ b/src/plugins/clangcodemodel/clangmodelmanagersupport.cpp @@ -209,6 +209,11 @@ bool ClangModelManagerSupport::supportsOutline(const TextEditor::TextDocument *d return !clientForFile(document->filePath()); } +bool ClangModelManagerSupport::supportsLocalUses(const TextEditor::TextDocument *document) const +{ + return !clientForFile(document->filePath()); +} + CppEditor::BaseEditorDocumentProcessor *ClangModelManagerSupport::createEditorDocumentProcessor( TextEditor::TextDocument *baseTextDocument) { diff --git a/src/plugins/clangcodemodel/clangmodelmanagersupport.h b/src/plugins/clangcodemodel/clangmodelmanagersupport.h index 5d591d6925f..8307ece252f 100644 --- a/src/plugins/clangcodemodel/clangmodelmanagersupport.h +++ b/src/plugins/clangcodemodel/clangmodelmanagersupport.h @@ -75,6 +75,7 @@ public: CppEditor::RefactoringEngineInterface &refactoringEngineInterface() override; std::unique_ptr createOverviewModel() override; bool supportsOutline(const TextEditor::TextDocument *document) const override; + bool supportsLocalUses(const TextEditor::TextDocument *document) const override; BackendCommunicator &communicator(); QString dummyUiHeaderOnDiskDirPath() const; diff --git a/src/plugins/clangcodemodel/test/clangdtests.cpp b/src/plugins/clangcodemodel/test/clangdtests.cpp index 2248bba4a3d..ecfabb33297 100644 --- a/src/plugins/clangcodemodel/test/clangdtests.cpp +++ b/src/plugins/clangcodemodel/test/clangdtests.cpp @@ -1256,6 +1256,8 @@ void ClangdTestHighlighting::test_data() << QList{C_STRING} << 0; QTest::newRow("string literal passed to macro from header file") << 854 << 32 << 854 << 38 << QList{C_STRING} << 0; + QTest::newRow("user-defined operator call") << 860 << 7 << 860 << 8 + << QList{C_LOCAL} << 0; } void ClangdTestHighlighting::test() diff --git a/src/plugins/clangcodemodel/test/data/highlighting/highlighting.cpp b/src/plugins/clangcodemodel/test/data/highlighting/highlighting.cpp index 5d57a235bc6..54716d79a3f 100644 --- a/src/plugins/clangcodemodel/test/data/highlighting/highlighting.cpp +++ b/src/plugins/clangcodemodel/test/data/highlighting/highlighting.cpp @@ -853,3 +853,9 @@ void useString() const char *s = USE_STRING("TEXT"); s = USE_STRING_FROM_HEADER("TEXT"); } + +void useOperator() +{ + struct S { S& operator++(); } s; + ++s; +} diff --git a/src/plugins/cppeditor/cppmodelmanager.cpp b/src/plugins/cppeditor/cppmodelmanager.cpp index b87e1098da1..097dcf15f98 100644 --- a/src/plugins/cppeditor/cppmodelmanager.cpp +++ b/src/plugins/cppeditor/cppmodelmanager.cpp @@ -1321,6 +1321,11 @@ bool CppModelManager::supportsOutline(const TextEditor::TextDocument *document) return instance()->d->m_activeModelManagerSupport->supportsOutline(document); } +bool CppModelManager::supportsLocalUses(const TextEditor::TextDocument *document) +{ + return instance()->d->m_activeModelManagerSupport->supportsLocalUses(document); +} + bool CppModelManager::isClangCodeModelActive() const { return d->m_activeModelManagerSupport != d->m_builtinModelManagerSupport; diff --git a/src/plugins/cppeditor/cppmodelmanager.h b/src/plugins/cppeditor/cppmodelmanager.h index e6dc746a1f1..fadb00657d9 100644 --- a/src/plugins/cppeditor/cppmodelmanager.h +++ b/src/plugins/cppeditor/cppmodelmanager.h @@ -140,6 +140,7 @@ public: static bool isCppEditor(Core::IEditor *editor); static bool supportsOutline(const TextEditor::TextDocument *document); + static bool supportsLocalUses(const TextEditor::TextDocument *document); bool isClangCodeModelActive() const; QSet abstractEditorSupports() const; diff --git a/src/plugins/cppeditor/cppmodelmanagersupport.h b/src/plugins/cppeditor/cppmodelmanagersupport.h index 70da6fedc70..ca287d8baf7 100644 --- a/src/plugins/cppeditor/cppmodelmanagersupport.h +++ b/src/plugins/cppeditor/cppmodelmanagersupport.h @@ -62,6 +62,7 @@ public: virtual RefactoringEngineInterface &refactoringEngineInterface() = 0; virtual std::unique_ptr createOverviewModel() = 0; virtual bool supportsOutline(const TextEditor::TextDocument *) const { return true; } + virtual bool supportsLocalUses(const TextEditor::TextDocument *) const { return true; } }; class CPPEDITOR_EXPORT ModelManagerSupportProvider diff --git a/src/plugins/cppeditor/cppuseselectionsupdater.cpp b/src/plugins/cppeditor/cppuseselectionsupdater.cpp index 70b0cba81f8..99e0f8befc5 100644 --- a/src/plugins/cppeditor/cppuseselectionsupdater.cpp +++ b/src/plugins/cppeditor/cppuseselectionsupdater.cpp @@ -27,6 +27,7 @@ #include "cppeditorwidget.h" #include "cppeditordocument.h" +#include "cppmodelmanager.h" #include "cpptoolsreuse.h" #include @@ -73,6 +74,9 @@ CppUseSelectionsUpdater::RunnerInfo CppUseSelectionsUpdater::update(CallType cal auto *cppEditorDocument = qobject_cast(cppEditorWidget->textDocument()); QTC_ASSERT(cppEditorDocument, return RunnerInfo::FailedToStart); + if (!CppModelManager::instance()->supportsLocalUses(cppEditorDocument)) + return RunnerInfo::AlreadyUpToDate; + CursorInfoParams params; params.semanticInfo = cppEditorWidget->semanticInfo(); params.textCursor = Utils::Text::wordStartCursor(cppEditorWidget->textCursor()); diff --git a/src/plugins/qmldesigner/CMakeLists.txt b/src/plugins/qmldesigner/CMakeLists.txt index 901a631a421..7bc91483f9e 100644 --- a/src/plugins/qmldesigner/CMakeLists.txt +++ b/src/plugins/qmldesigner/CMakeLists.txt @@ -30,6 +30,8 @@ add_qtc_plugin(QmlDesigner cmakegeneratordialog.h cmakegeneratordialog.cpp generateresource.cpp generateresource.h generatecmakelists.cpp generatecmakelists.h + generatecmakelistsconstants.h + checkablefilelistmodel.cpp checkablefilelistmodel.h openuiqmlfiledialog.cpp openuiqmlfiledialog.h openuiqmlfiledialog.ui qmldesignerconstants.h qmldesignericons.h diff --git a/src/plugins/qmldesigner/checkablefilelistmodel.cpp b/src/plugins/qmldesigner/checkablefilelistmodel.cpp new file mode 100644 index 00000000000..eb8336e9c34 --- /dev/null +++ b/src/plugins/qmldesigner/checkablefilelistmodel.cpp @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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 "checkablefilelistmodel.h" + +using namespace Utils; + +namespace QmlDesigner { + +CheckableFileListModel::CheckableFileListModel(const FilePath &rootDir, const FilePaths &files, bool checkedByDefault, QObject *parent) + :QStandardItemModel(parent), + rootDir(rootDir) +{ + for (const FilePath &file: files) { + appendRow(new CheckableStandardItem(file.toString(), checkedByDefault)); + } +} + +QList CheckableFileListModel::checkedItems() const +{ +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) + QList allItems = findItems("*", Qt::MatchWildcard); +#else + QList allItems = findItems(".*", Qt::MatchRegularExpression); +#endif + QList checkedItems; + for (QStandardItem *standardItem : allItems) { + CheckableStandardItem *item = static_cast(standardItem); + if (item->isChecked()) + checkedItems.append(item); + } + + return checkedItems; +} + +QVariant CheckableFileListModel::data(const QModelIndex &index, int role) const +{ + if (index.isValid()) { + if (role == Qt::CheckStateRole) { + CheckableStandardItem *item = static_cast(QStandardItemModel::item(index.row())); + return item->isChecked() ? Qt::Checked : Qt::Unchecked; + } + else if (role == Qt::DisplayRole) { + QVariant data = QStandardItemModel::data(index, role); + FilePath fullPath = FilePath::fromString(data.toString()); + FilePath relativePath = fullPath.relativeChildPath(rootDir); + return QVariant(relativePath.toString()); + } + } + + return QStandardItemModel::data(index, role); +} + +bool CheckableFileListModel::setData(const QModelIndex &index, const QVariant &value, int role) +{ + if (index.isValid() && role == Qt::CheckStateRole) + { + CheckableStandardItem *item = static_cast(QStandardItemModel::item(index.row())); + item->setChecked(value.value()); + + return true; + } + + return QStandardItemModel::setData(index, value, role); +} + +CheckableStandardItem::CheckableStandardItem(const QString &text, bool checked) + :QStandardItem(text), + checked(checked) +{ + setFlags(flags() |= Qt::ItemIsUserCheckable); +} + +void CheckableStandardItem::setChecked(bool checked) +{ + this->checked = checked; +} + +bool CheckableStandardItem::isChecked() const +{ + return this->checked; +} + +int CheckableStandardItem::type() const +{ + return QStandardItem::UserType + 0x74d4f1; +} + +} //QmlDesigner diff --git a/src/plugins/qmldesigner/checkablefilelistmodel.h b/src/plugins/qmldesigner/checkablefilelistmodel.h new file mode 100644 index 00000000000..6721596b635 --- /dev/null +++ b/src/plugins/qmldesigner/checkablefilelistmodel.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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. +** +****************************************************************************/ + +#ifndef CHECKABLEFILELISTMODEL_H +#define CHECKABLEFILELISTMODEL_H + +#include +#include + +namespace QmlDesigner { + +class CheckableStandardItem : public QStandardItem +{ +public: + explicit CheckableStandardItem(const QString &text = QString(), bool checked = false); + bool isChecked() const; + void setChecked(bool checked); + int type() const; + +private: + bool checked; +}; + +class CheckableFileListModel : public QStandardItemModel +{ +public: + CheckableFileListModel(const Utils::FilePath &rootDir, + const Utils::FilePaths &files, + bool checkedByDefault = false, + QObject *parent = nullptr); + QVariant data(const QModelIndex &index, int role) const; + bool setData(const QModelIndex &index, const QVariant &value, int role); + QList checkedItems() const; + +protected: + Utils::FilePath rootDir; +}; + +} //QmlDesigner + +Q_DECLARE_METATYPE(QmlDesigner::CheckableStandardItem) + +#endif // CHECKABLEFILELISTMODEL_H diff --git a/src/plugins/qmldesigner/cmakegeneratordialog.cpp b/src/plugins/qmldesigner/cmakegeneratordialog.cpp index 59625c6035f..2f910cf0eb5 100644 --- a/src/plugins/qmldesigner/cmakegeneratordialog.cpp +++ b/src/plugins/qmldesigner/cmakegeneratordialog.cpp @@ -23,8 +23,8 @@ ** ****************************************************************************/ - #include "cmakegeneratordialog.h" +#include "generatecmakelistsconstants.h" #include #include @@ -51,7 +51,7 @@ CmakeGeneratorDialog::CmakeGeneratorDialog(const FilePath &rootDir, const FilePa connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject); - model = new CheckableFileListModel(rootDir, files, this); + model = new CMakeGeneratorDialogModel(rootDir, files, this); QListView *list = new QListView(this); list->setModel(model); @@ -72,82 +72,35 @@ FilePaths CmakeGeneratorDialog::getFilePaths() return paths; } -CheckableFileListModel::CheckableFileListModel(const FilePath &rootDir, const FilePaths &files, QObject *parent) - :QStandardItemModel(parent), - rootDir(rootDir) +CMakeGeneratorDialogModel::CMakeGeneratorDialogModel(const Utils::FilePath &rootDir, const Utils::FilePaths &files, QObject *parent) + :CheckableFileListModel(rootDir, files, parent) { - for (const FilePath &file: files) { - appendRow(new CheckableStandardItem(file.toString(), true)); + for (int i=0; i(QStandardItemModel::item(i)); + item->setChecked(CMakeGeneratorDialogModel::checkedByDefault(FilePath::fromString(item->text()))); } } -QList CheckableFileListModel::checkedItems() const +bool CMakeGeneratorDialogModel::checkedByDefault(const FilePath &path) const { -#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) - QList allItems = findItems("*", Qt::MatchWildcard); -#else - QList allItems = findItems(".*", Qt::MatchRegularExpression); -#endif - QList checkedItems; - for (QStandardItem *standardItem : allItems) { - CheckableStandardItem *item = static_cast(standardItem); - if (item->isChecked()) - checkedItems.append(item); + if (path.exists()) { + QString relativePath = path.relativeChildPath(rootDir).toString(); + if (relativePath.compare(QmlDesigner::GenerateCmake::Constants::FILENAME_CMAKELISTS) == 0) + return false; + if (relativePath.endsWith(QmlDesigner::GenerateCmake::Constants::FILENAME_CMAKELISTS) + && relativePath.length() > QString(QmlDesigner::GenerateCmake::Constants::FILENAME_CMAKELISTS).length()) + return true; + if (relativePath.compare(QmlDesigner::GenerateCmake::Constants::FILENAME_MODULES) == 0) + return true; + if (relativePath.compare( + FilePath::fromString(QmlDesigner::GenerateCmake::Constants::DIRNAME_CPP) + .pathAppended(QmlDesigner::GenerateCmake::Constants::FILENAME_MAINCPP_HEADER) + .toString()) + == 0) + return true; } - return checkedItems; -} - -CheckableStandardItem::CheckableStandardItem(const QString &text, bool checked) - :QStandardItem(text), - checked(checked) -{ - setFlags(flags() |= Qt::ItemIsUserCheckable); -} - -void CheckableStandardItem::setChecked(bool checked) -{ - this->checked = checked; -} - -bool CheckableStandardItem::isChecked() const -{ - return this->checked; -} - -int CheckableStandardItem::type() const -{ - return QStandardItem::UserType + 0x74d4f1; -} - -QVariant CheckableFileListModel::data(const QModelIndex &index, int role) const -{ - if (index.isValid()) { - if (role == Qt::CheckStateRole) { - CheckableStandardItem *item = static_cast(QStandardItemModel::item(index.row())); - return item->isChecked() ? Qt::Checked : Qt::Unchecked; - } - else if (role == Qt::DisplayRole) { - QVariant data = QStandardItemModel::data(index, role); - QString relativePath = data.toString().remove(rootDir.toString()); - return QVariant(relativePath); - } - } - - return QStandardItemModel::data(index, role); -} - -bool CheckableFileListModel::setData(const QModelIndex &index, const QVariant &value, int role) -{ - if (index.isValid() && role == Qt::CheckStateRole) - { - CheckableStandardItem *item = static_cast(QStandardItemModel::item(index.row())); - item->setChecked(value.value()); - - return true; - } - - return QStandardItemModel::setData(index, value, role); + return !path.exists(); } } diff --git a/src/plugins/qmldesigner/cmakegeneratordialog.h b/src/plugins/qmldesigner/cmakegeneratordialog.h index 34201365100..8a11666ccb7 100644 --- a/src/plugins/qmldesigner/cmakegeneratordialog.h +++ b/src/plugins/qmldesigner/cmakegeneratordialog.h @@ -27,36 +27,22 @@ #ifndef CMAKEGENERATORDIALOG_H #define CMAKEGENERATORDIALOG_H +#include "checkablefilelistmodel.h" + #include #include -#include + namespace QmlDesigner { namespace GenerateCmake { -class CheckableStandardItem : public QStandardItem +class CMakeGeneratorDialogModel : public CheckableFileListModel { public: - explicit CheckableStandardItem(const QString &text = QString(), bool checked = false); - bool isChecked() const; - void setChecked(bool checked); - int type() const; - -private: - bool checked; -}; - -class CheckableFileListModel : public QStandardItemModel -{ -public: - CheckableFileListModel(const Utils::FilePath &rootDir, const Utils::FilePaths &files, QObject *parent = nullptr); - QVariant data(const QModelIndex &index, int role) const; - bool setData(const QModelIndex &index, const QVariant &value, int role); - QList checkedItems() const; - -private: - Utils::FilePath rootDir; + CMakeGeneratorDialogModel(const Utils::FilePath &rootDir, const Utils::FilePaths &files, QObject *parent = nullptr); +protected: + virtual bool checkedByDefault(const Utils::FilePath &file) const; }; class CmakeGeneratorDialog : public QDialog @@ -72,6 +58,4 @@ private: } } -Q_DECLARE_METATYPE(QmlDesigner::GenerateCmake::CheckableStandardItem) - #endif // CMAKEGENERATORDIALOG_H diff --git a/src/plugins/qmldesigner/components/componentcore/svgpasteaction.cpp b/src/plugins/qmldesigner/components/componentcore/svgpasteaction.cpp index 7c29fcd6429..ea841a42da9 100644 --- a/src/plugins/qmldesigner/components/componentcore/svgpasteaction.cpp +++ b/src/plugins/qmldesigner/components/componentcore/svgpasteaction.cpp @@ -951,7 +951,7 @@ void flattenTransformsAndStyles(const QDomElement &element, const QStringList classes = classStr.split(" ", Qt::SkipEmptyParts); for (const auto &c : classes) - applyCSSRules(cssRules["." + e.attribute("class")], properties); + applyCSSRules(cssRules["." + c], properties); } if (e.hasAttribute("id")) { diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp index ad2dfd88f68..2acf6601ab7 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/timelinegraphicsscene.cpp @@ -136,8 +136,7 @@ void TimelineGraphicsScene::onShow() int cf = std::round(timeline.currentKeyframe()); setCurrentFrame(cf); } - - emit m_layout->zoomChanged(0); + emit m_layout->zoomChanged(zoom()); } } diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.cpp b/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.cpp index f4ff114bf62..ee93b4cf575 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.cpp +++ b/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.cpp @@ -482,7 +482,7 @@ void TimelineWidget::contextHelp(const Core::IContext::HelpCallback &callback) c callback({}); } -void TimelineWidget::init() +void TimelineWidget::init(int zoom) { QmlTimeline currentTimeline = m_timelineView->timelineForState(m_timelineView->currentState()); if (currentTimeline.isValid()) { @@ -499,8 +499,8 @@ void TimelineWidget::init() m_graphicsScene->setWidth(m_graphicsView->viewport()->width()); // setScaleFactor uses QSignalBlocker. - m_toolbar->setScaleFactor(0); - m_graphicsScene->setZoom(0); + m_toolbar->setScaleFactor(zoom); + m_graphicsScene->setZoom(zoom); } void TimelineWidget::reset() @@ -611,6 +611,8 @@ void TimelineWidget::showEvent(QShowEvent *event) { Q_UNUSED(event) + int zoom = m_toolbar->scaleFactor(); + m_timelineView->setEnabled(true); graphicsScene()->setWidth(m_graphicsView->viewport()->width()); @@ -622,7 +624,7 @@ void TimelineWidget::showEvent(QShowEvent *event) //All the events have to be fully processed before we call init() if (m_timelineView->model()) - QTimer::singleShot(0, [this]() { init(); }); + QTimer::singleShot(0, [this, zoom]() { init(zoom); }); } void TimelineWidget::resizeEvent(QResizeEvent *event) diff --git a/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.h b/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.h index ebaf00104dc..5edc018b60a 100644 --- a/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.h +++ b/src/plugins/qmldesigner/components/timelineeditor/timelinewidget.h @@ -62,7 +62,7 @@ public: TimelineView *timelineView() const; TimelineToolBar *toolBar() const; - void init(); + void init(int zoom = 0); void reset(); void invalidateTimelineDuration(const QmlTimeline &timeline); diff --git a/src/plugins/qmldesigner/components/transitioneditor/transitioneditorgraphicsscene.cpp b/src/plugins/qmldesigner/components/transitioneditor/transitioneditorgraphicsscene.cpp index e2b95783569..a78ad3c7502 100644 --- a/src/plugins/qmldesigner/components/transitioneditor/transitioneditorgraphicsscene.cpp +++ b/src/plugins/qmldesigner/components/transitioneditor/transitioneditorgraphicsscene.cpp @@ -119,7 +119,7 @@ void TransitionEditorGraphicsScene::invalidateScrollbar() void TransitionEditorGraphicsScene::onShow() { - emit m_layout->zoomChanged(0); + emit m_layout->zoomChanged(zoom()); } void TransitionEditorGraphicsScene::setTransition(const ModelNode &transition) diff --git a/src/plugins/qmldesigner/components/transitioneditor/transitioneditorwidget.cpp b/src/plugins/qmldesigner/components/transitioneditor/transitioneditorwidget.cpp index 6077c9de28c..b75f9d7f874 100644 --- a/src/plugins/qmldesigner/components/transitioneditor/transitioneditorwidget.cpp +++ b/src/plugins/qmldesigner/components/transitioneditor/transitioneditorwidget.cpp @@ -326,7 +326,7 @@ void TransitionEditorWidget::contextHelp(const Core::IContext::HelpCallback &cal callback({}); } -void TransitionEditorWidget::init() +void TransitionEditorWidget::init(int zoom) { ModelNode root = transitionEditorView()->rootModelNode(); ModelNode transition; @@ -345,7 +345,7 @@ void TransitionEditorWidget::init() m_graphicsScene->setWidth(m_graphicsView->viewport()->width()); - m_toolbar->setScaleFactor(40); + m_toolbar->setScaleFactor(zoom); m_toolbar->setCurrentTransition(transition); @@ -355,13 +355,13 @@ void TransitionEditorWidget::init() m_toolbar->setDuration(duration); - m_graphicsScene->setZoom(40); + m_graphicsScene->setZoom(zoom); } void TransitionEditorWidget::updateData(const ModelNode &transition) { if (!transition.isValid()) { - init(); + init(m_toolbar->scaleFactor()); return; } @@ -409,7 +409,7 @@ void TransitionEditorWidget::showEvent(QShowEvent *event) m_transitionEditorView->setEnabled(true); if (m_transitionEditorView->model()) - init(); + init(m_toolbar->scaleFactor()); graphicsScene()->setWidth(m_graphicsView->viewport()->width()); graphicsScene()->invalidateLayout(); diff --git a/src/plugins/qmldesigner/components/transitioneditor/transitioneditorwidget.h b/src/plugins/qmldesigner/components/transitioneditor/transitioneditorwidget.h index ea4b2a6affa..698c4b76aeb 100644 --- a/src/plugins/qmldesigner/components/transitioneditor/transitioneditorwidget.h +++ b/src/plugins/qmldesigner/components/transitioneditor/transitioneditorwidget.h @@ -61,7 +61,7 @@ public: TransitionEditorView *transitionEditorView() const; TransitionEditorToolBar *toolBar() const; - void init(); + void init(int zoom = 0); void reset(); void setupScrollbar(int min, int max, int current); diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp index 3032ac12d94..f922a955171 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceview.cpp @@ -602,7 +602,7 @@ void NodeInstanceView::auxiliaryDataChanged(const ModelNode &node, const QVariant &value) { QTC_ASSERT(m_nodeInstanceServer, return); - const bool forceAuxChange = name == "invisible" || name == "locked" || name == "rotBlocked@internal"; + const bool forceAuxChange = name == "invisible" || name == "locked" || name == "rotBlocked@Internal"; if (((node.isRootNode() && (name == "width" || name == "height")) || forceAuxChange) || name.endsWith(PropertyName("@NodeInstance"))) { if (hasInstanceForModelNode(node)) { @@ -1900,7 +1900,7 @@ void NodeInstanceView::updateRotationBlocks() } } if (!qml3DNodes.isEmpty()) { - const PropertyName auxDataProp {"rotBlocked@internal"}; + const PropertyName auxDataProp {"rotBlocked@Internal"}; for (const auto &node : qAsConst(qml3DNodes)) { if (rotationKeyframeTargets.contains(node)) node.setAuxiliaryData(auxDataProp, true); diff --git a/src/plugins/qmldesigner/designercore/model/qml3dnode.cpp b/src/plugins/qmldesigner/designercore/model/qml3dnode.cpp index cb9e2b8bb16..7f6f07b0018 100644 --- a/src/plugins/qmldesigner/designercore/model/qml3dnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/qml3dnode.cpp @@ -83,7 +83,7 @@ void Qml3DNode::setBindingProperty(const PropertyName &name, const QString &expr bool Qml3DNode::isBlocked(const PropertyName &propName) const { if (modelNode().isValid() && propName.startsWith("eulerRotation")) - return modelNode().auxiliaryData("rotBlocked@internal").toBool(); + return modelNode().auxiliaryData("rotBlocked@Internal").toBool(); return false; } diff --git a/src/plugins/qmldesigner/designercore/projectstorage/projectstoragetypes.h b/src/plugins/qmldesigner/designercore/projectstorage/projectstoragetypes.h index ef055390767..366da00407a 100644 --- a/src/plugins/qmldesigner/designercore/projectstorage/projectstoragetypes.h +++ b/src/plugins/qmldesigner/designercore/projectstorage/projectstoragetypes.h @@ -148,8 +148,8 @@ public: {} explicit Import(int moduleId, int majorVersion, int minorVersion, int sourceId) - : moduleId{moduleId} - , version{majorVersion, minorVersion} + : version{majorVersion, minorVersion} + , moduleId{moduleId} , sourceId{sourceId} {} diff --git a/src/plugins/qmldesigner/generatecmakelists.cpp b/src/plugins/qmldesigner/generatecmakelists.cpp index 25fadb23940..51c199d5855 100644 --- a/src/plugins/qmldesigner/generatecmakelists.cpp +++ b/src/plugins/qmldesigner/generatecmakelists.cpp @@ -24,6 +24,7 @@ ****************************************************************************/ #include "generatecmakelists.h" +#include "generatecmakelistsconstants.h" #include "cmakegeneratordialog.h" #include @@ -47,6 +48,7 @@ #include using namespace Utils; +using namespace QmlDesigner::GenerateCmake::Constants; namespace QmlDesigner { @@ -76,7 +78,7 @@ void generateMenuEntry() { Core::ActionContainer *buildMenu = Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT); - auto action = new QAction(QCoreApplication::tr("Generate CMakeLists.txt Files")); + auto action = new QAction(QCoreApplication::translate("QmlDesigner::GenerateCmake", "Generate CMakeLists.txt Files")); QObject::connect(action, &QAction::triggered, GenerateCmake::onGenerateCmakeLists); Core::Command *cmd = Core::ActionManager::registerAction(action, "QmlProject.CreateCMakeLists"); buildMenu->addAction(cmd, ProjectExplorer::Constants::G_BUILD_RUN); @@ -118,17 +120,6 @@ bool isErrorFatal(int error) return false; } -const char DIRNAME_CONTENT[] = "content"; -const char DIRNAME_IMPORT[] = "imports"; -const char DIRNAME_CPP[] = "src"; - -const char FILENAME_CMAKELISTS[] = "CMakeLists.txt"; -const char FILENAME_APPMAINQML[] = "App.qml"; -const char FILENAME_MAINQML[] = "main.qml"; -const char FILENAME_MAINCPP[] = "main.cpp"; -const char FILENAME_MAINCPP_HEADER[] = "import_qml_plugins.h"; -const char FILENAME_MODULES[] = "qmlmodules"; - int isProjectCorrectlyFormed(const FilePath &rootDir) { int errors = NoError; @@ -165,13 +156,13 @@ void removeUnconfirmedQueuedFiles(const Utils::FilePaths confirmedFiles) }); } -const QString WARNING_MISSING_STRUCTURE_FATAL = QCoreApplication::tr( +const QString WARNING_MISSING_STRUCTURE_FATAL = QCoreApplication::translate("QmlDesigner::GenerateCmake", "The project is not properly structured for automatically generating CMake files.\n\nAborting process.\n\nThe following files or directories are missing:\n\n%1"); -const QString WARNING_MISSING_STRUCTURE_NONFATAL = QCoreApplication::tr( +const QString WARNING_MISSING_STRUCTURE_NONFATAL = QCoreApplication::translate("QmlDesigner::GenerateCmake", "The project is not properly structured for automatically generating CMake files.\n\nThe following files will be created:\n\n%1"); -const QString WARNING_TITLE_FATAL = QCoreApplication::tr( +const QString WARNING_TITLE_FATAL = QCoreApplication::translate("QmlDesigner::GenerateCmake", "Cannot Generate CMake Files"); -const QString WARNING_TITLE_NONFATAL = QCoreApplication::tr( +const QString WARNING_TITLE_NONFATAL = QCoreApplication::translate("QmlDesigner::GenerateCmake", "Problems with Generating CMake Files"); void showProjectDirErrorDialog(int error) @@ -292,8 +283,6 @@ QStringList moduleNames; const QDir::Filters FILES_ONLY = QDir::Files; const QDir::Filters DIRS_ONLY = QDir::Dirs|QDir::Readable|QDir::NoDotAndDotDot; -const char QMLDIRFILENAME[] = "qmldir"; - const char MAIN_CMAKEFILE_TEMPLATE_PATH[] = ":/boilerplatetemplates/qmlprojectmaincmakelists.tpl"; const char QMLMODULES_FILE_TEMPLATE_PATH[] = ":/boilerplatetemplates/qmlprojectmodules.tpl"; @@ -325,7 +314,7 @@ void generateMainCmake(const FilePath &rootDir) modulesAsPlugins.append(" " + moduleName + "plugin\n"); QString moduleFileContent = GenerateCmake::readTemplate(QMLMODULES_FILE_TEMPLATE_PATH).arg(appName).arg(modulesAsPlugins); - GenerateCmake::queueFile(rootDir.pathAppended(GenerateCmake::FILENAME_MODULES), moduleFileContent); + GenerateCmake::queueFile(rootDir.pathAppended(FILENAME_MODULES), moduleFileContent); } const char DO_NOT_EDIT_FILE_COMMENT[] = "### This file is automatically generated by Qt Design Studio.\n### Do not change\n\n"; @@ -353,7 +342,7 @@ const char MODULEFILE_TEMPLATE_PATH[] = ":/boilerplatetemplates/qmlprojectmodule void generateModuleCmake(const FilePath &dir) { QString fileTemplate = GenerateCmake::readTemplate(MODULEFILE_TEMPLATE_PATH); - const QStringList qmldirFilesOnly(QMLDIRFILENAME); + const QStringList qmldirFilesOnly(FILENAME_QMLDIR); QString singletonContent; FilePaths qmldirFileList = dir.dirEntries(qmldirFilesOnly, FILES_ONLY); @@ -467,14 +456,14 @@ QStringList getDirectoryTreeResources(const FilePath &dir) void queueCmakeFile(const FilePath &dir, const QString &content) { - FilePath filePath = dir.pathAppended(GenerateCmake::FILENAME_CMAKELISTS); + FilePath filePath = dir.pathAppended(FILENAME_CMAKELISTS); GenerateCmake::queueFile(filePath, content); } bool isFileBlacklisted(const QString &fileName) { - return (!fileName.compare(QMLDIRFILENAME) || - !fileName.compare(GenerateCmake::FILENAME_CMAKELISTS)); + return (!fileName.compare(FILENAME_QMLDIR) || + !fileName.compare(FILENAME_CMAKELISTS)); } } @@ -494,10 +483,10 @@ const char MAIN_CPPFILE_HEADER_PLUGIN_LINE[] = "Q_IMPORT_QML_PLUGIN(%1)\n"; bool generateMainCpp(const FilePath &dir) { - FilePath srcDir = dir.pathAppended(GenerateCmake::DIRNAME_CPP); + FilePath srcDir = dir.pathAppended(DIRNAME_CPP); QString cppContent = GenerateCmake::readTemplate(MAIN_CPPFILE_TEMPLATE_PATH); - FilePath cppFilePath = srcDir.pathAppended(GenerateCmake::FILENAME_MAINCPP); + FilePath cppFilePath = srcDir.pathAppended(FILENAME_MAINCPP); bool cppOk = GenerateCmake::queueFile(cppFilePath, cppContent); QString modulesAsPlugins; @@ -507,7 +496,7 @@ bool generateMainCpp(const FilePath &dir) QString headerContent = GenerateCmake::readTemplate(MAIN_CPPFILE_HEADER_TEMPLATE_PATH) .arg(modulesAsPlugins); - FilePath headerFilePath = srcDir.pathAppended(GenerateCmake::FILENAME_MAINCPP_HEADER); + FilePath headerFilePath = srcDir.pathAppended(FILENAME_MAINCPP_HEADER); bool headerOk = GenerateCmake::queueFile(headerFilePath, headerContent); return cppOk && headerOk; @@ -518,7 +507,7 @@ const char MAIN_QMLFILE_TEMPLATE_PATH[] = ":/boilerplatetemplates/qmlprojectmain bool generateMainQml(const FilePath &dir) { QString content = GenerateCmake::readTemplate(MAIN_QMLFILE_TEMPLATE_PATH); - FilePath filePath = dir.pathAppended(GenerateCmake::FILENAME_MAINQML); + FilePath filePath = dir.pathAppended(FILENAME_MAINQML); return GenerateCmake::queueFile(filePath, content); } diff --git a/src/plugins/qmldesigner/generatecmakelistsconstants.h b/src/plugins/qmldesigner/generatecmakelistsconstants.h new file mode 100644 index 00000000000..59b11723e4c --- /dev/null +++ b/src/plugins/qmldesigner/generatecmakelistsconstants.h @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Design Tooling +** +** 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. +** +****************************************************************************/ + +#ifndef GENERATECMAKELISTSCONSTANTS_H +#define GENERATECMAKELISTSCONSTANTS_H + +#pragma once + +namespace QmlDesigner { +namespace GenerateCmake { +namespace Constants { + +const char DIRNAME_CONTENT[] = "content"; +const char DIRNAME_IMPORT[] = "imports"; +const char DIRNAME_CPP[] = "src"; + +const char FILENAME_CMAKELISTS[] = "CMakeLists.txt"; +const char FILENAME_APPMAINQML[] = "App.qml"; +const char FILENAME_MAINQML[] = "main.qml"; +const char FILENAME_MAINCPP[] = "main.cpp"; +const char FILENAME_MAINCPP_HEADER[] = "import_qml_plugins.h"; +const char FILENAME_MODULES[] = "qmlmodules"; +const char FILENAME_QMLDIR[] = "qmldir"; + +} //Constants +} //GenerateCmake +} //QmlDesigner + +#endif // GENERATECMAKELISTSCONSTANTS_H diff --git a/src/plugins/qmldesigner/qmldesignerplugin.pri b/src/plugins/qmldesigner/qmldesignerplugin.pri index cc249ece07a..f994bba8a28 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.pri +++ b/src/plugins/qmldesigner/qmldesignerplugin.pri @@ -6,6 +6,8 @@ HEADERS += $$PWD/qmldesignerconstants.h \ $$PWD/editorproxy.h \ $$PWD/generateresource.h \ $$PWD/generatecmakelists.h \ + $$PWD/generatecmakelistsconstants.h \ + $$PWD/checkablefilelistmodel.h \ $$PWD/cmakegeneratordialog.h \ $$PWD/settingspage.h \ $$PWD/designmodecontext.h \ @@ -23,6 +25,7 @@ SOURCES += $$PWD/qmldesignerplugin.cpp \ $$PWD/editorproxy.cpp \ $$PWD/generateresource.cpp \ $$PWD/generatecmakelists.cpp \ + $$PWD/checkablefilelistmodel.cpp \ $$PWD/cmakegeneratordialog.cpp \ $$PWD/settingspage.cpp \ $$PWD/designmodecontext.cpp \ diff --git a/src/plugins/qmldesigner/qmldesignerplugin.qbs b/src/plugins/qmldesigner/qmldesignerplugin.qbs index 4e20e2b52ed..df80c0d0665 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.qbs +++ b/src/plugins/qmldesigner/qmldesignerplugin.qbs @@ -1011,6 +1011,9 @@ Project { "generateresource.h", "generatecmakelists.cpp", "generatecmakelists.h", + "generatecmakelistsconstants.h", + "checkablefilelistmodel.cpp", + "checkablefilelistmodel.h", "cmakegeneratordialog.cpp", "cmakegeneratordialog.h", "designersettings.cpp", diff --git a/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewactions.cpp b/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewactions.cpp index bcdd87b749a..09375ba69ff 100644 --- a/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewactions.cpp +++ b/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewactions.cpp @@ -30,9 +30,13 @@ #include #include +#include #include #include #include +#include + +#include #include #include @@ -44,18 +48,37 @@ using namespace ProjectExplorer; const Utils::Icon previewIcon({ {":/qmlpreviewplugin/images/live_preview.png", Utils::Theme::IconsBaseColor}}); +const QByteArray livePreviewId = "LivePreview"; static void handleAction(const SelectionContext &context) { if (context.view()->isAttached()) { - if (context.toggled()) - ProjectExplorerPlugin::runStartupProject(Constants::QML_PREVIEW_RUN_MODE); - else + if (context.toggled()) { + bool skipDeploy = false; + if (const Target *startupTarget = SessionManager::startupTarget()) { + const Kit *kit = startupTarget->kit(); + if (kit + && (kit->supportedPlatforms().contains(Android::Constants::ANDROID_DEVICE_TYPE) + || DeviceTypeKitAspect::deviceTypeId(kit) + == Android::Constants::ANDROID_DEVICE_TYPE)) { + skipDeploy = true; + // In case of an android kit we don't want the live preview button to be toggled + // when the emulator is started as we don't have control over its run status. + DesignerActionManager &designerActionManager = QmlDesignerPlugin::instance() + ->designerActionManager(); + if (const ActionInterface *interface = designerActionManager.actionByMenuId( + livePreviewId)) + interface->action()->setChecked(false); + } + } + ProjectExplorerPlugin::runStartupProject(Constants::QML_PREVIEW_RUN_MODE, skipDeploy); + } else { QmlPreviewPlugin::stopAllRunControls(); + } } } -QmlPreviewAction::QmlPreviewAction() : ModelNodeAction("LivePreview", +QmlPreviewAction::QmlPreviewAction() : ModelNodeAction(livePreviewId, "Live Preview", previewIcon.icon(), QmlPreviewPlugin::tr("Show Live Preview"), diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp index 0dc6f5c5a18..c17f7f158bc 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.cpp +++ b/src/plugins/qmlprojectmanager/qmlproject.cpp @@ -112,7 +112,7 @@ QmlProject::QmlProject(const Utils::FilePath &fileName) Utils::InfoBarEntry info(openInQDSAppSetting, tr("Would you like to open the project in Qt Design Studio?"), - Utils::InfoBarEntry::GlobalSuppression::Enabled); + Utils::InfoBarEntry::GlobalSuppression::Disabled); info.setCustomButtonInfo(tr("Open in Qt Design Studio"), [&, fileName] { Core::ICore::infoBar()->removeInfo(openInQDSAppSetting); QmlProjectPlugin::openQDS(fileName); diff --git a/src/plugins/studiowelcome/newprojectdialogimageprovider.cpp b/src/plugins/studiowelcome/newprojectdialogimageprovider.cpp index 2c7e454f5b0..bdb3e4af8be 100644 --- a/src/plugins/studiowelcome/newprojectdialogimageprovider.cpp +++ b/src/plugins/studiowelcome/newprojectdialogimageprovider.cpp @@ -46,6 +46,8 @@ QPixmap NewProjectDialogImageProvider::invalidStyleIcon() QPixmap NewProjectDialogImageProvider::requestStatusPixmap(const QString &id, QSize *size, const QSize &requestedSize) { + Q_UNUSED(size) + QPixmap pixmap; if (id == "status-warning") { diff --git a/src/plugins/studiowelcome/newprojectmodel.cpp b/src/plugins/studiowelcome/newprojectmodel.cpp index 07589a4c041..3d5d9246d27 100644 --- a/src/plugins/studiowelcome/newprojectmodel.cpp +++ b/src/plugins/studiowelcome/newprojectmodel.cpp @@ -65,6 +65,7 @@ int NewProjectCategoryModel::rowCount(const QModelIndex &) const QVariant NewProjectCategoryModel::data(const QModelIndex &index, int role) const { + Q_UNUSED(role) return categories().at(index.row()); } @@ -84,6 +85,7 @@ int NewProjectModel::rowCount(const QModelIndex &) const QVariant NewProjectModel::data(const QModelIndex &index, int role) const { + Q_UNUSED(role) return projectsOfCurrentCategory().at(index.row()).name; } diff --git a/src/tools/sdktool/addkitoperation.cpp b/src/tools/sdktool/addkitoperation.cpp index d73dcc9c5db..d5de0562bfa 100644 --- a/src/tools/sdktool/addkitoperation.cpp +++ b/src/tools/sdktool/addkitoperation.cpp @@ -446,7 +446,7 @@ bool AddKitOperation::test() const // Profile 1: Make sure name is unique: map = addKit(map, tcMap, qtMap, devMap, QVariantMap(), "testId2", "Test Kit2", "/tmp/icon2.png", QString(), 1, - "/usr/bin/gdb-test2", "Desktop", "{dev-id}", "/sys/root\\\\", tcs, + "/usr/bin/gdb-test2", "Desktop", "{dev-id}", "/sys/root//", tcs, "{qt-id}", "unsupported/mkspec", QString(), QString(), QString(), QString(), QString(), QStringList(), env, KeyValuePairList({KeyValuePair("PE.Profile.Data/extraData", QVariant("extraValue"))})); @@ -456,6 +456,7 @@ bool AddKitOperation::test() const || !map.contains(DEFAULT) || map.value(DEFAULT).toInt() != 0 || !map.contains("Profile.0") || !map.contains("Profile.1")) + return false; if (map.value("Profile.0") != profile0) return false; @@ -475,7 +476,7 @@ bool AddKitOperation::test() const || !data.contains(DEBUGGER) || data.value(DEBUGGER).type() != QVariant::Map || !data.contains(DEVICE_TYPE) || data.value(DEVICE_TYPE).toString() != "Desktop" || !data.contains(DEVICE_ID) || data.value(DEVICE_ID).toString() != "{dev-id}" - || !data.contains(SYSROOT) || data.value(SYSROOT).toString() != "/sys/root\\\\" + || !data.contains(SYSROOT) || data.value(SYSROOT).toString() != "/sys/root//" || !data.contains(TOOLCHAIN) || !data.contains(QT) || data.value(QT).toString() != "SDK.{qt-id}" || !data.contains(MKSPEC) || data.value(MKSPEC).toString() != "unsupported/mkspec" @@ -501,6 +502,7 @@ bool AddKitOperation::test() const || !map.contains("Profile.0") || !map.contains("Profile.1") || !map.contains("Profile.2")) + return false; if (map.value("Profile.0") != profile0) return false; diff --git a/src/tools/sdktool/addqtoperation.cpp b/src/tools/sdktool/addqtoperation.cpp index 7f256bf3279..7af41db1218 100644 --- a/src/tools/sdktool/addqtoperation.cpp +++ b/src/tools/sdktool/addqtoperation.cpp @@ -299,7 +299,7 @@ QVariantMap AddQtOperation::addQt(const QVariantMap &map, const QString qt = QString::fromLatin1(PREFIX) + QString::number(versionCount); // Sanitize qmake path: - FilePath saneQmake = FilePath::fromUserInput(qmake); + FilePath saneQmake = FilePath::fromUserInput(qmake).cleanPath(); // insert data: KeyValuePairList data;