Merge remote-tracking branch 'origin/6.0'
Change-Id: I0eae76ecff1a315877e4fdd471f0de3a3a55f180
4
.github/workflows/build_cmake.yml
vendored
@@ -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()
|
||||
|
||||
|
@@ -4,6 +4,7 @@ url = http://doc.qt.io/$IDE_ID
|
||||
|
||||
#Words to ignore for auto-linking
|
||||
ignorewords += \
|
||||
Boot2Qt \
|
||||
macOS \
|
||||
WebChannel \
|
||||
WebSocket \
|
||||
|
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 9.1 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 8.7 KiB |
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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.
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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:
|
||||
|
BIN
doc/qtdesignstudio/images/studio-project-structure.png
Normal file
After Width: | Height: | Size: 50 KiB |
@@ -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"
|
||||
*/
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -104,6 +104,12 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef QUICK3D_PARTICLES_MODULE
|
||||
#include <QtQuick3DParticles/private/qquick3dparticle_p.h>
|
||||
#include <QtQuick3DParticles/private/qquick3dparticleaffector_p.h>
|
||||
#include <QtQuick3DParticles/private/qquick3dparticleemitter_p.h>
|
||||
#endif
|
||||
|
||||
#ifdef IMPORT_QUICK3D_ASSETS
|
||||
#include <QtQuick3DAssetImport/private/qssgassetimportmanager_p.h>
|
||||
#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<Proper
|
||||
if (helper) {
|
||||
QSet<QQuick3DNode *> blockedNodes;
|
||||
QSet<QQuick3DNode *> 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 <typename T>
|
||||
static QQuick3DParticleSystem *systemProperty(QObject *object)
|
||||
{
|
||||
return qobject_cast<T>(object) ? qobject_cast<T>(object)->system() : nullptr;
|
||||
}
|
||||
|
||||
static QQuick3DParticleSystem *getSystemOrSystemProperty(QObject *selectedObject)
|
||||
{
|
||||
QQuick3DParticleSystem *system = nullptr;
|
||||
system = qobject_cast<QQuick3DParticleSystem *>(selectedObject);
|
||||
if (system)
|
||||
return system;
|
||||
system = systemProperty<QQuick3DParticle *>(selectedObject);
|
||||
if (system)
|
||||
return system;
|
||||
system = systemProperty<QQuick3DParticleAffector *>(selectedObject);
|
||||
if (system)
|
||||
return system;
|
||||
system = systemProperty<QQuick3DParticleEmitter *>(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<QQuick3DParticleSystem *>(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
|
||||
|
@@ -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;
|
||||
|
@@ -73,6 +73,10 @@ Item {
|
||||
color: DialogValues.textColor
|
||||
selectByMouse: true
|
||||
|
||||
onEditingFinished: {
|
||||
text = text.charAt(0).toUpperCase() + text.slice(1)
|
||||
}
|
||||
|
||||
font.pixelSize: DialogValues.paneTitlePixelSize
|
||||
}
|
||||
|
||||
|
@@ -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();
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -35,6 +35,7 @@
|
||||
|
||||
#include <projectexplorer/buildsystem.h>
|
||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||
#include <projectexplorer/environmentaspect.h>
|
||||
#include <projectexplorer/kit.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/target.h>
|
||||
@@ -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<EnvironmentAspect>()->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);
|
||||
|
@@ -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);
|
||||
|
@@ -2518,8 +2518,10 @@ static void semanticHighlighter(QFutureInterface<HighlightingResult> &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<AstNode>());
|
||||
}
|
||||
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<CompletionItemKind::Kind>(
|
||||
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 += ' ';
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -75,6 +75,7 @@ public:
|
||||
CppEditor::RefactoringEngineInterface &refactoringEngineInterface() override;
|
||||
std::unique_ptr<CppEditor::AbstractOverviewModel> createOverviewModel() override;
|
||||
bool supportsOutline(const TextEditor::TextDocument *document) const override;
|
||||
bool supportsLocalUses(const TextEditor::TextDocument *document) const override;
|
||||
|
||||
BackendCommunicator &communicator();
|
||||
QString dummyUiHeaderOnDiskDirPath() const;
|
||||
|
@@ -1256,6 +1256,8 @@ void ClangdTestHighlighting::test_data()
|
||||
<< QList<int>{C_STRING} << 0;
|
||||
QTest::newRow("string literal passed to macro from header file") << 854 << 32 << 854 << 38
|
||||
<< QList<int>{C_STRING} << 0;
|
||||
QTest::newRow("user-defined operator call") << 860 << 7 << 860 << 8
|
||||
<< QList<int>{C_LOCAL} << 0;
|
||||
}
|
||||
|
||||
void ClangdTestHighlighting::test()
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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<AbstractEditorSupport*> abstractEditorSupports() const;
|
||||
|
@@ -62,6 +62,7 @@ public:
|
||||
virtual RefactoringEngineInterface &refactoringEngineInterface() = 0;
|
||||
virtual std::unique_ptr<AbstractOverviewModel> createOverviewModel() = 0;
|
||||
virtual bool supportsOutline(const TextEditor::TextDocument *) const { return true; }
|
||||
virtual bool supportsLocalUses(const TextEditor::TextDocument *) const { return true; }
|
||||
};
|
||||
|
||||
class CPPEDITOR_EXPORT ModelManagerSupportProvider
|
||||
|
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "cppeditorwidget.h"
|
||||
#include "cppeditordocument.h"
|
||||
#include "cppmodelmanager.h"
|
||||
#include "cpptoolsreuse.h"
|
||||
|
||||
#include <utils/textutils.h>
|
||||
@@ -73,6 +74,9 @@ CppUseSelectionsUpdater::RunnerInfo CppUseSelectionsUpdater::update(CallType cal
|
||||
auto *cppEditorDocument = qobject_cast<CppEditorDocument *>(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());
|
||||
|
@@ -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
|
||||
|
111
src/plugins/qmldesigner/checkablefilelistmodel.cpp
Normal file
@@ -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<CheckableStandardItem*> CheckableFileListModel::checkedItems() const
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
QList<QStandardItem*> allItems = findItems("*", Qt::MatchWildcard);
|
||||
#else
|
||||
QList<QStandardItem*> allItems = findItems(".*", Qt::MatchRegularExpression);
|
||||
#endif
|
||||
QList<CheckableStandardItem*> checkedItems;
|
||||
for (QStandardItem *standardItem : allItems) {
|
||||
CheckableStandardItem *item = static_cast<CheckableStandardItem*>(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<CheckableStandardItem*>(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<CheckableStandardItem*>(QStandardItemModel::item(index.row()));
|
||||
item->setChecked(value.value<bool>());
|
||||
|
||||
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
|
65
src/plugins/qmldesigner/checkablefilelistmodel.h
Normal file
@@ -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 <utils/fileutils.h>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
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<CheckableStandardItem*> checkedItems() const;
|
||||
|
||||
protected:
|
||||
Utils::FilePath rootDir;
|
||||
};
|
||||
|
||||
} //QmlDesigner
|
||||
|
||||
Q_DECLARE_METATYPE(QmlDesigner::CheckableStandardItem)
|
||||
|
||||
#endif // CHECKABLEFILELISTMODEL_H
|
@@ -23,8 +23,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include "cmakegeneratordialog.h"
|
||||
#include "generatecmakelistsconstants.h"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
@@ -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<rowCount(); i++) {
|
||||
CheckableStandardItem *item = static_cast<CheckableStandardItem*>(QStandardItemModel::item(i));
|
||||
item->setChecked(CMakeGeneratorDialogModel::checkedByDefault(FilePath::fromString(item->text())));
|
||||
}
|
||||
}
|
||||
|
||||
QList<CheckableStandardItem*> CheckableFileListModel::checkedItems() const
|
||||
bool CMakeGeneratorDialogModel::checkedByDefault(const FilePath &path) const
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
QList<QStandardItem*> allItems = findItems("*", Qt::MatchWildcard);
|
||||
#else
|
||||
QList<QStandardItem*> allItems = findItems(".*", Qt::MatchRegularExpression);
|
||||
#endif
|
||||
QList<CheckableStandardItem*> checkedItems;
|
||||
for (QStandardItem *standardItem : allItems) {
|
||||
CheckableStandardItem *item = static_cast<CheckableStandardItem*>(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<CheckableStandardItem*>(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<CheckableStandardItem*>(QStandardItemModel::item(index.row()));
|
||||
item->setChecked(value.value<bool>());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return QStandardItemModel::setData(index, value, role);
|
||||
return !path.exists();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -27,36 +27,22 @@
|
||||
#ifndef CMAKEGENERATORDIALOG_H
|
||||
#define CMAKEGENERATORDIALOG_H
|
||||
|
||||
#include "checkablefilelistmodel.h"
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QDialog>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
|
||||
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<CheckableStandardItem*> 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
|
||||
|
@@ -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")) {
|
||||
|
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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)
|
||||
|
@@ -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);
|
||||
|
@@ -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)
|
||||
|
@@ -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();
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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}
|
||||
{}
|
||||
|
||||
|
@@ -24,6 +24,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "generatecmakelists.h"
|
||||
#include "generatecmakelistsconstants.h"
|
||||
#include "cmakegeneratordialog.h"
|
||||
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
@@ -47,6 +48,7 @@
|
||||
#include <QTextStream>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
51
src/plugins/qmldesigner/generatecmakelistsconstants.h
Normal file
@@ -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
|
@@ -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 \
|
||||
|
@@ -1011,6 +1011,9 @@ Project {
|
||||
"generateresource.h",
|
||||
"generatecmakelists.cpp",
|
||||
"generatecmakelists.h",
|
||||
"generatecmakelistsconstants.h",
|
||||
"checkablefilelistmodel.cpp",
|
||||
"checkablefilelistmodel.h",
|
||||
"cmakegeneratordialog.cpp",
|
||||
"cmakegeneratordialog.h",
|
||||
"designersettings.cpp",
|
||||
|
@@ -30,9 +30,13 @@
|
||||
#include <designersettings.h>
|
||||
|
||||
#include <utils/utilsicons.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <android/androidconstants.h>
|
||||
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
@@ -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"),
|
||||
|
@@ -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);
|
||||
|
@@ -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") {
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|