aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThe Qt Project <gerrit-noreply@qt-project.org>2022-11-09 11:28:25 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2022-11-09 11:28:25 +0000
commit5434de83b97d4ca0feb109923e5931ebd9a4693e (patch)
tree81edba0ce9c4dcb0c7ec436d250edcaefcc423db
parent872994b5e5c15a5fc069b50cb2d5e1567aa1f7b7 (diff)
parent63d3a6bd3d3ffb550eccac8e20a75bc3cdc00a4d (diff)
Merge "Merge remote-tracking branch 'origin/8.0' into 9.0" into 9.0
-rw-r--r--doc/qtdesignstudio/images/apply-effect-maker-effect.webpbin0 -> 35166 bytes
-rw-r--r--doc/qtdesignstudio/images/assets-view-effect.pngbin0 -> 4813 bytes
-rw-r--r--doc/qtdesignstudio/images/blur-effect-nodes.pngbin0 -> 44777 bytes
-rw-r--r--doc/qtdesignstudio/images/blur-effect-step-1.webpbin0 -> 4644 bytes
-rw-r--r--doc/qtdesignstudio/images/blur-effect-step-2.webpbin0 -> 6674 bytes
-rw-r--r--doc/qtdesignstudio/images/blur-effect-step-3.webpbin0 -> 7340 bytes
-rw-r--r--doc/qtdesignstudio/images/effect-item-borders-icon.pngbin0 -> 440 bytes
-rw-r--r--doc/qtdesignstudio/images/effect-item-padding-dialog.pngbin0 -> 8742 bytes
-rw-r--r--doc/qtdesignstudio/images/effect-maker-export.pngbin0 -> 23962 bytes
-rw-r--r--doc/qtdesignstudio/images/new-effect-file.pngbin0 -> 9517 bytes
-rw-r--r--doc/qtdesignstudio/images/qt-quick-effect-maker.webpbin0 -> 35348 bytes
-rw-r--r--doc/qtdesignstudio/src/overviews/qtquick-export.qdoc2
-rw-r--r--doc/qtdesignstudio/src/overviews/qtquick-motion-design.qdoc2
-rw-r--r--doc/qtdesignstudio/src/qt-quick-effect-maker.qdoc93
-rw-r--r--doc/qtdesignstudio/src/qtdesignstudio-effect-maker-files.qdoc94
-rw-r--r--doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc5
-rw-r--r--share/qtcreator/qmldesigner/studio_templates/files/effect/file.qep (renamed from share/qtcreator/templates/wizards/files/effect/file.qep)0
-rw-r--r--share/qtcreator/qmldesigner/studio_templates/files/effect/wizard.json64
-rw-r--r--share/qtcreator/templates/wizards/files/effect/wizard.json40
-rw-r--r--src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp2
-rw-r--r--src/plugins/qmldesigner/components/assetslibrary/assetslibrarymodel.cpp7
-rw-r--r--src/plugins/qmldesigner/components/assetslibrary/assetslibrarymodel.h2
-rw-r--r--src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.cpp43
-rw-r--r--src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.h3
-rw-r--r--src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp51
-rw-r--r--src/plugins/qmldesigner/components/componentcore/modelnodeoperations.h1
-rw-r--r--src/plugins/qmldesigner/components/formeditor/dragtool.cpp29
-rw-r--r--src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp24
-rw-r--r--src/plugins/qmldesigner/qmldesignerplugin.cpp24
29 files changed, 388 insertions, 98 deletions
diff --git a/doc/qtdesignstudio/images/apply-effect-maker-effect.webp b/doc/qtdesignstudio/images/apply-effect-maker-effect.webp
new file mode 100644
index 0000000000..64c89bf92b
--- /dev/null
+++ b/doc/qtdesignstudio/images/apply-effect-maker-effect.webp
Binary files differ
diff --git a/doc/qtdesignstudio/images/assets-view-effect.png b/doc/qtdesignstudio/images/assets-view-effect.png
new file mode 100644
index 0000000000..b229f8ddb6
--- /dev/null
+++ b/doc/qtdesignstudio/images/assets-view-effect.png
Binary files differ
diff --git a/doc/qtdesignstudio/images/blur-effect-nodes.png b/doc/qtdesignstudio/images/blur-effect-nodes.png
new file mode 100644
index 0000000000..7c3d57db03
--- /dev/null
+++ b/doc/qtdesignstudio/images/blur-effect-nodes.png
Binary files differ
diff --git a/doc/qtdesignstudio/images/blur-effect-step-1.webp b/doc/qtdesignstudio/images/blur-effect-step-1.webp
new file mode 100644
index 0000000000..1c3dc06af1
--- /dev/null
+++ b/doc/qtdesignstudio/images/blur-effect-step-1.webp
Binary files differ
diff --git a/doc/qtdesignstudio/images/blur-effect-step-2.webp b/doc/qtdesignstudio/images/blur-effect-step-2.webp
new file mode 100644
index 0000000000..3073411b0a
--- /dev/null
+++ b/doc/qtdesignstudio/images/blur-effect-step-2.webp
Binary files differ
diff --git a/doc/qtdesignstudio/images/blur-effect-step-3.webp b/doc/qtdesignstudio/images/blur-effect-step-3.webp
new file mode 100644
index 0000000000..c67de042ff
--- /dev/null
+++ b/doc/qtdesignstudio/images/blur-effect-step-3.webp
Binary files differ
diff --git a/doc/qtdesignstudio/images/effect-item-borders-icon.png b/doc/qtdesignstudio/images/effect-item-borders-icon.png
new file mode 100644
index 0000000000..2739db806d
--- /dev/null
+++ b/doc/qtdesignstudio/images/effect-item-borders-icon.png
Binary files differ
diff --git a/doc/qtdesignstudio/images/effect-item-padding-dialog.png b/doc/qtdesignstudio/images/effect-item-padding-dialog.png
new file mode 100644
index 0000000000..a6c630714e
--- /dev/null
+++ b/doc/qtdesignstudio/images/effect-item-padding-dialog.png
Binary files differ
diff --git a/doc/qtdesignstudio/images/effect-maker-export.png b/doc/qtdesignstudio/images/effect-maker-export.png
new file mode 100644
index 0000000000..35d2a6a3c4
--- /dev/null
+++ b/doc/qtdesignstudio/images/effect-maker-export.png
Binary files differ
diff --git a/doc/qtdesignstudio/images/new-effect-file.png b/doc/qtdesignstudio/images/new-effect-file.png
new file mode 100644
index 0000000000..521c36152c
--- /dev/null
+++ b/doc/qtdesignstudio/images/new-effect-file.png
Binary files differ
diff --git a/doc/qtdesignstudio/images/qt-quick-effect-maker.webp b/doc/qtdesignstudio/images/qt-quick-effect-maker.webp
new file mode 100644
index 0000000000..2e98f7b02e
--- /dev/null
+++ b/doc/qtdesignstudio/images/qt-quick-effect-maker.webp
Binary files differ
diff --git a/doc/qtdesignstudio/src/overviews/qtquick-export.qdoc b/doc/qtdesignstudio/src/overviews/qtquick-export.qdoc
index dd99cc3f49..1d7661fdd3 100644
--- a/doc/qtdesignstudio/src/overviews/qtquick-export.qdoc
+++ b/doc/qtdesignstudio/src/overviews/qtquick-export.qdoc
@@ -4,7 +4,7 @@
/*!
\page creator-exporting-qml.html
\previouspage studio-importing-3d.html
- \nextpage qtquick-motion-design.html
+ \nextpage qt-effect-maker-files.html
\title Exporting Components
diff --git a/doc/qtdesignstudio/src/overviews/qtquick-motion-design.qdoc b/doc/qtdesignstudio/src/overviews/qtquick-motion-design.qdoc
index 5314fe7ef2..aade258132 100644
--- a/doc/qtdesignstudio/src/overviews/qtquick-motion-design.qdoc
+++ b/doc/qtdesignstudio/src/overviews/qtquick-motion-design.qdoc
@@ -3,7 +3,7 @@
/*!
\page qtquick-motion-design.html
- \previouspage creator-exporting-qml.html
+ \previouspage qt-effect-maker.html
\nextpage quick-animation-overview.html
\title Motion Design
diff --git a/doc/qtdesignstudio/src/qt-quick-effect-maker.qdoc b/doc/qtdesignstudio/src/qt-quick-effect-maker.qdoc
new file mode 100644
index 0000000000..56dfebfe30
--- /dev/null
+++ b/doc/qtdesignstudio/src/qt-quick-effect-maker.qdoc
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 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 qt-effect-maker.html
+ \previouspage qt-effect-maker-files.html
+ \nextpage qtquick-motion-design.html
+ \sa {Creating Qt Quick Effect Maker Files}
+
+ \title Working with Effects in Qt Quick Effect Maker
+
+ The Qt Quick Effect Maker is a tool to create high-performance
+ shader effects for Qt Quick.
+
+ You can import these effects to \QDS and you can run Qt Quick Effect Maker
+ from \QDS.
+
+ \section1 Creating Effects
+
+ When you run Qt Quick Effect Maker, it starts with an empty project. To
+ create your effect, add nodes to the node tree.
+
+ \image qt-quick-effect-maker.webp
+
+ Consider the following things when creating effects:
+
+ \list
+ \li Some nodes do not function alone, they need a helper node. For
+ example, the \uicontrol FastBlur node needs a \uicontrol BlurHelper node
+ and the \uicontrol Noise node needs a \uicontrol NoiseHelper node. If the
+ node needs another node, it is mentioned in the node description.
+ \li If your effect appears cropped, you need to go to \uicontrol Edit >
+ \uicontrol {Project Settings} and increase the item padding.
+ \endlist
+
+ \section2 Creating a Blur Effect
+
+ To create a blur effect:
+
+ \list 1
+ \li Add a \uicontrol FastBlur node to the node tree.
+ \li Add a \uicontrol BlurHelper node to the node tree. You need the
+ \uicontrol BlurHelper node for all effects that contains a blur effect.
+ \endlist
+
+ \image blur-effect-nodes.png
+
+ You can now select the \uicontrol FastBlur node and in the settings, change
+ the \uicontrol fastBlurAmount value to control the amount of blur.
+
+ \image blur-effect-step-1.webp
+
+ \section3 Adjusting Item Borders
+
+ The effect appears cropped. You need to adjust item borders:
+
+ \list 1
+ \li Select \inlineimage effect-item-borders-icon.png
+ to display item borders.
+ \image blur-effect-step-2.webp
+ \li Go to \uicontrol Edit > \uicontrol {Project Settings}.
+ \li Set the item padding for all sides to 100.
+ \image effect-item-padding-dialog.png
+ \endlist
+
+ Now, you can see the complete blur effect.
+
+ \image blur-effect-step-3.webp
+
+*/
diff --git a/doc/qtdesignstudio/src/qtdesignstudio-effect-maker-files.qdoc b/doc/qtdesignstudio/src/qtdesignstudio-effect-maker-files.qdoc
new file mode 100644
index 0000000000..e00bb35486
--- /dev/null
+++ b/doc/qtdesignstudio/src/qtdesignstudio-effect-maker-files.qdoc
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 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 qt-effect-maker-files.html
+ \nextpage qt-effect-maker.html
+ \previouspage creator-exporting-qml.html
+ \sa {Working with Effects in Qt Quick Effect Maker}
+
+ \title Creating Qt Quick Effect Maker Files
+
+ \section1 Creating an Effect File
+
+ You can create empty Qt Quick Effect Maker effect (.qep) files in \QDS and
+ then edit them in Qt Quick Effect Maker.
+
+ To create an effect file:
+
+ \list 1
+ \li In \QDS, go to \uicontrol File > \uicontrol {New File}.
+ \li Go to the \uicontrol Effects tab and select
+ \uicontrol {Effect file (Effect Maker)}.
+ \image new-effect-file.png
+ \li Select \uicontrol Choose and follow the wizard to create the file.
+ \endlist
+
+ After you have created the effect file, it is available in the
+ \uicontrol Assets view.
+
+ \image assets-view-effect.png
+
+ \section2 Editing and Re-importing an Effect File
+
+ To edit an effect file in Qt Quick Effect Maker, double-click it in
+ the \uicontrol Assets view. This opens the effect in Qt Quick Effect
+ Maker where you can make your changes.
+
+ When you have edited the effect file in Qt Quick Effect Maker, you need
+ to save and export it:
+ \list 1
+ \li In Qt Quick Effect Maker, go to \uicontrol File > \uicontrol Save.
+ \li Select \uicontrol File > \uicontrol Export.
+ \li With the default settings, select \uicontrol Ok.
+ \image effect-maker-export.png
+ \endlist
+
+ Now, you can close Qt Quick Effect Maker and return to \QDS and apply the
+ effect.
+
+ \section1 Applying an Effect
+
+ You can apply effects to components in \QDS. To do so, drag the effect
+ from the \uicontrol Assets view to the component in the \uicontrol 2D view.
+
+ \image apply-effect-maker-effect.webp
+
+ \section1 Animated Effect
+
+ When you import an animated effect, you need to turn on the animation for it
+ to see the animation in your \QDS application.
+
+ To turn on animation for an effect, first apply the effect to a component,
+ and then:
+
+ \list 1
+ \li Select the effect in \uicontrol Navigator.
+ \li In \uicontrol Properties, go to the
+ \uicontrol {Exposed Custom Properties} section and set
+ \uicontrol timeRunning to true.
+ \endlist
+*/
diff --git a/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc b/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc
index e80d375034..d653205959 100644
--- a/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc
+++ b/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc
@@ -174,6 +174,11 @@
\li \l{Importing 3D Assets}
\endlist
\li \l{Exporting Components}
+ \li Qt Quick Effect Maker
+ \list
+ \li \l{Creating Qt Quick Effect Maker Files}
+ \li \l{Working with Effects in Qt Quick Effect Maker}
+ \endlist
\endlist
\endlist
\li \l{Motion Design}
diff --git a/share/qtcreator/templates/wizards/files/effect/file.qep b/share/qtcreator/qmldesigner/studio_templates/files/effect/file.qep
index e69de29bb2..e69de29bb2 100644
--- a/share/qtcreator/templates/wizards/files/effect/file.qep
+++ b/share/qtcreator/qmldesigner/studio_templates/files/effect/file.qep
diff --git a/share/qtcreator/qmldesigner/studio_templates/files/effect/wizard.json b/share/qtcreator/qmldesigner/studio_templates/files/effect/wizard.json
new file mode 100644
index 0000000000..3dedbb5080
--- /dev/null
+++ b/share/qtcreator/qmldesigner/studio_templates/files/effect/wizard.json
@@ -0,0 +1,64 @@
+{
+ "version": 1,
+ "supportedProjectTypes": [ ],
+ "id": "J.QEP",
+ "category": "U.QEP",
+ "trDescription": "Creates an Effect Maker file.",
+ "trDisplayName": "Effect File (Effect Maker)",
+ "trDisplayCategory": "Effects",
+ "iconText": "qep",
+ "platformIndependent": true,
+ "enabled": "%{JS: value('Features').indexOf('QmlDesigner.Wizards.Enterprise') >= 0}",
+ "featuresRequired": [ "QmlDesigner.Wizards.Enterprise" ],
+
+ "options": [
+ { "key": "EffectFile", "value": "%{Class}.qep" },
+ { "key": "DoNotOpenFile", "value": "true" }
+ ],
+
+ "pages" :
+ [
+ {
+ "trDisplayName": "Define Class",
+ "trShortTitle": "Details",
+ "typeId": "Fields",
+ "data" :
+ [
+ {
+ "name": "Class",
+ "trDisplayName": "Effect name:",
+ "mandatory": true,
+ "type": "LineEdit",
+ "data": {
+ "validator": "(?:[A-Z_][a-zA-Z_0-9]*|)",
+ "fixup": "%{JS: '%{INPUT}'.charAt(0).toUpperCase() + '%{INPUT}'.slice(1) }"
+ }
+ },
+ {
+ "name": "TargetPath",
+ "type": "PathChooser",
+ "trDisplayName": "Path:",
+ "mandatory": true,
+ "data":
+ {
+ "kind": "existingDirectory",
+ "basePath": "%{InitialPath}",
+ "path": "%{InitialPath}"
+ }
+ }
+ ]
+ }
+],
+ "generators" :
+ [
+ {
+ "typeId": "File",
+ "data":
+ {
+ "source": "file.qep",
+ "target": "%{TargetPath}/%{EffectFile}",
+ "openInEditor": false
+ }
+ }
+ ]
+}
diff --git a/share/qtcreator/templates/wizards/files/effect/wizard.json b/share/qtcreator/templates/wizards/files/effect/wizard.json
deleted file mode 100644
index d966f097ed..0000000000
--- a/share/qtcreator/templates/wizards/files/effect/wizard.json
+++ /dev/null
@@ -1,40 +0,0 @@
-{
- "version": 1,
- "supportedProjectTypes": [ ],
- "id": "J.QEP",
- "category": "U.QEP",
- "trDescription": "Creates an Effect Maker file.",
- "trDisplayName": "Effect File (Effect Maker)",
- "trDisplayCategory": "Effects",
- "iconText": "qep",
- "platformIndependent": true,
- "enabled": true,
-
- "options": { "key": "DefaultSuffix", "value": "qep" },
-
- "pages" :
- [
- {
- "trDisplayName": "Location",
- "trShortTitle": "Location",
- "typeId": "File"
- },
- {
- "trDisplayName": "Project Management",
- "trShortTitle": "Summary",
- "typeId": "Summary"
- }
- ],
- "generators" :
- [
- {
- "typeId": "File",
- "data":
- {
- "source": "file.qep",
- "target": "%{JS: Util.fileName(value('TargetPath'), value('DefaultSuffix'))}",
- "openInEditor": false
- }
- }
- ]
-}
diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp
index 6ec0b1b544..a635a45c05 100644
--- a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp
+++ b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp
@@ -423,7 +423,7 @@ QString JsonWizard::evaluate(const QVariant &v) const
void JsonWizard::openFiles(const JsonWizard::GeneratorFiles &files)
{
QString errorMessage;
- bool openedSomething = false;
+ bool openedSomething = stringValue("DoNotOpenFile") == "true";
for (const JsonWizard::GeneratorFile &f : files) {
const Core::GeneratedFile &file = f.file;
if (!file.filePath().exists()) {
diff --git a/src/plugins/qmldesigner/components/assetslibrary/assetslibrarymodel.cpp b/src/plugins/qmldesigner/components/assetslibrary/assetslibrarymodel.cpp
index 153e409c45..0a28eab321 100644
--- a/src/plugins/qmldesigner/components/assetslibrary/assetslibrarymodel.cpp
+++ b/src/plugins/qmldesigner/components/assetslibrary/assetslibrarymodel.cpp
@@ -64,6 +64,13 @@ bool AssetsLibraryModel::loadExpandedState(const QString &assetPath)
return m_expandedStateHash.value(assetPath, true);
}
+bool AssetsLibraryModel::isEffectQmlExist(const QString &effectName)
+{
+ Utils::FilePath effectsResDir = ModelNodeOperations::getEffectsDirectory();
+ Utils::FilePath qmlPath = effectsResDir.resolvePath(effectName + "/" + effectName + ".qml");
+ return qmlPath.exists();
+}
+
AssetsLibraryModel::DirExpandState AssetsLibraryModel::getAllExpandedState() const
{
const auto keys = m_expandedStateHash.keys();
diff --git a/src/plugins/qmldesigner/components/assetslibrary/assetslibrarymodel.h b/src/plugins/qmldesigner/components/assetslibrary/assetslibrarymodel.h
index 82dd1568d5..c7d3ee493b 100644
--- a/src/plugins/qmldesigner/components/assetslibrary/assetslibrarymodel.h
+++ b/src/plugins/qmldesigner/components/assetslibrary/assetslibrarymodel.h
@@ -52,6 +52,8 @@ public:
static void saveExpandedState(bool expanded, const QString &assetPath);
static bool loadExpandedState(const QString &assetPath);
+ static bool isEffectQmlExist(const QString &effectName);
+
enum class DirExpandState {
SomeExpanded,
AllExpanded,
diff --git a/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.cpp b/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.cpp
index 44f1c2e747..5639e9d91e 100644
--- a/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.cpp
+++ b/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.cpp
@@ -24,7 +24,6 @@
#include <utils/utilsicons.h>
#include "utils/environment.h"
#include "utils/filepath.h"
-#include "utils/qtcprocess.h"
#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
@@ -50,9 +49,6 @@
#include <QQmlContext>
#include <QQuickItem>
-#include <qtsupport/baseqtversion.h>
-#include <qtsupport/qtkitinformation.h>
-
namespace QmlDesigner {
static QString propertyEditorResourcesPath()
@@ -242,44 +238,7 @@ QSet<QString> AssetsLibraryWidget::supportedAssetSuffixes(bool complex)
void AssetsLibraryWidget::openEffectMaker(const QString &filePath)
{
- const ProjectExplorer::Target *target = ProjectExplorer::ProjectTree::currentTarget();
- if (!target) {
- qWarning() << __FUNCTION__ << "No project open";
- return;
- }
-
- Utils::FilePath projectPath = target->project()->projectDirectory();
- QString effectName = QFileInfo(filePath).baseName();
- QString effectResDir = "asset_imports/Effects/" + effectName;
- Utils::FilePath effectResPath = projectPath.resolvePath(effectResDir);
- if (!effectResPath.exists())
- QDir(projectPath.toString()).mkpath(effectResDir);
-
- const QtSupport::QtVersion *baseQtVersion = QtSupport::QtKitAspect::qtVersion(target->kit());
- if (baseQtVersion) {
- auto effectMakerPath = baseQtVersion->binPath().pathAppended("QQEffectMaker").withExecutableSuffix();
- if (!effectMakerPath.exists()) {
- qWarning() << __FUNCTION__ << "Cannot find EffectMaker app";
- return;
- }
-
- Utils::FilePath effectPath = Utils::FilePath::fromString(filePath);
- QString effectContents = QString::fromUtf8(effectPath.fileContents().value_or(QByteArray()));
- QStringList arguments;
- arguments << filePath;
- if (effectContents.isEmpty())
- arguments << "--create";
- arguments << "--exportpath" << effectResPath.toString();
-
- Utils::Environment env = Utils::Environment::systemEnvironment();
- if (env.osType() == Utils::OsTypeMac)
- env.appendOrSet("QSG_RHI_BACKEND", "metal");
-
- m_qqemProcess.reset(new Utils::QtcProcess);
- m_qqemProcess->setEnvironment(env);
- m_qqemProcess->setCommand({ effectMakerPath, arguments });
- m_qqemProcess->start();
- }
+ ModelNodeOperations::openEffectMaker(filePath);
}
void AssetsLibraryWidget::setModel(Model *model)
diff --git a/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.h b/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.h
index dad53e4e73..8ac41a44a3 100644
--- a/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.h
+++ b/src/plugins/qmldesigner/components/assetslibrary/assetslibrarywidget.h
@@ -22,7 +22,6 @@ QT_END_NAMESPACE
namespace Utils {
class FileSystemWatcher;
- class QtcProcess;
}
namespace QmlDesigner {
@@ -96,8 +95,6 @@ private:
bool m_updateRetry = false;
QString m_filterText;
QPoint m_dragStartPoint;
-
- std::unique_ptr<Utils::QtcProcess> m_qqemProcess;
};
} // namespace QmlDesigner
diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp
index a1dd5914a2..1aa278fc53 100644
--- a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp
+++ b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp
@@ -47,11 +47,15 @@
#include <projectexplorer/project.h>
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/projecttree.h>
-#include "projectexplorer/session.h"
+#include "projectexplorer/target.h"
+
+#include <qtsupport/baseqtversion.h>
+#include <qtsupport/qtkitinformation.h>
#include <utils/algorithm.h>
#include <utils/fileutils.h>
#include <utils/qtcassert.h>
+#include "utils/qtcprocess.h"
#include <utils/smallstring.h>
#include <QComboBox>
@@ -1610,6 +1614,51 @@ void updateImported3DAsset(const SelectionContext &selectionContext)
}
}
+void openEffectMaker(const QString &filePath)
+{
+ const ProjectExplorer::Target *target = ProjectExplorer::ProjectTree::currentTarget();
+ if (!target) {
+ qWarning() << __FUNCTION__ << "No project open";
+ return;
+ }
+
+ Utils::FilePath projectPath = target->project()->projectDirectory();
+ QString effectName = QFileInfo(filePath).baseName();
+ QString effectResDir = "asset_imports/Effects/" + effectName;
+ Utils::FilePath effectResPath = projectPath.resolvePath(effectResDir);
+ if (!effectResPath.exists())
+ QDir(projectPath.toString()).mkpath(effectResDir);
+
+ const QtSupport::QtVersion *baseQtVersion = QtSupport::QtKitAspect::qtVersion(target->kit());
+ if (baseQtVersion) {
+ auto effectMakerPath = baseQtVersion->binPath().pathAppended("QQEffectMaker").withExecutableSuffix();
+ if (!effectMakerPath.exists()) {
+ qWarning() << __FUNCTION__ << "Cannot find EffectMaker app";
+ return;
+ }
+
+ Utils::FilePath effectPath = Utils::FilePath::fromString(filePath);
+ QStringList arguments;
+ arguments << filePath;
+ if (effectPath.fileContents())
+ arguments << "--create";
+ arguments << "--exportpath" << effectResPath.toString();
+
+ Utils::Environment env = Utils::Environment::systemEnvironment();
+ if (env.osType() == Utils::OsTypeMac)
+ env.appendOrSet("QSG_RHI_BACKEND", "metal");
+
+ Utils::QtcProcess *qqemProcess = new Utils::QtcProcess();
+ qqemProcess->setEnvironment(env);
+ qqemProcess->setCommand({ effectMakerPath, arguments });
+ qqemProcess->start();
+
+ QObject::connect(qqemProcess, &Utils::QtcProcess::done, [qqemProcess]() {
+ qqemProcess->deleteLater();
+ });
+ }
+}
+
Utils::FilePath getEffectsDirectory()
{
QString defaultDir = "asset_imports/Effects";
diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.h b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.h
index 9238e1a81e..c4956e250b 100644
--- a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.h
+++ b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.h
@@ -79,6 +79,7 @@ void openSignalDialog(const SelectionContext &selectionContext);
void updateImported3DAsset(const SelectionContext &selectionContext);
QMLDESIGNERCORE_EXPORT Utils::FilePath getEffectsDirectory();
+void openEffectMaker(const QString &filePath);
// ModelNodePreviewImageOperations
QVariant previewImageDataForGenericNode(const ModelNode &modelNode);
diff --git a/src/plugins/qmldesigner/components/formeditor/dragtool.cpp b/src/plugins/qmldesigner/components/formeditor/dragtool.cpp
index 735a88f7d7..1ab170fc1c 100644
--- a/src/plugins/qmldesigner/components/formeditor/dragtool.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/dragtool.cpp
@@ -6,7 +6,9 @@
#include "formeditorscene.h"
#include "formeditorview.h"
#include "assetslibrarywidget.h"
+#include "assetslibrarymodel.h"
#include <metainfo.h>
+#include <modelnodeoperations.h>
#include <nodehints.h>
#include <rewritingexception.h>
#include "qmldesignerconstants.h"
@@ -19,6 +21,7 @@
#include <QMimeData>
#include <QTimer>
#include <QWidget>
+#include <QMessageBox>
static Q_LOGGING_CATEGORY(dragToolInfo, "qtc.qmldesigner.formeditor", QtWarningMsg);
@@ -242,9 +245,31 @@ void DragTool::dropEvent(const QList<QGraphicsItem *> &itemList, QGraphicsSceneD
if (targetContainerFormEditorItem) {
QmlItemNode parentQmlItemNode = targetContainerFormEditorItem->qmlItemNode();
QString effectName = QFileInfo(effectPath).baseName();
- QmlItemNode effectNode = QmlItemNode::createQmlItemNodeForEffect(view(), parentQmlItemNode, effectName);
- view()->setSelectedModelNodes({effectNode});
+ if (!AssetsLibraryModel::isEffectQmlExist(effectName)) {
+ QMessageBox msgBox;
+ msgBox.setText("Effect " + effectName + " is empty");
+ msgBox.setInformativeText("Do you want to edit " + effectName + "?");
+ msgBox.setStandardButtons(QMessageBox::No |QMessageBox::Yes);
+ msgBox.setDefaultButton(QMessageBox::Yes);
+ msgBox.setIcon(QMessageBox::Question);
+ int ret = msgBox.exec();
+ switch (ret) {
+ case QMessageBox::Yes:
+ ModelNodeOperations::openEffectMaker(effectPath);
+ break;
+ default:
+ break;
+ }
+
+ event->ignore();
+ return;
+ }
+
+ QmlItemNode effectNode = QmlItemNode::
+ createQmlItemNodeForEffect(view(), parentQmlItemNode, effectName);
+
+ view()->setSelectedModelNodes({parentQmlItemNode});
view()->resetPuppet();
commitTransaction();
diff --git a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
index d42c8f08a0..332e30fa10 100644
--- a/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
+++ b/src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
@@ -17,6 +17,8 @@
#include "modelmerger.h"
#include "rewritingexception.h"
+#include <coreplugin/icore.h>
+
#include <QUrl>
#include <QPlainTextEdit>
#include <QFileInfo>
@@ -159,12 +161,22 @@ QmlItemNode QmlItemNode::createQmlItemNodeFromFont(AbstractView *view,
return newQmlItemNode;
}
+static bool useLayerEffect()
+{
+ QSettings *settings = Core::ICore::settings();
+ const QString layerEffectEntry = "QML/Designer/UseLayerEffect";
+
+ return settings->value(layerEffectEntry, true).toBool();
+}
+
QmlItemNode QmlItemNode::createQmlItemNodeForEffect(AbstractView *view,
const QmlItemNode &parentNode,
const QString &effectName)
{
QmlItemNode newQmlItemNode;
+ const bool layerEffect = useLayerEffect();
+
QmlDesigner::Import import = Import::createLibraryImport("Effects." + effectName, "1.0");
try {
if (!view->model()->hasImport(import, true, true))
@@ -175,11 +187,17 @@ QmlItemNode QmlItemNode::createQmlItemNodeForEffect(AbstractView *view,
TypeName type(effectName.toUtf8());
newQmlItemNode = QmlItemNode(view->createModelNode(type, 1, 0));
- NodeAbstractProperty parentProperty = parentNode.defaultNodeAbstractProperty();
+ NodeAbstractProperty parentProperty = layerEffect
+ ? parentNode.nodeAbstractProperty("layer.effect")
+ : parentNode.defaultNodeAbstractProperty();
parentProperty.reparentHere(newQmlItemNode);
- newQmlItemNode.modelNode().bindingProperty("source").setExpression("parent");
- newQmlItemNode.modelNode().bindingProperty("anchors.fill").setExpression("parent");
+ if (!layerEffect) {
+ newQmlItemNode.modelNode().bindingProperty("source").setExpression("parent");
+ newQmlItemNode.modelNode().bindingProperty("anchors.fill").setExpression("parent");
+ } else {
+ parentNode.modelNode().variantProperty("layer.enabled").setValue(true);
+ }
QTC_ASSERT(newQmlItemNode.isValid(), return QmlItemNode());
diff --git a/src/plugins/qmldesigner/qmldesignerplugin.cpp b/src/plugins/qmldesigner/qmldesignerplugin.cpp
index 99ff2b59c3..5373a1892a 100644
--- a/src/plugins/qmldesigner/qmldesignerplugin.cpp
+++ b/src/plugins/qmldesigner/qmldesignerplugin.cpp
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "qmldesignerplugin.h"
+#include "coreplugin/iwizardfactory.h"
#include "designmodecontext.h"
#include "designmodewidget.h"
#include "dynamiclicensecheck.h"
@@ -39,8 +40,10 @@
#include <coreplugin/coreconstants.h>
#include <coreplugin/designmode.h>
#include <coreplugin/editormanager/editormanager.h>
+#include <coreplugin/featureprovider.h>
#include <coreplugin/icore.h>
#include <coreplugin/idocument.h>
+#include <coreplugin/iwizardfactory.h>
#include <coreplugin/messagebox.h>
#include <coreplugin/modemanager.h>
#include <extensionsystem/pluginmanager.h>
@@ -52,19 +55,19 @@
#include <sqlitelibraryinitializer.h>
#include <qmljs/qmljsmodelmanagerinterface.h>
+#include <utils/algorithm.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
-#include <utils/algorithm.h>
#include <QAction>
-#include <QTimer>
+#include <QApplication>
#include <QCoreApplication>
-#include <qplugin.h>
#include <QDebug>
#include <QProcessEnvironment>
#include <QScreen>
+#include <QTimer>
#include <QWindow>
-#include <QApplication>
+#include <qplugin.h>
#include "nanotrace/nanotrace.h"
#include <modelnodecontextmenu_helper.h>
@@ -77,6 +80,17 @@ namespace QmlDesigner {
namespace Internal {
+class EnterpriseFeatureProvider : public Core::IFeatureProvider
+{
+public:
+ QSet<Utils::Id> availableFeatures(Utils::Id id) const override
+ {
+ return {"QmlDesigner.Wizards.Enterprise"};
+ }
+ QSet<Utils::Id> availablePlatforms() const override { return {}; }
+ QString displayNameForPlatform(Utils::Id id) const override { return {}; }
+};
+
QString normalizeIdentifier(const QString &string)
{
if (string.isEmpty())
@@ -262,6 +276,8 @@ bool QmlDesignerPlugin::initialize(const QStringList & /*arguments*/, QString *e
//TODO Move registering those types out of the property editor, since they are used also in the states editor
Quick2PropertyEditorView::registerQmlTypes();
+ if (QmlDesigner::checkLicense() == QmlDesigner::FoundLicense::enterprise)
+ Core::IWizardFactory::registerFeatureProvider(new EnterpriseFeatureProvider);
Exception::setWarnAboutException(!QmlDesignerPlugin::instance()
->settings()
.value(DesignerSettingsKey::ENABLE_MODEL_EXCEPTION_OUTPUT)