Merge "Merge remote-tracking branch 'origin/8.0' into 9.0" into 9.0

This commit is contained in:
The Qt Project
2022-11-09 11:28:25 +00:00
29 changed files with 388 additions and 98 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@@ -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

View File

@@ -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

View File

@@ -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
*/

View File

@@ -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
*/

View File

@@ -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}

View File

@@ -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
}
}
]
}

View File

@@ -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
}
}
]
}

View File

@@ -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()) {

View File

@@ -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();

View File

@@ -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,

View File

@@ -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)

View File

@@ -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

View File

@@ -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";

View File

@@ -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);

View File

@@ -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();

View File

@@ -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());

View File

@@ -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)