From 07ab73fe7f0059767e8d4f7b70fcec0fdc4811a4 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 26 Sep 2022 16:52:16 +0300 Subject: QmlDesigner: Disable paste option for the original material Fixes: QDS-7526 Change-Id: Ifdc220685a4881dc3a397d9148022b9be7b5032a Reviewed-by: Reviewed-by: Mahmoud Badri --- .../materialBrowserQmlSource/MaterialBrowser.qml | 12 +++++++++--- .../materialbrowser/materialbrowsermodel.cpp | 21 +++++++++++++++------ .../materialbrowser/materialbrowsermodel.h | 2 ++ .../materialbrowser/materialbrowserview.cpp | 2 +- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml b/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml index 20d970e4c5..d783a9bb05 100644 --- a/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml +++ b/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml @@ -39,6 +39,7 @@ Item { property var currentMaterial: null property int currentMaterialIdx: 0 property var currentBundleMaterial: null + property int copiedMaterialInternalId: -1 property var matSectionsModel: [] @@ -147,15 +148,20 @@ Item { StudioControls.MenuItem { text: modelData enabled: root.currentMaterial - onTriggered: materialBrowserModel.copyMaterialProperties(root.currentMaterialIdx, modelData) + onTriggered: { + root.copiedMaterialInternalId = root.currentMaterial.materialInternalId + materialBrowserModel.copyMaterialProperties(root.currentMaterialIdx, modelData) + } } } } StudioControls.MenuItem { text: qsTr("Paste properties") - enabled: root.currentMaterial && root.currentMaterial.materialType - === materialBrowserModel.copiedMaterialType + enabled: root.currentMaterial + && root.copiedMaterialInternalId !== root.currentMaterial.materialInternalId + && root.currentMaterial.materialType === materialBrowserModel.copiedMaterialType + && materialBrowserModel.isCopiedMaterialValid() onTriggered: materialBrowserModel.pasteMaterialProperties(root.currentMaterialIdx) } diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.cpp b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.cpp index b5d85a4cb8..dd828de352 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.cpp +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.cpp @@ -348,8 +348,8 @@ void MaterialBrowserModel::duplicateMaterial(int idx) void MaterialBrowserModel::copyMaterialProperties(int idx, const QString §ion) { - ModelNode mat = m_materialList.at(idx); - QString matType = QString::fromLatin1(mat.type()); + m_copiedMaterial = m_materialList.at(idx); + QString matType = QString::fromLatin1(m_copiedMaterial.type()); if (matType.startsWith("QtQuick3D.")) matType.remove("QtQuick3D."); @@ -358,7 +358,7 @@ void MaterialBrowserModel::copyMaterialProperties(int idx, const QString §io m_allPropsCopied = section == "All"; if (m_allPropsCopied || m_propertyGroupsObj.empty()) { - m_copiedMaterialProps = mat.properties(); + m_copiedMaterialProps = m_copiedMaterial.properties(); } else { QJsonObject propsSpecObj = m_propertyGroupsObj.value(m_copiedMaterialType).toObject(); if (propsSpecObj.contains(section)) { // should always be true @@ -366,14 +366,14 @@ void MaterialBrowserModel::copyMaterialProperties(int idx, const QString §io const QJsonArray propNames = propsSpecObj.value(section).toArray(); // auto == QJsonValueConstRef after 04dc959d49e5e3 / Qt 6.4, QJsonValueRef before for (const auto &propName : propNames) - m_copiedMaterialProps.append(mat.property(propName.toString().toLatin1())); + m_copiedMaterialProps.append(m_copiedMaterial.property(propName.toString().toLatin1())); if (section == "Base") { // add QtQuick3D.Material base props as well QJsonObject propsMatObj = m_propertyGroupsObj.value("Material").toObject(); const QJsonArray propNames = propsMatObj.value("Base").toArray(); // auto == QJsonValueConstRef after 04dc959d49e5e3 / Qt 6.4, QJsonValueRef before for (const auto &propName : propNames) - m_copiedMaterialProps.append(mat.property(propName.toString().toLatin1())); + m_copiedMaterialProps.append(m_copiedMaterial.property(propName.toString().toLatin1())); } } } @@ -381,7 +381,9 @@ void MaterialBrowserModel::copyMaterialProperties(int idx, const QString §io void MaterialBrowserModel::pasteMaterialProperties(int idx) { - emit pasteMaterialPropertiesTriggered(m_materialList.at(idx), m_copiedMaterialProps, m_allPropsCopied); + ModelNode targetMat = m_materialList.at(idx); + if (targetMat.isValid() && m_copiedMaterial.isValid() && targetMat != m_copiedMaterial) + emit pasteMaterialPropertiesTriggered(targetMat, m_copiedMaterialProps, m_allPropsCopied); } void MaterialBrowserModel::deleteMaterial(int idx) @@ -418,4 +420,11 @@ void MaterialBrowserModel::openMaterialEditor() QmlDesignerPlugin::instance()->mainWidget()->showDockWidget("MaterialEditor", true); } +// This is provided as invokable instead of property, as it is difficult to know when ModelNode +// becomes invalid. Much simpler to evaluate this on demand. +bool MaterialBrowserModel::isCopiedMaterialValid() const +{ + return m_copiedMaterial.isValid(); +} + } // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.h b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.h index daa39c3539..704cdcb644 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.h +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.h @@ -92,6 +92,7 @@ public: Q_INVOKABLE void addNewMaterial(); Q_INVOKABLE void applyToSelected(qint64 internalId, bool add = false); Q_INVOKABLE void openMaterialEditor(); + Q_INVOKABLE bool isCopiedMaterialValid() const; signals: void isEmptyChanged(); @@ -118,6 +119,7 @@ private: QStringList m_defaultMaterialSections; QStringList m_principledMaterialSections; QStringList m_customMaterialSections; + ModelNode m_copiedMaterial; QList m_copiedMaterialProps; QHash m_materialIndexHash; // internalId -> index QJsonObject m_propertyGroupsObj; diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp index b88c0a77d7..13f7ad211d 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp @@ -110,7 +110,7 @@ WidgetInfo MaterialBrowserView::widgetInfo() // apply pasted properties for (const AbstractProperty &prop : props) { - if (prop.name() == "objectName") + if (prop.name() == "objectName" || !prop.isValid()) continue; if (prop.isVariantProperty()) -- cgit v1.2.3 From 79994c85040338bbe11b021d173bcda247b2991a Mon Sep 17 00:00:00 2001 From: Henning Gruendl Date: Mon, 26 Sep 2022 16:29:26 +0200 Subject: QmlDesigner: Fix gap between extended states Fix the gap between more than 4 extended states in a row. Change-Id: I9c8435de0cba74267a23a970e0967388692f5811 Reviewed-by: Reviewed-by: Thomas Hartmann --- share/qtcreator/qmldesigner/newstateseditor/Main.qml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/share/qtcreator/qmldesigner/newstateseditor/Main.qml b/share/qtcreator/qmldesigner/newstateseditor/Main.qml index 29feb5741d..5f4cfa1ab0 100644 --- a/share/qtcreator/qmldesigner/newstateseditor/Main.qml +++ b/share/qtcreator/qmldesigner/newstateseditor/Main.qml @@ -747,8 +747,7 @@ Rectangle { height: extendGap.portraitOneColumn ? root.innerGridSpacing : Constants.thumbnailSize + 2 * root.extend color: StudioTheme.Values.themeStateHighlight - visible: extendBackground.radius !== 0 - && extendBackground.visible + visible: extendBackground.visible } StateThumbnail { -- cgit v1.2.3 From 3b4b8aec4b6642eb71e48f0ea78f77de400196bb Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 27 Sep 2022 09:04:00 +0200 Subject: QmlDesigner: Adjust caption for User Added Properties Section does not have a tooltip, yet. Task-number: QDS-7765 Change-Id: I5c0254cb81094be690fc5e9a076752f95f27a482 Reviewed-by: Tim Jenssen Reviewed-by: Reviewed-by: Pranta Ghosh Dastider Reviewed-by: Brook Cronin --- .../imports/HelperWidgets/DynamicPropertiesSection.qml | 2 +- .../qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/DynamicPropertiesSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/DynamicPropertiesSection.qml index fedf76bdbb..4e2ef4b044 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/DynamicPropertiesSection.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/DynamicPropertiesSection.qml @@ -35,7 +35,7 @@ Section { id: root anchors.left: parent.left anchors.right: parent.right - caption: qsTr("User Added Properties") + caption: qsTr("Local Custom Properties") property DynamicPropertiesModel propertiesModel: null diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp index c38136cdd7..da6a477e68 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp @@ -725,7 +725,7 @@ QString PropertyEditorQmlBackend::templateGeneration(const NodeMetaInfo &type, QString qmlInnerTemplate = ""; qmlInnerTemplate += "Section {\n"; - qmlInnerTemplate += "caption: \""+ QObject::tr("User Added Properties") + "\"\n"; + qmlInnerTemplate += "caption: \"" + QObject::tr("Exposed Custom Properties") + "\"\n"; qmlInnerTemplate += anchorLeftRight; qmlInnerTemplate += "leftPadding: 0\n"; qmlInnerTemplate += "rightPadding: 0\n"; -- cgit v1.2.3 From 67112a581fe0864b99e8a45ae47611d714fb20a2 Mon Sep 17 00:00:00 2001 From: Mats Honkamaa Date: Tue, 27 Sep 2022 11:25:59 +0300 Subject: Doc: Fix branding issue \QC rendered as Qt Design Studio in places where it should be Qt Creator. Task-number: QDS-7712 Change-Id: I16df93bbb7881c280e96aede32f5619d1228b8f5 Reviewed-by: Leena Miettinen --- .../src/components/qtquick-data-models.qdoc | 2 +- doc/qtdesignstudio/src/components/qtquick-images.qdoc | 2 +- .../src/components/qtquick-positioning.qdoc | 4 ++-- .../developers/studio-designer-developer-workflow.qdoc | 9 +++++---- .../src/overviews/qtquick-animation-overview.qdoc | 2 +- .../overviews/qtquick-production-quality-animation.qdoc | 2 +- .../src/overviews/qtquick-prototyping.qdoc | 2 +- doc/qtdesignstudio/src/overviews/qtquick-uis.qdoc | 4 ++-- .../src/qtdesignstudio-developer-topics.qdoc | 2 +- doc/qtdesignstudio/src/qtdesignstudio-faq.qdoc | 16 ++++++++-------- doc/qtdesignstudio/src/qtdesignstudio-terms.qdoc | 2 +- .../qtdesignstudio-optimized-3d-scenes.qdoc | 4 ++-- doc/qtdesignstudio/src/views/qtquick-navigator.qdoc | 4 ++-- doc/qtdesignstudio/src/views/qtquick-properties.qdoc | 2 +- doc/qtdesignstudio/src/views/studio-workspaces.qdoc | 6 +++--- 15 files changed, 32 insertions(+), 31 deletions(-) diff --git a/doc/qtdesignstudio/src/components/qtquick-data-models.qdoc b/doc/qtdesignstudio/src/components/qtquick-data-models.qdoc index 98b6343924..8b2f287eb2 100644 --- a/doc/qtdesignstudio/src/components/qtquick-data-models.qdoc +++ b/doc/qtdesignstudio/src/components/qtquick-data-models.qdoc @@ -161,7 +161,7 @@ When you add a \l{GridView}{Grid View}, \l{ListView}{List View}, or \l{PathView}{Path View}, the ListModel and the delegate component that creates an instance for each item in the model are added automatically. - For grid and list views, you can edit the list model in \QC. + For grid and list views, you can edit the list model in \QDS. \image qtquick-designer-listview-preview.png "Preview of a list view" diff --git a/doc/qtdesignstudio/src/components/qtquick-images.qdoc b/doc/qtdesignstudio/src/components/qtquick-images.qdoc index 1710566467..b590308247 100644 --- a/doc/qtdesignstudio/src/components/qtquick-images.qdoc +++ b/doc/qtdesignstudio/src/components/qtquick-images.qdoc @@ -50,7 +50,7 @@ \image qtquick-designer-image-type.png "Image component in different views" When you drag-and-drop an image file from \uicontrol Assets to \l Navigator - or the \l {2D} view, \QC automatically + or the \l {2D} view, \QDS automatically creates an instance of the Image component for you with the path to the image file set as the value of the \uicontrol Source field in \uicontrol Properties. diff --git a/doc/qtdesignstudio/src/components/qtquick-positioning.qdoc b/doc/qtdesignstudio/src/components/qtquick-positioning.qdoc index 21b3d663ae..35e6d48624 100644 --- a/doc/qtdesignstudio/src/components/qtquick-positioning.qdoc +++ b/doc/qtdesignstudio/src/components/qtquick-positioning.qdoc @@ -95,7 +95,7 @@ For more information on the JavaScript environment provided, see \l{Integrating QML and JavaScript}. - Bindings are a black box for \QC and using them might have a + Bindings are a black box for \QDS and using them might have a negative impact on performance, so consider setting anchors and margins for components, instead. For example, instead of setting \c {parent.width} for a component, you could anchor the component to its sibling components on the @@ -364,7 +364,7 @@ to right and top to bottom. Each component is positioned at the top-left corner of its cell with position (0, 0). - \QC generates the grid based on the positions of the child components in + \QDS generates the grid based on the positions of the child components in the \l {2D} view. You can modify the number of rows and columns in the \uicontrol Rows and \uicontrol Columns fields. diff --git a/doc/qtdesignstudio/src/developers/studio-designer-developer-workflow.qdoc b/doc/qtdesignstudio/src/developers/studio-designer-developer-workflow.qdoc index 629642abd7..aa4fb83d01 100644 --- a/doc/qtdesignstudio/src/developers/studio-designer-developer-workflow.qdoc +++ b/doc/qtdesignstudio/src/developers/studio-designer-developer-workflow.qdoc @@ -49,7 +49,7 @@ 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 + \QDS continues to use the \e .qmlproject file format, while Qt Creator 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. @@ -68,9 +68,10 @@ \section1 Converting Project Structure for CMake - \QDS can generate \e CMakeLists.txt and other related files to use with \QC and to compile into - an executable application but only if the project has a certain folder structure. If you have a - \QDS QML project that doesn't have the CMake configuration, follow these steps to convert it's + \QDS can generate \e CMakeLists.txt and other related files to use with + Qt Creator and to compile into an executable application but only if the + project has a certain folder structure. If you have a \QDS QML project that + doesn't have the CMake configuration, follow these steps to convert it's file structure to correct format. \list 1 diff --git a/doc/qtdesignstudio/src/overviews/qtquick-animation-overview.qdoc b/doc/qtdesignstudio/src/overviews/qtquick-animation-overview.qdoc index 8816a05a52..d78d6cf2fa 100644 --- a/doc/qtdesignstudio/src/overviews/qtquick-animation-overview.qdoc +++ b/doc/qtdesignstudio/src/overviews/qtquick-animation-overview.qdoc @@ -68,7 +68,7 @@ \section2 Timeline and Keyframe Based Animation - Timeline animation is based on \e keyframes. In \QC, keyframes determine the + Timeline animation is based on \e keyframes. In \QDS, keyframes determine the value of the property of a \l{glossary_component}{component} at a certain time. Animating properties enables their values to move through intermediate values instead of immediately changing to the target value. diff --git a/doc/qtdesignstudio/src/overviews/qtquick-production-quality-animation.qdoc b/doc/qtdesignstudio/src/overviews/qtquick-production-quality-animation.qdoc index bfdf435cf6..07b9bc7eb8 100644 --- a/doc/qtdesignstudio/src/overviews/qtquick-production-quality-animation.qdoc +++ b/doc/qtdesignstudio/src/overviews/qtquick-production-quality-animation.qdoc @@ -70,7 +70,7 @@ \section1 Profiling UI Code You can use \l{Profiling QML Applications}{QML Profiler} that is integrated - into \QC to find causes for typical performance problems in your UI. For + into \QDS to find causes for typical performance problems in your UI. For example, your UI might be slow, unresponsive, or stuttering. Typically, such problems are caused by executing too much JavaScript in too few frames. All JavaScript must return before the GUI thread can proceed, and frames are diff --git a/doc/qtdesignstudio/src/overviews/qtquick-prototyping.qdoc b/doc/qtdesignstudio/src/overviews/qtquick-prototyping.qdoc index 1e9c784000..468f24048b 100644 --- a/doc/qtdesignstudio/src/overviews/qtquick-prototyping.qdoc +++ b/doc/qtdesignstudio/src/overviews/qtquick-prototyping.qdoc @@ -95,7 +95,7 @@ \li \l {Importing 3D Assets} - You can import exported assets into \QC. For a list of formats + You can import exported assets into \QDS. For a list of formats supported by each \l{Qt Quick 3D} version, see the module documentation. diff --git a/doc/qtdesignstudio/src/overviews/qtquick-uis.qdoc b/doc/qtdesignstudio/src/overviews/qtquick-uis.qdoc index 44316cc260..abbdbed09e 100644 --- a/doc/qtdesignstudio/src/overviews/qtquick-uis.qdoc +++ b/doc/qtdesignstudio/src/overviews/qtquick-uis.qdoc @@ -42,14 +42,14 @@ components, and states, you need. Create a descriptive wireframe and acquire a detailed UI specification before you start to make the process of creating the UI more efficient. - \QC enables you to turn your UI concept into a wireframe with + \QDS enables you to turn your UI concept into a wireframe with a scalable layout where all your screens and controls are in place. You can present your wireframe to developers and other stakeholders for discussion, review, and approval before continuing into the prototyping phase. \endtable - In \QC, you build UIs around the behavior of \l{glossary-component} + In \QDS, you build UIs around the behavior of \l{glossary-component} {components} and how they connect with one another. You can use preset components available in the \l Components view or combine them to create your own components. You can specify values for the \e properties of a diff --git a/doc/qtdesignstudio/src/qtdesignstudio-developer-topics.qdoc b/doc/qtdesignstudio/src/qtdesignstudio-developer-topics.qdoc index e01fdd5523..03246e8dae 100644 --- a/doc/qtdesignstudio/src/qtdesignstudio-developer-topics.qdoc +++ b/doc/qtdesignstudio/src/qtdesignstudio-developer-topics.qdoc @@ -48,7 +48,7 @@ \li \l{Converting UI Projects to Applications} \QDS projects are useful for creating UIs. To use them for - application development in \QC, you have to convert + application development in Qt Creator, you have to convert them to Qt Quick Application projects that contain .pro, .cpp, and .qrc files. \li \l{Using External Tools} diff --git a/doc/qtdesignstudio/src/qtdesignstudio-faq.qdoc b/doc/qtdesignstudio/src/qtdesignstudio-faq.qdoc index 751bff64ab..00b090667b 100644 --- a/doc/qtdesignstudio/src/qtdesignstudio-faq.qdoc +++ b/doc/qtdesignstudio/src/qtdesignstudio-faq.qdoc @@ -41,7 +41,7 @@ \li \l {FAQ - Assets}{Assets} \li \l {FAQ - Components}{Components} \li \l {FAQ - Views}{Views} - \li \l {FAQ - Integration Between \QDS and \QC}{Integration Between \QDS and \QC} + \li \l {FAQ - Integration Between \QDS and Qt Creator}{Integration Between \QDS and Qt Creator} \li \l {FAQ - Performance}{Performance} \li \l {FAQ - Data Simulation}{Data Simulation} \endlist @@ -89,7 +89,7 @@ \section1 FAQ - Components - \section2 Can custom components be used? + \section2 Can I use custom components? Yes, you can create custom components and controls by using wizard templates or move component instances into separate files to turn them into new @@ -103,7 +103,7 @@ For more information, see \l {Importing 3D Assets}. - \section2 How to integrate custom C++ components into QDS? + \section2 How can I integrate custom C++ components into QDS? You must create your own QML module that contains the components and provides additional information about your components. For more information, @@ -121,21 +121,21 @@ For more information, see the \l {3D} view. - \section1 FAQ - Integration Between \QDS and \QC + \section1 FAQ - Integration Between \QDS and Qt Creator - \section2 Is there a way to automatically propagate name changes between \QDS and \QC? + \section2 Can I automatically propagate name changes between \QDS and Qt Creator? Unfortunately we do not automate renaming files between tools at the moment. If you decide to change the name of a property, alias, or signal in \QDS, - you need to manually change the name in \QC to maintain the connection. + you need to manually change the name in Qt Creator to maintain the connection. However, you can rename symbols in all files within a project. To rename a QML type in a project, select \uicontrol Tools > \uicontrol QML/JS > \uicontrol {Rename Symbol Under Cursor} or press \key Ctrl+Shift+R. For more information, see \l {Renaming Symbols}. - \section2 When turning your \QDS project into application in \QC, what is the best way to add .qml files? + \section2 How can I add .qml files to my project in Qt Creator? - Use the project wizard templates to create an application in \QC and copy + Use the project wizard templates to create an application in \QDS and copy your .qml files to the project folder. Then make some changes to the project configuration and source files, as instructed in \l {Converting UI Projects to Applications}. diff --git a/doc/qtdesignstudio/src/qtdesignstudio-terms.qdoc b/doc/qtdesignstudio/src/qtdesignstudio-terms.qdoc index 1f86ab5951..a501611d8c 100644 --- a/doc/qtdesignstudio/src/qtdesignstudio-terms.qdoc +++ b/doc/qtdesignstudio/src/qtdesignstudio-terms.qdoc @@ -316,7 +316,7 @@ deploys it to the \l{glossary-device}{device} specified in the selected \l{glossary-buildandrun-kit}{kit}, and runs it there. However, if you have not made any changes to the project since you last deployed - it, \QC simply runs it again. + it, \QDS simply runs it again. \endomit */ diff --git a/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-optimized-3d-scenes.qdoc b/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-optimized-3d-scenes.qdoc index d51feb8a38..8f1d1367e8 100644 --- a/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-optimized-3d-scenes.qdoc +++ b/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-optimized-3d-scenes.qdoc @@ -34,7 +34,7 @@ \title Creating Optimized 3D Scenes - In \QC, you can use various means to create a 3D scene. Your choice of + In \QDS, you can use various means to create a 3D scene. Your choice of strategy should always depend on the target platform of your scene. The way the content of your scene is authored can have dramatic effects on the runtime performance of your UI. The Optimal 3D Scene described @@ -110,7 +110,7 @@ The scene graph is the hierarchy of nodes that describe the scene to be rendered. - In \QC, the scene graph is represented by the tree-like view in + In \QDS, the scene graph is represented by the tree-like view in \uicontrol Navigator. You can also view the hierarchy of nodes in the \l {Code} view. By minimizing the size of the scene graph, you can minimize the effort needed when running the scene. In terms of diff --git a/doc/qtdesignstudio/src/views/qtquick-navigator.qdoc b/doc/qtdesignstudio/src/views/qtquick-navigator.qdoc index 4b0845be5c..c2e40b729a 100644 --- a/doc/qtdesignstudio/src/views/qtquick-navigator.qdoc +++ b/doc/qtdesignstudio/src/views/qtquick-navigator.qdoc @@ -129,7 +129,7 @@ \section1 Locking Components When designing complex applications, it is easy to accidentally modify - the properties of a component in one of the \QC views in ways that lead to + the properties of a component in one of the \QDS views in ways that lead to surprising results. For example, the \uicontrol {2D} view can become crowded and other components can get in the way when you are trying to select or transform a particular component, so that you end up transforming @@ -137,7 +137,7 @@ To lock components that you are not currently editing and their children, click \inlineimage icons/lockon.png - in \uicontrol Navigator. Locked components cannot be handled in any \QC + in \uicontrol Navigator. Locked components cannot be handled in any \QDS views. You can unlock the components when you want to edit them again. \image qtquick-designer-navigator-lock.gif "Locking components in Navigator" diff --git a/doc/qtdesignstudio/src/views/qtquick-properties.qdoc b/doc/qtdesignstudio/src/views/qtquick-properties.qdoc index c7599ffa7d..a80201ea3a 100644 --- a/doc/qtdesignstudio/src/views/qtquick-properties.qdoc +++ b/doc/qtdesignstudio/src/views/qtquick-properties.qdoc @@ -51,7 +51,7 @@ another preset component in the field. If you have specified values for properties that are not supported by the - new component type, \QC offers to remove them for you. If you'd rather do + new component type, \QDS offers to remove them for you. If you'd rather do this yourself, you can select the \inlineimage icons/action-icon.png (\uicontrol Actions) menu next to the property name, and then select \uicontrol Reset to remove the property values before trying again. diff --git a/doc/qtdesignstudio/src/views/studio-workspaces.qdoc b/doc/qtdesignstudio/src/views/studio-workspaces.qdoc index 444aca6b81..420b4b601a 100644 --- a/doc/qtdesignstudio/src/views/studio-workspaces.qdoc +++ b/doc/qtdesignstudio/src/views/studio-workspaces.qdoc @@ -30,7 +30,7 @@ \title Managing Workspaces - In the \uicontrol Design mode, you can arrange a set of \QC + In the \uicontrol Design mode, you can arrange a set of \QDS views as a \e workspace on the screen. To detach views: @@ -56,10 +56,10 @@ \section1 Saving Workspaces - The changes you make to a workspace are saved when you exit \QC. + The changes you make to a workspace are saved when you exit \QDS. Select \uicontrol View > \uicontrol Workspaces > \uicontrol Manage > \uicontrol {Restore last workspace on startup} - to restore the current workspace the next time you start \QC. + to restore the current workspace the next time you start \QDS. \image qtcreator-workspace-manager.png "Workspace Manager" -- cgit v1.2.3 From 4adb4911e6e5f22bb4d3de09e24410205aaf8e2a Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Mon, 12 Sep 2022 19:57:31 +0200 Subject: qds: fix crash when the view is gone found at: https://sentry.io/organizations/the-qt-company-00/issues/3571989716 Change-Id: I61faa33716b1f6f3e0cc04cd4871cba354ecec28 Reviewed-by: Tim Jenssen --- src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp b/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp index 4c2bd68c98..6dc40a183d 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/gradientmodel.cpp @@ -468,7 +468,7 @@ QmlDesigner::AbstractView *GradientModel::view() const void GradientModel::resetPuppet() { - QTimer::singleShot(1000, [this]() { view()->resetPuppet(); }); + QTimer::singleShot(1000, view(), &QmlDesigner::AbstractView::resetPuppet); } QmlDesigner::ModelNode GradientModel::createGradientNode() -- cgit v1.2.3 From 76d55de400ca753793db00ac9089122c20b83ee6 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 28 Sep 2022 13:07:17 +0200 Subject: QmlDesigner: Fix crash Do not call validId in updateContext. Calling validId does mutate the model and will set an id if none exists. Since updateContext is called on selection change the user does not expect the model to mutate and when switching/creating documents this could even lead to a crash. Instead, we give the created MosueArea always an id and disable the menu in case there is no id. Task-number: QDS-7806 Change-Id: I3d5d1ce41025d94db3cfff48f483366e56b58a32 Reviewed-by: Mahmoud Badri Reviewed-by: Thomas Hartmann --- .../components/componentcore/designeractionmanager.cpp | 12 +++++++++++- .../components/componentcore/modelnodeoperations.cpp | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp b/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp index 71451396be..0edb548770 100644 --- a/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp +++ b/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp @@ -595,6 +595,8 @@ public: { menu()->clear(); + menu()->setEnabled(true); + const auto selection = selectionContext(); if (!selection.isValid()) return; @@ -604,11 +606,19 @@ public: return; ModelNode currentNode = selection.currentSingleSelectedNode(); + + if (!currentNode.isValid()) + return; + QmlObjectNode currentObjectNode(currentNode); QStringList signalsList = getSignalsList(currentNode); QList slotsList = getSlotsLists(currentNode); - currentNode.validId(); + + if (!currentNode.hasId()) { + menu()->setEnabled(false); + return; + } for (const ModelNode &connectionNode : currentObjectNode.getAllConnections()) { for (const AbstractProperty &property : connectionNode.properties()) { diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp index 331922ca22..0d5a10fb10 100644 --- a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp +++ b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp @@ -1638,6 +1638,7 @@ void addMouseAreaFill(const SelectionContext &selectionContext) QmlDesigner::ModelNode mouseAreaNode = selectionContext.view()->createModelNode("QtQuick.MouseArea", itemMetaInfo.majorVersion(), itemMetaInfo.minorVersion()); + mouseAreaNode.validId(); modelNode.defaultNodeListProperty().reparentHere(mouseAreaNode); QmlItemNode mouseAreaItemNode(mouseAreaNode); -- cgit v1.2.3 From e8ebd8e49742f71190ed34e4bea2817e1f4bad2c Mon Sep 17 00:00:00 2001 From: Mahmoud Badri Date: Wed, 28 Sep 2022 14:53:50 +0300 Subject: QmlDesigner: Fix material drag glitch on Mac Fixes: QDS-7461 Change-Id: I5b29742e7f27cbf14e689fd4b440480ebb1e6792 Reviewed-by: Miikka Heikkinen --- .../qmldesigner/components/materialbrowser/materialbrowserwidget.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp index 1bdfbdd58e..9b91254f0f 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp @@ -141,6 +141,9 @@ bool MaterialBrowserWidget::eventFilter(QObject *obj, QEvent *event) m_bundleMaterialToDrag = {}; } } + } else if (event->type() == QMouseEvent::MouseButtonRelease) { + m_materialToDrag = {}; + m_bundleMaterialToDrag = {}; } return QObject::eventFilter(obj, event); -- cgit v1.2.3 From 0f49728c329a4bbf575a36b0b18e169dc4c82ac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Mon, 19 Sep 2022 15:34:52 +0300 Subject: Fix backward compatibility issue with QmlProfiler Previous implementation uses MaxMessage and MaxRangeType constants to specify events with undefined message or range type. This causes backwards compatibility issue if new message or range types are added, because those constants are also written to files when saving profiler traces. Add UndefinedMessage and UndefinedRangeType constants and use those instead of the MaxMessage and MaxRangeType constants. This doesn't fix opening old traces, but the same problem won't happend again with new traces. Also update profiler autotests with fixed data. Task-number: QTCREATORBUG-28146 Change-Id: Ief003d39f871dd1ff2cc908e6a4d4b4678fd0868 Reviewed-by: Ulf Hermann Reviewed-by: --- src/plugins/qmlprofiler/debugmessagesmodel.cpp | 2 +- src/plugins/qmlprofiler/inputeventsmodel.cpp | 2 +- src/plugins/qmlprofiler/memoryusagemodel.cpp | 4 +-- src/plugins/qmlprofiler/pixmapcachemodel.cpp | 2 +- src/plugins/qmlprofiler/qmleventtype.h | 2 +- .../qmlprofiler/qmlprofileranimationsmodel.cpp | 2 +- src/plugins/qmlprofiler/qmlprofilereventtypes.h | 6 +++-- .../qmlprofiler/qmlprofilermodelmanager.cpp | 4 +-- src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp | 2 +- src/plugins/qmlprofiler/qmlprofilertraceclient.cpp | 4 +-- src/plugins/qmlprofiler/qmlprofilertracefile.cpp | 14 +++++------ src/plugins/qmlprofiler/qmltypedevent.cpp | 28 ++++++++++----------- src/plugins/qmlprofiler/quick3dmodel.cpp | 2 +- .../qmlprofiler/scenegraphtimelinemodel.cpp | 2 +- src/plugins/qmlprofiler/tests/check.dat | Bin 56639 -> 36752 bytes .../qmlprofiler/tests/debugmessagesmodel_test.cpp | 2 +- .../qmlprofiler/tests/flamegraphmodel_test.cpp | 2 +- .../qmlprofiler/tests/inputeventsmodel_test.cpp | 4 +-- .../qmlprofiler/tests/memoryusagemodel_test.cpp | 8 +++--- .../qmlprofiler/tests/pixmapcachemodel_test.cpp | 4 +-- .../qmlprofiler/tests/qmleventtype_test.cpp | 14 +++++------ .../tests/qmlprofileranimationsmodel_test.cpp | 2 +- .../qmlprofilerbindingloopsrenderpass_test.cpp | 2 +- .../tests/qmlprofilertraceclient_test.cpp | 4 +-- 24 files changed, 60 insertions(+), 58 deletions(-) diff --git a/src/plugins/qmlprofiler/debugmessagesmodel.cpp b/src/plugins/qmlprofiler/debugmessagesmodel.cpp index 1509c95c9d..751a52e011 100644 --- a/src/plugins/qmlprofiler/debugmessagesmodel.cpp +++ b/src/plugins/qmlprofiler/debugmessagesmodel.cpp @@ -32,7 +32,7 @@ namespace Internal { DebugMessagesModel::DebugMessagesModel(QmlProfilerModelManager *manager, Timeline::TimelineModelAggregator *parent) : - QmlProfilerTimelineModel(manager, DebugMessage, MaximumRangeType, ProfileDebugMessages, parent), + QmlProfilerTimelineModel(manager, DebugMessage, UndefinedRangeType, ProfileDebugMessages, parent), m_maximumMsgType(-1) { } diff --git a/src/plugins/qmlprofiler/inputeventsmodel.cpp b/src/plugins/qmlprofiler/inputeventsmodel.cpp index 5e2b7cb765..088a9acdcb 100644 --- a/src/plugins/qmlprofiler/inputeventsmodel.cpp +++ b/src/plugins/qmlprofiler/inputeventsmodel.cpp @@ -38,7 +38,7 @@ namespace Internal { InputEventsModel::InputEventsModel(QmlProfilerModelManager *manager, Timeline::TimelineModelAggregator *parent) : - QmlProfilerTimelineModel(manager, Event, MaximumRangeType, ProfileInputEvents, parent), + QmlProfilerTimelineModel(manager, Event, UndefinedRangeType, ProfileInputEvents, parent), m_keyTypeId(-1), m_mouseTypeId(-1) { } diff --git a/src/plugins/qmlprofiler/memoryusagemodel.cpp b/src/plugins/qmlprofiler/memoryusagemodel.cpp index 86620ed6d0..dc239951dd 100644 --- a/src/plugins/qmlprofiler/memoryusagemodel.cpp +++ b/src/plugins/qmlprofiler/memoryusagemodel.cpp @@ -34,7 +34,7 @@ namespace Internal { MemoryUsageModel::MemoryUsageModel(QmlProfilerModelManager *manager, Timeline::TimelineModelAggregator *parent) : - QmlProfilerTimelineModel(manager, MemoryAllocation, MaximumRangeType, ProfileMemory, parent) + QmlProfilerTimelineModel(manager, MemoryAllocation, UndefinedRangeType, ProfileMemory, parent) { // Register additional features. The base class already registers the main feature. // Don't register initializer, finalizer, or clearer as the base class has done so already. @@ -142,7 +142,7 @@ QVariantMap MemoryUsageModel::details(int index) const void MemoryUsageModel::loadEvent(const QmlEvent &event, const QmlEventType &type) { if (type.message() != MemoryAllocation) { - if (type.rangeType() != MaximumRangeType) { + if (type.rangeType() != UndefinedRangeType) { m_continuation = ContinueNothing; if (event.rangeStage() == RangeStart) m_rangeStack.push(RangeStackFrame(event.typeIndex(), event.timestamp())); diff --git a/src/plugins/qmlprofiler/pixmapcachemodel.cpp b/src/plugins/qmlprofiler/pixmapcachemodel.cpp index 5006ef31df..0bf214b946 100644 --- a/src/plugins/qmlprofiler/pixmapcachemodel.cpp +++ b/src/plugins/qmlprofiler/pixmapcachemodel.cpp @@ -34,7 +34,7 @@ namespace Internal { PixmapCacheModel::PixmapCacheModel(QmlProfilerModelManager *manager, Timeline::TimelineModelAggregator *parent) : - QmlProfilerTimelineModel(manager, PixmapCacheEvent, MaximumRangeType, ProfilePixmapCache, + QmlProfilerTimelineModel(manager, PixmapCacheEvent, UndefinedRangeType, ProfilePixmapCache, parent) { } diff --git a/src/plugins/qmlprofiler/qmleventtype.h b/src/plugins/qmlprofiler/qmleventtype.h index 9eb9954075..49f9012c17 100644 --- a/src/plugins/qmlprofiler/qmleventtype.h +++ b/src/plugins/qmlprofiler/qmleventtype.h @@ -39,7 +39,7 @@ class QmlEventType : public Timeline::TraceEventType { public: static const qint32 staticClassId = 0x716d6c74; // 'qmlt'; - QmlEventType(Message message = MaximumMessage, RangeType rangeType = MaximumRangeType, + QmlEventType(Message message = UndefinedMessage, RangeType rangeType = UndefinedRangeType, int detailType = -1, const QmlEventLocation &location = QmlEventLocation(), const QString &data = QString(), const QString &displayName = QString()); diff --git a/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp b/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp index bec3496a15..32d40e0a10 100644 --- a/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofileranimationsmodel.cpp @@ -42,7 +42,7 @@ namespace Internal { QmlProfilerAnimationsModel::QmlProfilerAnimationsModel(QmlProfilerModelManager *manager, Timeline::TimelineModelAggregator *parent) : - QmlProfilerTimelineModel(manager, Event, MaximumRangeType, ProfileAnimations, parent) + QmlProfilerTimelineModel(manager, Event, UndefinedRangeType, ProfileAnimations, parent) { m_minNextStartTimes[0] = m_minNextStartTimes[1] = 0; } diff --git a/src/plugins/qmlprofiler/qmlprofilereventtypes.h b/src/plugins/qmlprofiler/qmlprofilereventtypes.h index 0c4d92c07a..b8bc25e5e9 100644 --- a/src/plugins/qmlprofiler/qmlprofilereventtypes.h +++ b/src/plugins/qmlprofiler/qmlprofilereventtypes.h @@ -30,7 +30,8 @@ namespace QmlProfiler { enum Message { - Event, + UndefinedMessage = 0xff, + Event = 0, RangeStart, RangeData, RangeLocation, @@ -72,7 +73,8 @@ enum Quick3DEventType { }; enum RangeType { - Painting, // old Qt4 paint events + UndefinedRangeType = 0xff, + Painting = 0, // old Qt4 paint events Compiling, Creating, Binding, diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp index a17de09d2d..72e207847f 100644 --- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp @@ -393,7 +393,7 @@ QmlProfilerModelManager::rangeFilter(qint64 rangeStart, qint64 rangeEnd) const // Double-check if rangeStart has been crossed. Some versions of Qt send dirty data. qint64 adjustedTimestamp = event.timestamp(); if (event.timestamp() < rangeStart && !crossedRangeStart) { - if (type.rangeType() != MaximumRangeType) { + if (type.rangeType() != UndefinedRangeType) { if (event.rangeStage() == RangeStart) stack.push(event); else if (event.rangeStage() == RangeEnd && !stack.isEmpty()) @@ -414,7 +414,7 @@ QmlProfilerModelManager::rangeFilter(qint64 rangeStart, qint64 rangeEnd) const crossedRangeStart = true; } if (event.timestamp() > rangeEnd) { - if (type.rangeType() != MaximumRangeType) { + if (type.rangeType() != UndefinedRangeType) { if (event.rangeStage() == RangeEnd) { if (stack.isEmpty()) { QmlEvent endEvent(event); diff --git a/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp b/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp index 50c461ef1c..f0ac6aab92 100644 --- a/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerrangemodel.cpp @@ -44,7 +44,7 @@ namespace Internal { QmlProfilerRangeModel::QmlProfilerRangeModel(QmlProfilerModelManager *manager, RangeType range, Timeline::TimelineModelAggregator *parent) : - QmlProfilerTimelineModel(manager, MaximumMessage, range, featureFromRangeType(range), parent) + QmlProfilerTimelineModel(manager, UndefinedMessage, range, featureFromRangeType(range), parent) { m_expandedRowTypes << -1; } diff --git a/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp b/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp index 8dcd41cbb4..a7e01208c0 100644 --- a/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp @@ -170,7 +170,7 @@ void QmlProfilerTraceClientPrivate::processCurrentEvent() // all ranges are perfectly nested. This is why we can defer the type resolution until either // the range ends or a child range starts. With only the information in RangeStart we wouldn't // be able to uniquely identify the event type. - Message rangeStage = currentEvent.type.rangeType() == MaximumRangeType ? + Message rangeStage = currentEvent.type.rangeType() == UndefinedRangeType ? currentEvent.type.message() : currentEvent.event.rangeStage(); switch (rangeStage) { case RangeStart: @@ -333,7 +333,7 @@ void QmlProfilerTraceClient::setRequestedFeatures(quint64 features) d->currentEvent.event.setTimestamp(context.timestamp > 0 ? context.timestamp : 0); d->currentEvent.event.setTypeIndex(-1); d->currentEvent.event.setString(text); - d->currentEvent.type = QmlEventType(DebugMessage, MaximumRangeType, type, + d->currentEvent.type = QmlEventType(DebugMessage, UndefinedRangeType, type, QmlEventLocation(context.file, context.line, 1)); d->currentEvent.serverTypeId = 0; d->processCurrentEvent(); diff --git a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp index 7d5ecfaa25..d9fe42d7ef 100644 --- a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp @@ -80,7 +80,7 @@ Q_STATIC_ASSERT(sizeof(MESSAGE_STRINGS) == MaximumMessage * sizeof(const char *) static QPair qmlTypeAsEnum(const QString &typeString) { - QPair ret(MaximumMessage, MaximumRangeType); + QPair ret(UndefinedMessage, UndefinedRangeType); for (int i = 0; i < MaximumMessage; ++i) { if (typeString == _(MESSAGE_STRINGS[i])) { @@ -96,7 +96,7 @@ static QPair qmlTypeAsEnum(const QString &typeString) } } - if (ret.first == MaximumMessage && ret.second == MaximumRangeType) { + if (ret.first == UndefinedMessage && ret.second == UndefinedRangeType) { bool isNumber = false; int type = typeString.toUInt(&isNumber); if (isNumber && type < MaximumRangeType) @@ -309,7 +309,7 @@ void QmlProfilerTraceFile::loadEventTypes(QXmlStreamReader &stream) int typeIndex = -1; - QPair messageAndRange(MaximumMessage, MaximumRangeType); + QPair messageAndRange(UndefinedMessage, UndefinedRangeType); int detailType = -1; QString displayName; QString data; @@ -317,7 +317,7 @@ void QmlProfilerTraceFile::loadEventTypes(QXmlStreamReader &stream) int line = 0, column = 0; auto clearType = [&](){ - messageAndRange = QPair(MaximumMessage, MaximumRangeType); + messageAndRange = QPair(UndefinedMessage, UndefinedRangeType); detailType = -1; displayName.clear(); data.clear(); @@ -389,7 +389,7 @@ void QmlProfilerTraceFile::loadEventTypes(QXmlStreamReader &stream) // confusing), even though they clearly aren't ranges. Convert that to something // sane here. if (detailType == 4) { - messageAndRange = QPair(Event, MaximumRangeType); + messageAndRange = QPair(Event, UndefinedRangeType); detailType = AnimationFrame; } } @@ -695,13 +695,13 @@ void QmlProfilerTraceFile::saveQtd(QIODevice *device) QStack stack; qint64 lastProgressTimestamp = traceStart(); modelManager()->replayQmlEvents([&](const QmlEvent &event, const QmlEventType &type) { - if (type.rangeType() != MaximumRangeType && event.rangeStage() == RangeStart) { + if (type.rangeType() != UndefinedRangeType && event.rangeStage() == RangeStart) { stack.push(event); return; } stream.writeStartElement(_("range")); - if (type.rangeType() != MaximumRangeType && event.rangeStage() == RangeEnd) { + if (type.rangeType() != UndefinedRangeType && event.rangeStage() == RangeEnd) { QmlEvent start = stack.pop(); stream.writeAttribute(_("startTime"), QString::number(start.timestamp())); stream.writeAttribute(_("duration"), diff --git a/src/plugins/qmlprofiler/qmltypedevent.cpp b/src/plugins/qmlprofiler/qmltypedevent.cpp index dade47c6db..e79080d48e 100644 --- a/src/plugins/qmlprofiler/qmltypedevent.cpp +++ b/src/plugins/qmlprofiler/qmltypedevent.cpp @@ -36,10 +36,10 @@ QDataStream &operator>>(QDataStream &stream, QmlTypedEvent &event) stream >> time >> messageType; - if (messageType < 0 || messageType > MaximumMessage) - messageType = MaximumMessage; + if (messageType < 0 || messageType >= MaximumMessage) + messageType = UndefinedMessage; - RangeType rangeType = MaximumRangeType; + RangeType rangeType = UndefinedRangeType; if (!stream.atEnd()) { stream >> subtype; if (subtype >= 0 && subtype < MaximumRangeType) @@ -54,7 +54,7 @@ QDataStream &operator>>(QDataStream &stream, QmlTypedEvent &event) switch (messageType) { case Event: { - event.type = QmlEventType(static_cast(messageType), MaximumRangeType, subtype); + event.type = QmlEventType(static_cast(messageType), UndefinedRangeType, subtype); switch (subtype) { case StartTrace: case EndTrace: { @@ -98,7 +98,7 @@ QDataStream &operator>>(QDataStream &stream, QmlTypedEvent &event) break; } case Complete: { - event.type = QmlEventType(static_cast(messageType), MaximumRangeType, subtype); + event.type = QmlEventType(static_cast(messageType), UndefinedRangeType, subtype); break; } case SceneGraphFrame: { @@ -110,7 +110,7 @@ QDataStream &operator>>(QDataStream &stream, QmlTypedEvent &event) params.push_back(param); } - event.type = QmlEventType(static_cast(messageType), MaximumRangeType, subtype); + event.type = QmlEventType(static_cast(messageType), UndefinedRangeType, subtype); event.event.setNumbers, qint64>(params); break; } @@ -125,7 +125,7 @@ QDataStream &operator>>(QDataStream &stream, QmlTypedEvent &event) refcount = 1; } - event.type = QmlEventType(static_cast(messageType), MaximumRangeType, subtype, + event.type = QmlEventType(static_cast(messageType), UndefinedRangeType, subtype, QmlEventLocation(filename, 0, 0)); event.event.setNumbers({width, height, refcount}); break; @@ -134,7 +134,7 @@ QDataStream &operator>>(QDataStream &stream, QmlTypedEvent &event) qint64 delta; stream >> delta; - event.type = QmlEventType(static_cast(messageType), MaximumRangeType, subtype); + event.type = QmlEventType(static_cast(messageType), UndefinedRangeType, subtype); event.event.setNumbers({delta}); break; } @@ -147,7 +147,7 @@ QDataStream &operator>>(QDataStream &stream, QmlTypedEvent &event) // otherwise it's the old binding type of 4 bytes } - event.type = QmlEventType(MaximumMessage, rangeType, -1); + event.type = QmlEventType(UndefinedMessage, rangeType, -1); event.event.setRangeStage(RangeStart); break; } @@ -155,7 +155,7 @@ QDataStream &operator>>(QDataStream &stream, QmlTypedEvent &event) QString data; stream >> data; - event.type = QmlEventType(MaximumMessage, rangeType, -1, QmlEventLocation(), data); + event.type = QmlEventType(UndefinedMessage, rangeType, -1, QmlEventLocation(), data); event.event.setRangeStage(RangeData); if (!stream.atEnd()) stream >> event.serverTypeId; @@ -173,13 +173,13 @@ QDataStream &operator>>(QDataStream &stream, QmlTypedEvent &event) stream >> event.serverTypeId; } - event.type = QmlEventType(MaximumMessage, rangeType, -1, + event.type = QmlEventType(UndefinedMessage, rangeType, -1, QmlEventLocation(filename, line, column)); event.event.setRangeStage(RangeLocation); break; } case RangeEnd: { - event.type = QmlEventType(MaximumMessage, rangeType, -1); + event.type = QmlEventType(UndefinedMessage, rangeType, -1); event.event.setRangeStage(RangeEnd); break; } @@ -192,13 +192,13 @@ QDataStream &operator>>(QDataStream &stream, QmlTypedEvent &event) stream >> param; params.push_back(param); } - event.type = QmlEventType(static_cast(messageType), MaximumRangeType, subtype); + event.type = QmlEventType(static_cast(messageType), UndefinedRangeType, subtype); event.event.setNumbers, qint64>(params); break; } default: event.event.setNumbers({}); - event.type = QmlEventType(static_cast(messageType), MaximumRangeType, subtype); + event.type = QmlEventType(static_cast(messageType), UndefinedRangeType, subtype); break; } diff --git a/src/plugins/qmlprofiler/quick3dmodel.cpp b/src/plugins/qmlprofiler/quick3dmodel.cpp index ac8f42d533..be52181845 100644 --- a/src/plugins/qmlprofiler/quick3dmodel.cpp +++ b/src/plugins/qmlprofiler/quick3dmodel.cpp @@ -33,7 +33,7 @@ namespace Internal { Quick3DModel::Quick3DModel(QmlProfilerModelManager *manager, Timeline::TimelineModelAggregator *parent) : - QmlProfilerTimelineModel(manager, Quick3DEvent, MaximumRangeType, ProfileQuick3D, parent), + QmlProfilerTimelineModel(manager, Quick3DEvent, UndefinedRangeType, ProfileQuick3D, parent), m_maximumMsgType(-1) { } diff --git a/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp b/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp index 951cd3eb43..8d868d16f3 100644 --- a/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp +++ b/src/plugins/qmlprofiler/scenegraphtimelinemodel.cpp @@ -77,7 +77,7 @@ Q_STATIC_ASSERT(sizeof(StageLabels) == SceneGraphTimelineModel::SceneGraphTimelineModel(QmlProfilerModelManager *manager, Timeline::TimelineModelAggregator *parent) : - QmlProfilerTimelineModel(manager, SceneGraphFrame, MaximumRangeType, ProfileSceneGraph, parent) + QmlProfilerTimelineModel(manager, SceneGraphFrame, UndefinedRangeType, ProfileSceneGraph, parent) { } diff --git a/src/plugins/qmlprofiler/tests/check.dat b/src/plugins/qmlprofiler/tests/check.dat index 7431903a1e..3895dfc182 100644 Binary files a/src/plugins/qmlprofiler/tests/check.dat and b/src/plugins/qmlprofiler/tests/check.dat differ diff --git a/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp b/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp index 49812707cb..cc6e005f20 100644 --- a/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/debugmessagesmodel_test.cpp @@ -45,7 +45,7 @@ void DebugMessagesModelTest::initTestCase() QmlEvent event; event.setTimestamp(i); event.setString(QString::fromLatin1("message %1").arg(i)); - QmlEventType type(DebugMessage, MaximumRangeType, i % (QtMsgType::QtInfoMsg + 1), + QmlEventType type(DebugMessage, UndefinedRangeType, i % (QtMsgType::QtInfoMsg + 1), QmlEventLocation("somefile.js", i, 10 - i)); event.setTypeIndex(manager.numEventTypes()); manager.appendEventType(std::move(type)); diff --git a/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp b/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp index 7c580da97e..ec5d2b178f 100644 --- a/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/flamegraphmodel_test.cpp @@ -55,7 +55,7 @@ int FlameGraphModelTest::generateData(QmlProfilerModelManager *manager, QmlEvent event; if (i < 5) { typeIndex = manager->appendEventType( - QmlEventType(MaximumMessage, + QmlEventType(UndefinedMessage, static_cast(static_cast(Javascript) - i), -1, QmlEventLocation("somefile.js", i, 20 - i), QString("funcfunc"))); diff --git a/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp b/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp index 141708f063..941aca4110 100644 --- a/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/inputeventsmodel_test.cpp @@ -41,8 +41,8 @@ static InputEventType inputType(int i) InputEventsModelTest::InputEventsModelTest(QObject *parent) : QObject(parent), model(&manager, &aggregator) { - keyTypeId = manager.appendEventType(QmlEventType(Event, MaximumRangeType, Key)); - mouseTypeId = manager.appendEventType(QmlEventType(Event, MaximumRangeType, Mouse)); + keyTypeId = manager.appendEventType(QmlEventType(Event, UndefinedRangeType, Key)); + mouseTypeId = manager.appendEventType(QmlEventType(Event, UndefinedRangeType, Mouse)); } void InputEventsModelTest::initTestCase() diff --git a/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp b/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp index 804c6d8fb1..6e6eb9dce3 100644 --- a/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/memoryusagemodel_test.cpp @@ -41,11 +41,11 @@ void MemoryUsageModelTest::initTestCase() heapPageTypeId = manager.numEventTypes(); - manager.appendEventType(QmlEventType(MemoryAllocation, MaximumRangeType, HeapPage)); + manager.appendEventType(QmlEventType(MemoryAllocation, UndefinedRangeType, HeapPage)); smallItemTypeId = manager.numEventTypes(); - manager.appendEventType(QmlEventType(MemoryAllocation, MaximumRangeType, SmallItem)); + manager.appendEventType(QmlEventType(MemoryAllocation, UndefinedRangeType, SmallItem)); largeItemTypeId = manager.numEventTypes(); - manager.appendEventType(QmlEventType(MemoryAllocation, MaximumRangeType, LargeItem)); + manager.appendEventType(QmlEventType(MemoryAllocation, UndefinedRangeType, LargeItem)); auto addMemoryEvents = [&]() { QmlEvent event; @@ -74,7 +74,7 @@ void MemoryUsageModelTest::initTestCase() addMemoryEvents(); rangeTypeId = manager.numEventTypes(); - manager.appendEventType(QmlEventType(MaximumMessage, Javascript, -1, + manager.appendEventType(QmlEventType(UndefinedMessage, Javascript, -1, QmlEventLocation(QString("somefile.js"), 10, 20), QString("funcfunc"))); diff --git a/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp b/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp index 97b124e016..0aee302c81 100644 --- a/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/pixmapcachemodel_test.cpp @@ -43,7 +43,7 @@ void PixmapCacheModelTest::initTestCase() for (int i = 0; i < MaximumPixmapEventType; ++i) { eventTypeIndices[i] = manager.numEventTypes(); - manager.appendEventType(QmlEventType(PixmapCacheEvent, MaximumRangeType, i, + manager.appendEventType(QmlEventType(PixmapCacheEvent, UndefinedRangeType, i, QmlEventLocation("dings.png", 0, 0))); } @@ -58,7 +58,7 @@ void PixmapCacheModelTest::initTestCase() for (int i = 0; i < MaximumPixmapEventType; ++i) { eventTypeIndices[i + MaximumPixmapEventType] = manager.numEventTypes(); - manager.appendEventType(QmlEventType(PixmapCacheEvent, MaximumRangeType, i, + manager.appendEventType(QmlEventType(PixmapCacheEvent, UndefinedRangeType, i, QmlEventLocation("blah.png", 0, 0))); } diff --git a/src/plugins/qmlprofiler/tests/qmleventtype_test.cpp b/src/plugins/qmlprofiler/tests/qmleventtype_test.cpp index 30157c7c7f..a43a72581b 100644 --- a/src/plugins/qmlprofiler/tests/qmleventtype_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmleventtype_test.cpp @@ -37,8 +37,8 @@ QmlEventTypeTest::QmlEventTypeTest(QObject *parent) : QObject(parent) void QmlEventTypeTest::testAccessors() { QmlEventType type; - QCOMPARE(type.message(), MaximumMessage); - QCOMPARE(type.rangeType(), MaximumRangeType); + QCOMPARE(type.message(), UndefinedMessage); + QCOMPARE(type.rangeType(), UndefinedMessage); QCOMPARE(type.detailType(), -1); QVERIFY(!type.location().isValid()); QVERIFY(type.data().isEmpty()); @@ -56,9 +56,9 @@ void QmlEventTypeTest::testAccessors() type.setDisplayName("disdis"); QCOMPARE(type.displayName(), QString("disdis")); - QmlEventType type2(MaximumMessage, Javascript, 12, QmlEventLocation("lala.js", 2, 3), "nehhh", + QmlEventType type2(UndefinedMessage, Javascript, 12, QmlEventLocation("lala.js", 2, 3), "nehhh", "brbr"); - QCOMPARE(type2.message(), MaximumMessage); + QCOMPARE(type2.message(), UndefinedMessage); QCOMPARE(type2.rangeType(), Javascript); QCOMPARE(type2.detailType(), 12); QCOMPARE(type2.location(), QmlEventLocation("lala.js", 2, 3)); @@ -107,13 +107,13 @@ void QmlEventTypeTest::testFeature() for (int i = 0; i < MaximumMessage; ++i) { for (int j = 0; j < MaximumEventType; ++j) { - QmlEventType type(static_cast(i), MaximumRangeType, j); + QmlEventType type(static_cast(i), UndefinedRangeType, j); QCOMPARE(type.feature(), features[i][j]); } } for (int i = 0; i < MaximumRangeType; ++i) { - QmlEventType type(MaximumMessage, static_cast(i)); + QmlEventType type(UndefinedMessage, static_cast(i)); QCOMPARE(static_cast(type.feature()), featureFromRangeType(static_cast(i))); } @@ -121,7 +121,7 @@ void QmlEventTypeTest::testFeature() void QmlEventTypeTest::testStreamOps() { - QmlEventType type(MaximumMessage, Javascript, -1, QmlEventLocation("socken.js", 12, 13), + QmlEventType type(UndefinedMessage, Javascript, -1, QmlEventLocation("socken.js", 12, 13), "lalala", "lelele"); QBuffer wbuffer; diff --git a/src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp index 1f16ddb6d5..6a5773e408 100644 --- a/src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmlprofileranimationsmodel_test.cpp @@ -46,7 +46,7 @@ void QmlProfilerAnimationsModelTest::initTestCase() QmlEvent event; event.setTypeIndex(manager.appendEventType( - QmlEventType(Event, MaximumRangeType, AnimationFrame))); + QmlEventType(Event, UndefinedRangeType, AnimationFrame))); for (int i = 0; i < 10; ++i) { event.setTimestamp(i); diff --git a/src/plugins/qmlprofiler/tests/qmlprofilerbindingloopsrenderpass_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilerbindingloopsrenderpass_test.cpp index 642720f34b..c1dfa96386 100644 --- a/src/plugins/qmlprofiler/tests/qmlprofilerbindingloopsrenderpass_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmlprofilerbindingloopsrenderpass_test.cpp @@ -49,7 +49,7 @@ DummyModel::DummyModel(QmlProfilerModelManager *manager, void DummyModel::loadData() { - QmlEventType type(MaximumMessage, Binding); + QmlEventType type(UndefinedMessage, Binding); const int typeIndex = modelManager()->appendEventType(QmlEventType(type)); QCOMPARE(typeIndex, 0); diff --git a/src/plugins/qmlprofiler/tests/qmlprofilertraceclient_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilertraceclient_test.cpp index d986939f8c..055e5ef000 100644 --- a/src/plugins/qmlprofiler/tests/qmlprofilertraceclient_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmlprofilertraceclient_test.cpp @@ -77,8 +77,8 @@ void QmlProfilerTraceClientTest::testMessageReceived() modelManager.replayQmlEvents([&](const QmlEvent &event, const QmlEventType &type) { qint64 timestamp; - qint32 message; - qint32 rangeType; + quint8 message; + quint8 rangeType; checkStream >> timestamp >> message >> rangeType; QCOMPARE(event.timestamp(), timestamp); QCOMPARE(type.message(), static_cast(message)); -- cgit v1.2.3 From b16d1e2b1141e1c1500f4b01f9b8ac2777997fae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20M=C3=A4=C3=A4tt=C3=A4?= Date: Mon, 26 Sep 2022 09:02:16 +0300 Subject: Add more checks for backwards compatibility Stop using MaximumXXXType in events where they might be saved into trace files. It makes older traces incompatible with new traces if new fields are added since new versions treat them as valid events. Instead use UndefinedXXXType that doesn't change if new fields are added. Add checks for event types greater or equal to MaximumXXXType where they are missing so that older versions do not process new unrecognized events. Fix opening old traces by checking missmatch between quick3d event and the range type. Fixes: QTCREATORBUG-28146 Change-Id: I8950da2d636ef1fedf4500916896a9ecae222166 Reviewed-by: Ulf Hermann Reviewed-by: --- src/plugins/qmlprofiler/inputeventsmodel.cpp | 2 ++ src/plugins/qmlprofiler/inputeventsmodel.h | 2 +- src/plugins/qmlprofiler/qmleventtype.cpp | 11 ++++++-- src/plugins/qmlprofiler/qmlprofilereventtypes.h | 29 ++++++++++++++-------- src/plugins/qmlprofiler/qmlprofilertraceclient.cpp | 2 ++ src/plugins/qmlprofiler/qmltypedevent.cpp | 2 ++ src/plugins/qmlprofiler/quick3dmodel.cpp | 4 ++- .../qmlprofiler/tests/qmleventtype_test.cpp | 26 +++++++++---------- .../tests/qmlprofilertraceclient_test.cpp | 4 +++ 9 files changed, 55 insertions(+), 27 deletions(-) diff --git a/src/plugins/qmlprofiler/inputeventsmodel.cpp b/src/plugins/qmlprofiler/inputeventsmodel.cpp index 088a9acdcb..748aeab6e0 100644 --- a/src/plugins/qmlprofiler/inputeventsmodel.cpp +++ b/src/plugins/qmlprofiler/inputeventsmodel.cpp @@ -154,6 +154,8 @@ int InputEventsModel::collapsedRow(int index) const void InputEventsModel::loadEvent(const QmlEvent &event, const QmlEventType &type) { + if (type.detailType() >= MaximumInputEventType) + return; m_data.insert(insert(event.timestamp(), 0, type.detailType()), Item(static_cast(event.number(0)), event.number(1), event.number(2))); diff --git a/src/plugins/qmlprofiler/inputeventsmodel.h b/src/plugins/qmlprofiler/inputeventsmodel.h index dbd1515894..bdfcf1dc24 100644 --- a/src/plugins/qmlprofiler/inputeventsmodel.h +++ b/src/plugins/qmlprofiler/inputeventsmodel.h @@ -36,7 +36,7 @@ class InputEventsModel : public QmlProfilerTimelineModel public: struct Item { - Item(InputEventType type = MaximumInputEventType, int a = 0, int b = 0); + Item(InputEventType type = UndefinedInputEventType, int a = 0, int b = 0); InputEventType type; int a; int b; diff --git a/src/plugins/qmlprofiler/qmleventtype.cpp b/src/plugins/qmlprofiler/qmleventtype.cpp index 4963b68495..7557b81aa6 100644 --- a/src/plugins/qmlprofiler/qmleventtype.cpp +++ b/src/plugins/qmlprofiler/qmleventtype.cpp @@ -39,7 +39,7 @@ static ProfileFeature qmlFeatureFromType(Message message, RangeType rangeType, i case AnimationFrame: return ProfileAnimations; default: - return MaximumProfileFeature; + return UndefinedProfileFeature; } } case PixmapCacheEvent: @@ -51,7 +51,11 @@ static ProfileFeature qmlFeatureFromType(Message message, RangeType rangeType, i case DebugMessage: return ProfileDebugMessages; case Quick3DEvent: - return ProfileQuick3D; + // Check if it's actually Quick3DEvent since old traces used MaximumMessage + // (whose value is now Quick3DEvent value) as undefined value + if (rangeType == UndefinedRangeType) + return ProfileQuick3D; + return featureFromRangeType(rangeType); default: return featureFromRangeType(rangeType); } @@ -68,6 +72,9 @@ QDataStream &operator>>(QDataStream &stream, QmlEventType &type) type.m_message = static_cast(message); type.m_rangeType = static_cast(rangeType); type.setFeature(qmlFeatureFromType(type.m_message, type.m_rangeType, type.m_detailType)); + // Update message if qmlFeatureFromType determined it is not Quick3D event + if (type.m_message == Quick3DEvent && type.feature() != ProfileQuick3D) + type.m_message = UndefinedMessage; return stream; } diff --git a/src/plugins/qmlprofiler/qmlprofilereventtypes.h b/src/plugins/qmlprofiler/qmlprofilereventtypes.h index b8bc25e5e9..d5f7475028 100644 --- a/src/plugins/qmlprofiler/qmlprofilereventtypes.h +++ b/src/plugins/qmlprofiler/qmlprofilereventtypes.h @@ -47,7 +47,8 @@ enum Message { }; enum EventType { - FramePaint, // unused + UndefinedEventType = 0xff, + FramePaint = 0, // unused Mouse, Key, AnimationFrame, // new Qt5 paint events @@ -58,7 +59,8 @@ enum EventType { }; enum Quick3DEventType { - Quick3DRenderFrame, + UndefinedQuick3DEventType = 0xff, + Quick3DRenderFrame = 0, Quick3DSynchronizeFrame, Quick3DPrepareFrame, Quick3DMeshLoad, @@ -85,7 +87,8 @@ enum RangeType { }; enum BindingType { - QmlBinding, + UndefinedBindingType = 0xff, + QmlBinding = 0, V8Binding, OptimizedBinding, QPainterEvent, @@ -94,7 +97,8 @@ enum BindingType { }; enum PixmapEventType { - PixmapSizeKnown, + UndefinedPixmapEventType = 0xff, + PixmapSizeKnown = 0, PixmapReferenceCountChanged, PixmapCacheCountChanged, PixmapLoadingStarted, @@ -105,7 +109,8 @@ enum PixmapEventType { }; enum InputEventType { - InputKeyPress, + UndefinedInputEventType = 0xff, + InputKeyPress = 0, InputKeyRelease, InputKeyUnknown, @@ -120,7 +125,8 @@ enum InputEventType { }; enum SceneGraphFrameType { - SceneGraphRendererFrame, // Render Thread + UndefinedSceheGraphFrameType = 0xff, + SceneGraphRendererFrame = 0, // Render Thread SceneGraphAdaptationLayerFrame, // Render Thread SceneGraphContextFrame, // Render Thread SceneGraphRenderLoopFrame, // Render Thread @@ -135,7 +141,8 @@ enum SceneGraphFrameType { }; enum MemoryType { - HeapPage, + UndefinedMemoryType = 0xff, + HeapPage = 0, LargeItem, SmallItem, @@ -143,14 +150,16 @@ enum MemoryType { }; enum AnimationThread { - GuiThread, + UndefinedAnimationThread = 0xff, + GuiThread = 0, RenderThread, MaximumAnimationThread }; enum ProfileFeature { - ProfileJavaScript, + UndefinedProfileFeature = 0xff, + ProfileJavaScript = 0, ProfileMemory, ProfilePixmapCache, ProfileSceneGraph, @@ -183,7 +192,7 @@ inline ProfileFeature featureFromRangeType(RangeType range) case Javascript: return ProfileJavaScript; default: - return MaximumProfileFeature; + return UndefinedProfileFeature; } } diff --git a/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp b/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp index a7e01208c0..193b5c3414 100644 --- a/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertraceclient.cpp @@ -350,6 +350,8 @@ void QmlProfilerTraceClient::setFlushInterval(quint32 flushInterval) bool QmlProfilerTraceClientPrivate::updateFeatures(quint8 feature) { + if (feature == UndefinedProfileFeature) + return true; quint64 flag = 1ULL << feature; if (!(requestedFeatures & flag)) return false; diff --git a/src/plugins/qmlprofiler/qmltypedevent.cpp b/src/plugins/qmlprofiler/qmltypedevent.cpp index e79080d48e..105eb644ab 100644 --- a/src/plugins/qmlprofiler/qmltypedevent.cpp +++ b/src/plugins/qmlprofiler/qmltypedevent.cpp @@ -54,6 +54,8 @@ QDataStream &operator>>(QDataStream &stream, QmlTypedEvent &event) switch (messageType) { case Event: { + if (subtype >= MaximumEventType) + subtype = UndefinedEventType; event.type = QmlEventType(static_cast(messageType), UndefinedRangeType, subtype); switch (subtype) { case StartTrace: diff --git a/src/plugins/qmlprofiler/quick3dmodel.cpp b/src/plugins/qmlprofiler/quick3dmodel.cpp index be52181845..aa5efd426e 100644 --- a/src/plugins/qmlprofiler/quick3dmodel.cpp +++ b/src/plugins/qmlprofiler/quick3dmodel.cpp @@ -156,7 +156,9 @@ int Quick3DModel::collapsedRow(int index) const void Quick3DModel::loadEvent(const QmlEvent &event, const QmlEventType &type) { - auto detailType = type.detailType(); + int detailType = type.detailType(); + if (detailType >= MaximumQuick3DFrameType) + return; qint64 eventDuration = event.number(0); qint64 eventTime = event.timestamp() - eventDuration; QVector numbers = event.numbers>(); diff --git a/src/plugins/qmlprofiler/tests/qmleventtype_test.cpp b/src/plugins/qmlprofiler/tests/qmleventtype_test.cpp index a43a72581b..7e82ae17c8 100644 --- a/src/plugins/qmlprofiler/tests/qmleventtype_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmleventtype_test.cpp @@ -43,7 +43,7 @@ void QmlEventTypeTest::testAccessors() QVERIFY(!type.location().isValid()); QVERIFY(type.data().isEmpty()); QVERIFY(type.displayName().isEmpty()); - QCOMPARE(static_cast(type.feature()), MaximumProfileFeature); + QCOMPARE(static_cast(type.feature()), UndefinedProfileFeature); type.setLocation(QmlEventLocation("blah.js", 12, 13)); QCOMPARE(type.location().filename(), QString("blah.js")); @@ -71,23 +71,23 @@ void QmlEventTypeTest::testFeature() { const quint8 features[][MaximumEventType] = { // Event - {MaximumProfileFeature, ProfileInputEvents, ProfileInputEvents, - ProfileAnimations, MaximumProfileFeature, MaximumProfileFeature}, + {UndefinedProfileFeature, ProfileInputEvents, ProfileInputEvents, + ProfileAnimations, UndefinedProfileFeature, UndefinedProfileFeature}, // RangeStart - {MaximumProfileFeature, MaximumProfileFeature, MaximumProfileFeature, - MaximumProfileFeature, MaximumProfileFeature, MaximumProfileFeature}, + {UndefinedProfileFeature, UndefinedProfileFeature, UndefinedProfileFeature, + UndefinedProfileFeature, UndefinedProfileFeature, UndefinedProfileFeature}, // RangeData - {MaximumProfileFeature, MaximumProfileFeature, MaximumProfileFeature, - MaximumProfileFeature, MaximumProfileFeature, MaximumProfileFeature}, + {UndefinedProfileFeature, UndefinedProfileFeature, UndefinedProfileFeature, + UndefinedProfileFeature, UndefinedProfileFeature, UndefinedProfileFeature}, // RangeLocation - {MaximumProfileFeature, MaximumProfileFeature, MaximumProfileFeature, - MaximumProfileFeature, MaximumProfileFeature, MaximumProfileFeature}, + {UndefinedProfileFeature, UndefinedProfileFeature, UndefinedProfileFeature, + UndefinedProfileFeature, UndefinedProfileFeature, UndefinedProfileFeature}, // RangeEnd - {MaximumProfileFeature, MaximumProfileFeature, MaximumProfileFeature, - MaximumProfileFeature, MaximumProfileFeature, MaximumProfileFeature}, + {UndefinedProfileFeature, UndefinedProfileFeature, UndefinedProfileFeature, + UndefinedProfileFeature, UndefinedProfileFeature, UndefinedProfileFeature}, // Complete - {MaximumProfileFeature, MaximumProfileFeature, MaximumProfileFeature, - MaximumProfileFeature, MaximumProfileFeature, MaximumProfileFeature}, + {UndefinedProfileFeature, UndefinedProfileFeature, UndefinedProfileFeature, + UndefinedProfileFeature, UndefinedProfileFeature, UndefinedProfileFeature}, // PixmapCacheEvent {ProfilePixmapCache, ProfilePixmapCache, ProfilePixmapCache, ProfilePixmapCache, ProfilePixmapCache, ProfilePixmapCache}, diff --git a/src/plugins/qmlprofiler/tests/qmlprofilertraceclient_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilertraceclient_test.cpp index 055e5ef000..dbb55fac79 100644 --- a/src/plugins/qmlprofiler/tests/qmlprofilertraceclient_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmlprofilertraceclient_test.cpp @@ -80,6 +80,10 @@ void QmlProfilerTraceClientTest::testMessageReceived() quint8 message; quint8 rangeType; checkStream >> timestamp >> message >> rangeType; + QVERIFY(message != MaximumMessage); + QVERIFY(rangeType != MaximumRangeType); + QVERIFY(type.message() != MaximumMessage); + QVERIFY(type.rangeType() != MaximumRangeType); QCOMPARE(event.timestamp(), timestamp); QCOMPARE(type.message(), static_cast(message)); QCOMPARE(type.rangeType(), static_cast(rangeType)); -- cgit v1.2.3 From 3f6d8e8cd6aa3effc44025cca6e7b224cf213d9c Mon Sep 17 00:00:00 2001 From: Henning Gruendl Date: Thu, 29 Sep 2022 10:57:52 +0200 Subject: QmlDesigner: Fix base state update Task-number: QDS-7799 Change-Id: I89216cdb8fb641e6b51c22b32e6a845e7952c601 Reviewed-by: Reviewed-by: Qt CI Bot Reviewed-by: Thomas Hartmann --- src/plugins/qmldesigner/components/stateseditornew/stateseditormodel.cpp | 1 + src/plugins/qmldesigner/components/stateseditornew/stateseditorview.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/components/stateseditornew/stateseditormodel.cpp b/src/plugins/qmldesigner/components/stateseditornew/stateseditormodel.cpp index efe1c305f6..449a90f8ea 100644 --- a/src/plugins/qmldesigner/components/stateseditornew/stateseditormodel.cpp +++ b/src/plugins/qmldesigner/components/stateseditornew/stateseditormodel.cpp @@ -95,6 +95,7 @@ void StatesEditorModel::reset() QAbstractListModel::endResetModel(); evaluateExtend(); + emit baseStateChanged(); } QVariant StatesEditorModel::data(const QModelIndex &index, int role) const diff --git a/src/plugins/qmldesigner/components/stateseditornew/stateseditorview.h b/src/plugins/qmldesigner/components/stateseditornew/stateseditorview.h index 5fc9ae5511..4c55d927b7 100644 --- a/src/plugins/qmldesigner/components/stateseditornew/stateseditorview.h +++ b/src/plugins/qmldesigner/components/stateseditornew/stateseditorview.h @@ -122,7 +122,6 @@ public slots: void removeState(int nodeId); private: - StatesEditorWidget *statesEditorWidget() const; void resetModel(); void resetPropertyChangesModels(); void resetExtend(); -- cgit v1.2.3 From 502e94cbe9d964e624557ebd720918eb806159c8 Mon Sep 17 00:00:00 2001 From: Henning Gruendl Date: Tue, 27 Sep 2022 17:52:52 +0200 Subject: QmlDesigner: Improve state group rename dialog If the user presses enter when having focus on the TextField inside the StateGroup rename dialog it will submit the change and close the dialog. If the user presses escape it will reject the change and close the dialog. Task-number: QDS-7764 Change-Id: I8626c7b9ca9bf6d087c226343b3e6833641da54c Reviewed-by: Reviewed-by: Thomas Hartmann --- .../qtcreator/qmldesigner/newstateseditor/Main.qml | 36 ++++++++++++++++++++-- .../imports/HelperWidgets/ExpressionTextField.qml | 16 +++------- .../imports/StudioControls/DialogButton.qml | 21 ++++++++++--- .../imports/StudioControls/TextField.qml | 12 +++++--- 4 files changed, 63 insertions(+), 22 deletions(-) diff --git a/share/qtcreator/qmldesigner/newstateseditor/Main.qml b/share/qtcreator/qmldesigner/newstateseditor/Main.qml index 5f4cfa1ab0..540f70b485 100644 --- a/share/qtcreator/qmldesigner/newstateseditor/Main.qml +++ b/share/qtcreator/qmldesigner/newstateseditor/Main.qml @@ -303,18 +303,50 @@ Rectangle { width: Math.min(300, root.width) - onApplied: { + function apply() { let renamed = statesEditorModel.renameActiveStateGroup(editTextField.text) if (renamed) editDialog.close() } + onApplied: editDialog.accept() + StudioControls.TextField { id: editTextField - text: statesEditorModel.activeStateGroup actionIndicatorVisible: false translationIndicatorVisible: false anchors.fill: parent + + onTextChanged: { + let btn = editDialog.standardButton(Dialog.Apply) + if (!btn) + return + + if (editDialog.previousString !== editTextField.text) { + btn.enabled = true + } else { + btn.enabled = false + } + } + + onAccepted: editDialog.accept() + onRejected: editDialog.reject() + } + + onAccepted: { + let renamed = statesEditorModel.renameActiveStateGroup(editTextField.text) + if (renamed) + editDialog.close() + } + + property string previousString + + onAboutToShow: { + editTextField.text = statesEditorModel.activeStateGroup + editDialog.previousString = statesEditorModel.activeStateGroup + + let btn = editDialog.standardButton(Dialog.Apply) + btn.enabled = false } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ExpressionTextField.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ExpressionTextField.qml index 7828e9b427..889f94f4ac 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ExpressionTextField.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ExpressionTextField.qml @@ -33,8 +33,6 @@ import StudioTheme 1.0 as StudioTheme StudioControls.TextField { id: textField - signal rejected - translationIndicator.visible: false actionIndicator.visible: false @@ -158,6 +156,11 @@ StudioControls.TextField { onPressed: listView.model = null + onRejected: { + if (textField.completionActive) + listView.model = null + } + Keys.priority: Keys.BeforeItem Keys.onPressed: function(event) { var text = textField.text @@ -244,15 +247,6 @@ StudioControls.TextField { } } - Keys.onEscapePressed: function(event) { - event.accepted = true - if (textField.completionActive) { - listView.model = null - } else { - textField.rejected() - } - } - Keys.onUpPressed: function(event) { listView.decrementCurrentIndex() event.accepted = false diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/DialogButton.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/DialogButton.qml index 6f0c33264f..173b4ffdf3 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/DialogButton.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/DialogButton.qml @@ -60,7 +60,7 @@ T.Button { states: [ State { name: "default" - when: !root.down && !root.hovered && !root.checked + when: root.enabled && !root.down && !root.hovered && !root.checked PropertyChanges { target: background @@ -75,7 +75,7 @@ T.Button { }, State { name: "hover" - when: root.hovered && !root.checked && !root.down + when: root.enabled && root.hovered && !root.checked && !root.down PropertyChanges { target: background @@ -88,8 +88,8 @@ T.Button { } }, State { - name: "pressed" - when: root.checked || root.down + name: "press" + when: root.enabled && (root.checked || root.down) PropertyChanges { target: background @@ -100,6 +100,19 @@ T.Button { target: textItem color: StudioTheme.Values.themeTextColor } + }, + State { + name: "disable" + when: !root.enabled + PropertyChanges { + target: background + color: StudioTheme.Values.themeControlBackgroundDisabled + border.color: StudioTheme.Values.themeControlOutlineDisabled + } + PropertyChanges { + target: textItem + color: StudioTheme.Values.themeTextColorDisabled + } } ] } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/TextField.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/TextField.qml index 0a683fa6d1..7d0dc041f1 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/TextField.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/TextField.qml @@ -52,6 +52,8 @@ T.TextField { property bool contextMenuAboutToShow: false + signal rejected + horizontalAlignment: Qt.AlignLeft verticalAlignment: Qt.AlignVCenter @@ -247,10 +249,10 @@ T.TextField { } ] - Keys.onPressed: function(event) { - if (event.key === Qt.Key_Escape) { - root.text = root.preFocusText - root.focus = false - } + Keys.onEscapePressed: function(event) { + event.accepted = true + root.text = root.preFocusText + root.rejected() + root.focus = false } } -- cgit v1.2.3 From 1c2ffde787fb7bcd15f0fd5091fc8cb3652077d5 Mon Sep 17 00:00:00 2001 From: Petri Virkkunen Date: Tue, 13 Sep 2022 09:24:25 +0300 Subject: Android: set release flag when building and deploying apk ...in Release builds Signed Release builds are now deployed correctly by giving androiddeployqt the --release flag during the Deployment step for Release builds. Unsigned Release apks are now correctly built under the release directory by giving androiddeployqt the --release flag during the Build step for Release builds instead of determining build type from whether or not the package is signed. Fixes: QTCREATORBUG-28163 Change-Id: I319bc95325c88fb84a5997c9237df65eb7983c0e Reviewed-by: Alessandro Portale Reviewed-by: Reviewed-by: Assam Boudjelthia --- src/plugins/android/androidbuildapkstep.cpp | 10 ++++++---- src/plugins/android/androiddeployqtstep.cpp | 3 +++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/android/androidbuildapkstep.cpp b/src/plugins/android/androidbuildapkstep.cpp index 868e7e4129..75df1b3b0f 100644 --- a/src/plugins/android/androidbuildapkstep.cpp +++ b/src/plugins/android/androidbuildapkstep.cpp @@ -608,14 +608,16 @@ bool AndroidBuildApkStep::init() if (m_buildAAB) arguments << "--aab" << "--jarsigner"; + if (buildType() == BuildConfiguration::Release) { + arguments << "--release"; + } + QStringList argumentsPasswordConcealed = arguments; if (m_signPackage) { - arguments << "--release" - << "--sign" << m_keystorePath.toString() << m_certificateAlias + arguments << "--sign" << m_keystorePath.toString() << m_certificateAlias << "--storepass" << m_keystorePasswd; - argumentsPasswordConcealed << "--release" - << "--sign" << "******" + argumentsPasswordConcealed << "--sign" << "******" << "--storepass" << "******"; if (!m_certificatePasswd.isEmpty()) { arguments << "--keypass" << m_certificatePasswd; diff --git a/src/plugins/android/androiddeployqtstep.cpp b/src/plugins/android/androiddeployqtstep.cpp index e5bde4a30b..beeb851118 100644 --- a/src/plugins/android/androiddeployqtstep.cpp +++ b/src/plugins/android/androiddeployqtstep.cpp @@ -261,6 +261,9 @@ bool AndroidDeployQtStep::init() m_androiddeployqtArgs.addArg("--gradle"); + if (buildType() == BuildConfiguration::Release) + m_androiddeployqtArgs.addArgs({"--release"}); + if (androidBuildApkStep && androidBuildApkStep->signPackage()) { // The androiddeployqt tool is not really written to do stand-alone installations. // This hack forces it to use the correct filename for the apk file when installing -- cgit v1.2.3 From d238c503992dd56f16c7820c362906a1460f91db Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 29 Sep 2022 16:05:48 +0300 Subject: QmlDesigner: Store current value at material property copy Now we store the current value of copied properties at copy time instead of just storing a reference to copied property. This ensures we paste the correct value. When copying all properties, properties set by base state, current state, and active timeline are copied. Fixes: QDS-7804 Change-Id: Id6315dde96b30304fde007a87da578faaab43233 Reviewed-by: Reviewed-by: Mahmoud Badri Reviewed-by: Qt CI Bot --- .../materialbrowser/materialbrowsermodel.cpp | 53 ++++++++++++++++++++-- .../materialbrowser/materialbrowsermodel.h | 17 +++++-- .../materialbrowser/materialbrowserview.cpp | 36 ++++++++++----- 3 files changed, 86 insertions(+), 20 deletions(-) diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.cpp b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.cpp index dd828de352..e9af23eb80 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.cpp +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.cpp @@ -29,7 +29,8 @@ #include #include #include -#include "variantproperty.h" +#include +#include #include "utils/qtcassert.h" namespace QmlDesigner { @@ -349,6 +350,9 @@ void MaterialBrowserModel::duplicateMaterial(int idx) void MaterialBrowserModel::copyMaterialProperties(int idx, const QString §ion) { m_copiedMaterial = m_materialList.at(idx); + + QTC_ASSERT(m_copiedMaterial.isValid(), return); + QString matType = QString::fromLatin1(m_copiedMaterial.type()); if (matType.startsWith("QtQuick3D.")) @@ -356,27 +360,66 @@ void MaterialBrowserModel::copyMaterialProperties(int idx, const QString §io setCopiedMaterialType(matType); m_allPropsCopied = section == "All"; + QmlObjectNode mat(m_copiedMaterial); + + QSet validProps; + PropertyNameList copiedProps; + + // Base state properties are always valid + const auto baseProps = m_copiedMaterial.propertyNames(); + for (const auto &baseProp : baseProps) + validProps.insert(baseProp); + + if (!mat.isInBaseState()) { + QmlPropertyChanges changes = mat.propertyChangeForCurrentState(); + if (changes.isValid()) { + const QList changedProps = changes.targetProperties(); + for (const auto &changedProp : changedProps) + validProps.insert(changedProp.name()); + } + } + + if (mat.timelineIsActive()) { + const QList keyframeGroups + = mat.currentTimeline().keyframeGroupsForTarget(m_copiedMaterial); + for (const auto &kfg : keyframeGroups) + validProps.insert(kfg.propertyName()); + } if (m_allPropsCopied || m_propertyGroupsObj.empty()) { - m_copiedMaterialProps = m_copiedMaterial.properties(); + copiedProps = validProps.values(); } else { QJsonObject propsSpecObj = m_propertyGroupsObj.value(m_copiedMaterialType).toObject(); if (propsSpecObj.contains(section)) { // should always be true - m_copiedMaterialProps.clear(); const QJsonArray propNames = propsSpecObj.value(section).toArray(); // auto == QJsonValueConstRef after 04dc959d49e5e3 / Qt 6.4, QJsonValueRef before for (const auto &propName : propNames) - m_copiedMaterialProps.append(m_copiedMaterial.property(propName.toString().toLatin1())); + copiedProps.append(propName.toString().toLatin1()); if (section == "Base") { // add QtQuick3D.Material base props as well QJsonObject propsMatObj = m_propertyGroupsObj.value("Material").toObject(); const QJsonArray propNames = propsMatObj.value("Base").toArray(); // auto == QJsonValueConstRef after 04dc959d49e5e3 / Qt 6.4, QJsonValueRef before for (const auto &propName : propNames) - m_copiedMaterialProps.append(m_copiedMaterial.property(propName.toString().toLatin1())); + copiedProps.append(propName.toString().toLatin1()); } } } + + m_copiedMaterialProps.clear(); + for (const auto &propName : copiedProps) { + PropertyCopyData data; + data.name = propName; + data.isValid = m_allPropsCopied || validProps.contains(propName); + data.isBinding = mat.hasBindingProperty(propName); + if (data.isValid) { + if (data.isBinding) + data.value = mat.expression(propName); + else + data.value = mat.modelValue(propName); + } + m_copiedMaterialProps.append(data); + } } void MaterialBrowserModel::pasteMaterialProperties(int idx) diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.h b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.h index 704cdcb644..c054d07527 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.h +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowsermodel.h @@ -94,6 +94,14 @@ public: Q_INVOKABLE void openMaterialEditor(); Q_INVOKABLE bool isCopiedMaterialValid() const; + struct PropertyCopyData + { + PropertyName name; + QVariant value; + bool isBinding = false; + bool isValid = false; + }; + signals: void isEmptyChanged(); void hasQuick3DImportChanged(); @@ -106,9 +114,10 @@ signals: void applyToSelectedTriggered(const QmlDesigner::ModelNode &material, bool add = false); void addNewMaterialTriggered(); void duplicateMaterialTriggered(const QmlDesigner::ModelNode &material); - void pasteMaterialPropertiesTriggered(const QmlDesigner::ModelNode &material, - const QList &props, - bool all); + void pasteMaterialPropertiesTriggered( + const QmlDesigner::ModelNode &material, + const QList &props, + bool all); private: bool isMaterialVisible(int idx) const; @@ -120,7 +129,7 @@ private: QStringList m_principledMaterialSections; QStringList m_customMaterialSections; ModelNode m_copiedMaterial; - QList m_copiedMaterialProps; + QList m_copiedMaterialProps; QHash m_materialIndexHash; // internalId -> index QJsonObject m_propertyGroupsObj; diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp index 13f7ad211d..90ef925ac4 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp @@ -96,29 +96,43 @@ WidgetInfo MaterialBrowserView::widgetInfo() }); connect(matBrowserModel, &MaterialBrowserModel::pasteMaterialPropertiesTriggered, this, - [&] (const ModelNode &material, const QList &props, bool all) { + [&] (const ModelNode &material, + const QList &propDatas, + bool all) { QmlObjectNode mat(material); executeInTransaction(__FUNCTION__, [&] { if (all) { // all material properties copied // remove current properties - const PropertyNameList propNames = material.propertyNames(); - for (const PropertyName &propName : propNames) { + PropertyNameList propNames; + if (mat.isInBaseState()) { + propNames = material.propertyNames(); + } else { + QmlPropertyChanges changes = mat.propertyChangeForCurrentState(); + if (changes.isValid()) { + const QList changedProps = changes.targetProperties(); + for (const auto &changedProp : changedProps) + propNames.append(changedProp.name()); + } + } + for (const PropertyName &propName : qAsConst(propNames)) { if (propName != "objectName") mat.removeProperty(propName); } } // apply pasted properties - for (const AbstractProperty &prop : props) { - if (prop.name() == "objectName" || !prop.isValid()) + for (const QmlDesigner::MaterialBrowserModel::PropertyCopyData &propData : propDatas) { + if (propData.name == "objectName") continue; - if (prop.isVariantProperty()) - mat.setVariantProperty(prop.name(), prop.toVariantProperty().value()); - else if (prop.isBindingProperty()) - mat.setBindingProperty(prop.name(), prop.toBindingProperty().expression()); - else if (!all) - mat.removeProperty(prop.name()); + if (propData.isValid) { + if (propData.isBinding) + mat.setBindingProperty(propData.name, propData.value.toString()); + else + mat.setVariantProperty(propData.name, propData.value); + } else { + mat.removeProperty(propData.name); + } } }); }); -- cgit v1.2.3 From 5da5830fa7730f6b580e9b7abb5f113232edac50 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 30 Sep 2022 14:10:26 +0300 Subject: QmlDesigner: Fix dragging material from bundle to camera/light Added check that target node is actually a model when applying material. Fixes: QDS-7843 Change-Id: I6e165280c8b79ebbf8316861fe0eb9b947eac3be Reviewed-by: Mahmoud Badri --- .../qmldesigner/components/materialbrowser/materialbrowserview.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp index 90ef925ac4..c2120d9281 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp @@ -202,7 +202,8 @@ void MaterialBrowserView::applyBundleMaterialToDropTarget(const ModelNode &bundl newMatNode = bundleMat; } - if (m_bundleMaterialDropTarget.isValid()) { + if (m_bundleMaterialDropTarget.isValid() + && m_bundleMaterialDropTarget.isSubclassOf("QtQuick3D.Model")) { QmlObjectNode qmlObjNode(m_bundleMaterialDropTarget); if (m_bundleMaterialAddToSelected) { // TODO: unify this logic as it exist elsewhere also -- cgit v1.2.3 From 395e40b8f3a50a327b65ccce9cf2443d2c641924 Mon Sep 17 00:00:00 2001 From: Mahmoud Badri Date: Fri, 30 Sep 2022 14:44:42 +0300 Subject: QmlDesigner: Allow dropping bundle materials to Navigator Fixes: QDS-7844 Change-Id: If3c58f82797beabe76baf99ea2dddc59032729df Reviewed-by: Miikka Heikkinen --- .../components/materialbrowser/materialbrowserview.cpp | 1 - .../components/materialbrowser/materialbrowserwidget.cpp | 7 +++++-- .../components/navigator/choosefrompropertylistdialog.cpp | 7 ++++++- .../qmldesigner/components/navigator/navigatortreemodel.cpp | 5 +++++ src/plugins/qmldesigner/components/navigator/navigatorview.cpp | 8 ++++++++ 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp index c2120d9281..f159593d51 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp @@ -481,7 +481,6 @@ void MaterialBrowserView::customNotification(const AbstractView *view, const QSt } else if (identifier == "drop_bundle_material") { m_bundleMaterialDropTarget = nodeList.first(); - ModelNode defaultMat = getBundleMaterialDefaultInstance(m_draggedBundleMaterial->type()); if (defaultMat.isValid()) applyBundleMaterialToDropTarget(defaultMat); diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp index 9b91254f0f..333c579e26 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp @@ -132,12 +132,15 @@ bool MaterialBrowserWidget::eventFilter(QObject *obj, QEvent *event) } else if (m_bundleMaterialToDrag != nullptr) { QMouseEvent *me = static_cast(event); if ((me->globalPos() - m_dragStartPoint).manhattanLength() > 20) { + QByteArray data; QMimeData *mimeData = new QMimeData; - mimeData->setData(Constants::MIME_TYPE_BUNDLE_MATERIAL, {}); + QDataStream stream(&data, QIODevice::WriteOnly); + stream << m_bundleMaterialToDrag->type(); + mimeData->setData(Constants::MIME_TYPE_BUNDLE_MATERIAL, data); mimeData->removeFormat("text/plain"); - model->startDrag(mimeData, m_bundleMaterialToDrag->icon().toLocalFile()); emit bundleMaterialDragStarted(m_bundleMaterialToDrag); + model->startDrag(mimeData, m_bundleMaterialToDrag->icon().toLocalFile()); m_bundleMaterialToDrag = {}; } } diff --git a/src/plugins/qmldesigner/components/navigator/choosefrompropertylistdialog.cpp b/src/plugins/qmldesigner/components/navigator/choosefrompropertylistdialog.cpp index 178f79e18a..6d8a303f7c 100644 --- a/src/plugins/qmldesigner/components/navigator/choosefrompropertylistdialog.cpp +++ b/src/plugins/qmldesigner/components/navigator/choosefrompropertylistdialog.cpp @@ -58,6 +58,8 @@ ChooseFromPropertyListFilter::ChooseFromPropertyListFilter(const NodeMetaInfo &i // -> Attractor3D // Material // -> Model + // BundleMaterial + // -> Model const TypeName textureType = "QtQuick3D.Texture"; if (insertInfo.isSubclassOf(textureType)) { @@ -107,7 +109,10 @@ ChooseFromPropertyListFilter::ChooseFromPropertyListFilter(const NodeMetaInfo &i || parentInfo.isSubclassOf("QtQuick3D.Particles3D.Attractor3D")) propertyList.append("shape"); } else if (insertInfo.isSubclassOf("QtQuick3D.Material")) { - if (parentInfo.isSubclassOf("QtQuick3D.Particles3D.Model")) + if (parentInfo.isSubclassOf("QtQuick3D.Model")) + propertyList.append("materials"); + } else if (insertInfo.typeName().startsWith("ComponentBundles.MaterialBundle")) { + if (parentInfo.isSubclassOf("QtQuick3D.Model")) propertyList.append("materials"); } } diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp index d347854f00..d9c9d6699e 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp @@ -465,6 +465,7 @@ QStringList NavigatorTreeModel::mimeTypes() const const static QStringList types({Constants::MIME_TYPE_MODELNODE_LIST, Constants::MIME_TYPE_ITEM_LIBRARY_INFO, Constants::MIME_TYPE_MATERIAL, + Constants::MIME_TYPE_BUNDLE_MATERIAL, Constants::MIME_TYPE_ASSETS}); return types; @@ -562,6 +563,10 @@ bool NavigatorTreeModel::dropMimeData(const QMimeData *mimeData, handleItemLibraryItemDrop(mimeData, rowNumber, dropModelIndex); } else if (mimeData->hasFormat(Constants::MIME_TYPE_MATERIAL)) { handleMaterialDrop(mimeData, rowNumber, dropModelIndex); + } else if (mimeData->hasFormat(Constants::MIME_TYPE_BUNDLE_MATERIAL)) { + ModelNode targetNode(modelNodeForIndex(dropModelIndex)); + if (targetNode.isValid()) + m_view->emitCustomNotification("drop_bundle_material", {targetNode}); // To MaterialBrowserView } else if (mimeData->hasFormat(Constants::MIME_TYPE_ASSETS)) { const QStringList assetsPaths = QString::fromUtf8(mimeData->data(Constants::MIME_TYPE_ASSETS)).split(','); NodeAbstractProperty targetProperty; diff --git a/src/plugins/qmldesigner/components/navigator/navigatorview.cpp b/src/plugins/qmldesigner/components/navigator/navigatorview.cpp index 64f7d05602..7b455a9ffd 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatorview.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatorview.cpp @@ -284,6 +284,14 @@ void NavigatorView::dragStarted(QMimeData *mimeData) m_widget->setDragType(matNode.metaInfo().typeName()); m_widget->update(); + } else if (mimeData->hasFormat(Constants::MIME_TYPE_BUNDLE_MATERIAL)) { + QByteArray data = mimeData->data(Constants::MIME_TYPE_BUNDLE_MATERIAL); + QDataStream stream(data); + TypeName bundleMatType; + stream >> bundleMatType; + + m_widget->setDragType(bundleMatType); + m_widget->update(); } } -- cgit v1.2.3 From 243e473b4ccc8686910e30e13a3b89ada2815e86 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 30 Sep 2022 15:28:33 +0300 Subject: QmlDesigner: Fix timeline check when committing dynamic property value Timeline has to be recording for us to care about it at value commit. Otherwise, if there is timeline but it's not recording, we end up with soft assert and losing the dynamic typename, which causes isDynamic checks to fail later on that property. Change-Id: Ib63467ecc4fca1d14409d3c68bb3a5fcd13c10ce Reviewed-by: Thomas Hartmann Reviewed-by: Qt CI Bot --- .../components/propertyeditor/dynamicpropertiesproxymodel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp b/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp index b5791ba287..2c0772a5e1 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/dynamicpropertiesproxymodel.cpp @@ -335,7 +335,8 @@ void DynamicPropertyRow::commitValue(const QVariant &value) QByteArrayLiteral("DynamicPropertiesModel::commitValue")); try { QmlObjectNode objectNode = variantProperty.parentQmlObjectNode(); - if (view->currentState().isBaseState() && !objectNode.timelineIsActive()) { + if (view->currentState().isBaseState() + && !(objectNode.timelineIsActive() && objectNode.currentTimeline().isRecording())) { if (variantProperty.value() != value) variantProperty.setDynamicTypeNameAndValue(variantProperty.dynamicTypeName(), value); } else { -- cgit v1.2.3 From f2b2f488e271f8ad607cfb90ae8aff6f3951291a Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 30 Sep 2022 16:33:53 +0300 Subject: QmlDesigner: Fix mouse position on material browser to 3d editor drag The mouse position from Edit3DWidget needs to be mapped to Edit3DCanvas before resolving the 3d position. Fixes: QDS-7840 Change-Id: I85bc1e9268d6f683382a5431997263429ea13470 Reviewed-by: Qt CI Bot Reviewed-by: Mahmoud Badri --- src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp index 30b8894bbe..e05c3dd10a 100644 --- a/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp +++ b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp @@ -339,6 +339,8 @@ void Edit3DWidget::dragEnterEvent(QDragEnterEvent *dragEnterEvent) void Edit3DWidget::dropEvent(QDropEvent *dropEvent) { + const QPointF pos = m_canvas->mapFrom(this, dropEvent->position()); + // handle dropping materials if (dropEvent->mimeData()->hasFormat(Constants::MIME_TYPE_MATERIAL)) { QByteArray data = dropEvent->mimeData()->data(Constants::MIME_TYPE_MATERIAL); @@ -348,13 +350,13 @@ void Edit3DWidget::dropEvent(QDropEvent *dropEvent) ModelNode matNode = m_view->modelNodeForInternalId(internalId); if (matNode.isValid()) - m_view->dropMaterial(matNode, dropEvent->position()); + m_view->dropMaterial(matNode, pos); return; } // handle dropping bundle materials if (dropEvent->mimeData()->hasFormat(Constants::MIME_TYPE_BUNDLE_MATERIAL)) { - m_view->dropBundleMaterial(dropEvent->position()); + m_view->dropBundleMaterial(pos); return; } -- cgit v1.2.3 From 7d3593fc4ae77af003fce9457399222e4a3e9429 Mon Sep 17 00:00:00 2001 From: Mats Honkamaa Date: Thu, 22 Sep 2022 08:56:31 +0300 Subject: Doc: Add timeline animation tutorial Add a tutorial describing how to use timeline animation and binding animations to properties. Task-number: QDS-6460 Change-Id: I99a586842f6cc6fe3acb0785757eb1d2de86df54 Reviewed-by: Mahmoud Badri --- .../examples/doc/animationTutorial.qdoc | 245 +++++++++++++++++++++ .../animation-tutorial-ballbearing-animation.png | Bin 0 -> 61795 bytes .../doc/images/animation-tutorial-binding-2.png | Bin 0 -> 3628 bytes .../doc/images/animation-tutorial-binding.png | Bin 0 -> 3353 bytes .../doc/images/animation-tutorial-breadcrumb.png | Bin 0 -> 1309 bytes .../images/animation-tutorial-insert-keyframe.png | Bin 0 -> 18051 bytes .../animation-tutorial-per-property-recording.png | Bin 0 -> 5142 bytes .../doc/images/animation-tutorial-property.png | Bin 0 -> 5832 bytes .../doc/images/animation-tutorial-timeline-1.png | Bin 0 -> 16627 bytes .../doc/images/animation-tutorial-timeline-2.png | Bin 0 -> 15358 bytes .../examples/doc/images/animation-tutorial.gif | Bin 0 -> 1589739 bytes 11 files changed, 245 insertions(+) create mode 100644 doc/qtdesignstudio/examples/doc/animationTutorial.qdoc create mode 100644 doc/qtdesignstudio/examples/doc/images/animation-tutorial-ballbearing-animation.png create mode 100644 doc/qtdesignstudio/examples/doc/images/animation-tutorial-binding-2.png create mode 100644 doc/qtdesignstudio/examples/doc/images/animation-tutorial-binding.png create mode 100644 doc/qtdesignstudio/examples/doc/images/animation-tutorial-breadcrumb.png create mode 100644 doc/qtdesignstudio/examples/doc/images/animation-tutorial-insert-keyframe.png create mode 100644 doc/qtdesignstudio/examples/doc/images/animation-tutorial-per-property-recording.png create mode 100644 doc/qtdesignstudio/examples/doc/images/animation-tutorial-property.png create mode 100644 doc/qtdesignstudio/examples/doc/images/animation-tutorial-timeline-1.png create mode 100644 doc/qtdesignstudio/examples/doc/images/animation-tutorial-timeline-2.png create mode 100644 doc/qtdesignstudio/examples/doc/images/animation-tutorial.gif diff --git a/doc/qtdesignstudio/examples/doc/animationTutorial.qdoc b/doc/qtdesignstudio/examples/doc/animationTutorial.qdoc new file mode 100644 index 0000000000..d5b71b91bd --- /dev/null +++ b/doc/qtdesignstudio/examples/doc/animationTutorial.qdoc @@ -0,0 +1,245 @@ +/**************************************************************************** +** +** 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 animation-tutorial.html + \ingroup gstutorials + \sa {Creating Timeline Animations} + + \title Timeline Animation Tutorial + \brief Illustrates how to create timeline animations and bind them to + properties in \QDS. + + \image animation-tutorial.gif + + The \e{Timeline Animation} tutorial illustrates how to create timeline animations + and bind them to properties in \QDS. First you create a keyframe animation + which you control the running state of with a switch in the UI. Next, you + create another keyframe animation where you use a slider in the UI to + control the position of the playhead. + + The starting point of this tutorial is the Animation Tutorial project, + you can download it from + \l{https://git.qt.io/public-demos/qtdesign-studio/-/tree/master/tutorial%20projects/animation-tutorial/AnimationTutorial/Start} + {here}. + + You can download the completed project from + \l{https://git.qt.io/public-demos/qtdesign-studio/-/tree/master/tutorial%20projects/animation-tutorial/AnimationTutorial/Completed} + {here}. + + This tutorial requires that you know the basics of \QDS, see + \l{Getting Started}. + + \section1 Creating a Timeline Animation + + First, you create an animation where the ball bearing continuously rotates + around its Y axis. + + \section2 Adding a Timeline and an Animation + + To add a timeline to your project: + + \list 1 + \li In the \uicontrol Timeline view, select + \inlineimage icons/plus.png + . + This creates a timeline and one animation. + \li On the \uicontrol {Animation Settings} tab in the + \uicontrol {Timeline Settings} dialog: + \list + \li Set \uicontrol Duration to 7500. + This sets the duration of the animation in milliseconds. + \li Select \uicontrol {Contiunous}. + This sets the animation to start over again when it reaches the + end. + \endlist + \image animation-tutorial-timeline-1.png + \li Select \uicontrol {Close}. + \endlist + + You can see the timeline in the \uicontrol Timeline and + \uicontrol Navigator views. + + \section2 Adding Keyframes + + Next, you add keyframes to animate the rotation of the ball bearing: + + \list 1 + \li In the \uicontrol Navigator view, select \e {ballbearing1}. + \li In the \uicontrol Properties view, select + \inlineimage icons/action-icon.png (Actions) + next to \uicontrol Rotation > \uicontrol {Y}. + \li Select \uicontrol {Insert Keyframe}. + \image animation-tutorial-insert-keyframe.png + \li In the \uicontrol Timeline view, select the + \uicontrol {Per Property Recording} button to start recording property + changes. + \image animation-tutorial-per-property-recording.png + \li In the \uicontrol Timeline view, move the playhead to the end of the + animation (frame 1000). + \li In the \uicontrol Properties view, set \uicontrol Rotation > + \uicontrol Z to 360. + This creates a second keyframe. + \li Select the \uicontrol {Per Property Recording} button to end the per + property recording. To preview the animation, drag the playhead along the + timeline. + \endlist + + \section2 Controlling the Running State of the Animation + + There is a toggle switch in the UI of this project. To use this switch to + control the running state of the animation: + + \list 1 + \li In the \uicontrol Navigator view, select \e {timelineAnimation}. + \li In the \uicontrol Connections view, go to the \uicontrol Bindings tab. + \li Select \inlineimage icons/plus.png + to create a binding. + \li For the binding you created, set: + \list + \li \uicontrol Property to \e {paused}. + \li \uicontrol {Source Item} to \e {switch1}. + \li \uicontrol {Source Property} to \e {checked}. + \endlist + \image animation-tutorial-binding.png + \endlist + + You can preview the animation and try the toggle switch in the live preview. + To run the live preview, select \key Alt + \key{P}. + + \section1 Creating a Timeline and Binding it to a Property + + Next, you create the exploded view animation of the ball bearing. You don't + want this animation to run automatically but instead you want to control it + with a slider in the UI. + + \section2 Adding a Timeline Inside a Component + + You create this animation inside the ball bearing component, to do this: + + \list 1 + \li In the \uicontrol Navigator view, select \e {ballBearing1}. + \li Select \key {F2} to go into the component. + \li In the \uicontrol Timeline view, select + \inlineimage icons/plus.png + to add a timeline and open the \uicontrol {Timeline Settings} dialog. + \li Select \inlineimage icons/minus.png + next to the \uicontrol {Animation Settings} tab to remove the animation + in this timeline. + You do not need an animation when you bind the timeline to a property. + \li Select \uicontrol {Close}. + \endlist + + \image animation-tutorial-timeline-2.png + + \section2 Adding Keyframes + + Now, you add keyframes for the different parts of the ball bearing: + + \list 1 + \li In the \uicontrol{Navigator} view, select \e{inner_race}. + \li In the \uicontrol Properties view, select + \inlineimage icons/action-icon.png (Actions) + next to \uicontrol Translation > \uicontrol Y. + \li Select \uicontrol {Insert Keyframe}. + \li In the \uicontrol Timeline view, select the + \uicontrol {Per Property Recording} button to start recording property + changes. + \li In the \uicontrol Timeline view, move the playhead to the end of the + animation (frame 1000). + \li In the \uicontrol Properties view, set \uicontrol Translation > + \uicontrol Y to 0,50. + \li Select the \uicontrol {Per Property Recording} button to end the per + property recording. + \li Next, you set the keyframe values for the other parts of the ball + bearing. For the following parts, set the \uicontrol Translation > + \uicontrol Y value for frame 1000: + \list + \li \e balls to 1,00. + \li \e retainer to 1,50. + \li \e shield_left to 1,80. + \li \e shield_right to -0,30. + \endlist + \image animation-tutorial-ballbearing-animation.png + \endlist + + You can preview the animation by dragging the playhead in the + \uicontrol Timeline view. + + \section2 Controlling the Animation with a Slider + + Now, you use the slider on the main screen to control the exploded + view animation that you created. + + To do this, you first need to define a property for the slider: + + \list 1 + \li In the \uicontrol Navigator view, select \e Node. + \li On the \uicontrol Properties tab in the \uicontrol Connections view, + select \inlineimage icons/plus.png + . + \li In the \uicontrol {Property Type} field, enter \e {Item}. + This field is a drop-down list, but you can also type text. + \li In the \uicontrol {Property Value} field, enter \e {null}. + \endlist + \image animation-tutorial-property.png + + Next, you set the property you just created to control the timeline + animation: + + \list 1 + \li In the \uicontrol {Timeline} view, select + \inlineimage icons/animation.png + . + \li In the \uicontrol {Expression binding field}, enter + \c {property0.value}. + \li Select \uicontrol {Close}. + \endlist + + Next, you go out from the component back to the main project and bind the + property to the slider: + + \list 1 + \li In the toolbar, select the \e {Screen01.ui.qml} breadcrumb. + \image animation-tutorial-breadcrumb.png + \li In the \uicontrol {Navigator} view, select \e {ballbearing1}. + \li In the \uicontrol {Connections} view, go to the + \uicontrol {Bindings} tab. + \li Select \inlineimage icons/plus.png + . + \li For the binding you just created: + \list + \li Set \uicontrol {Source Item} to \e {slider}. + \li Remove the value from \uicontrol {Source Property}. + \endlist + \image animation-tutorial-binding-2.png + \endlist + + \section1 Previewing + + Now, the animations are done. To preview and test your application, + select \key Alt + \key{P}. + +*/ diff --git a/doc/qtdesignstudio/examples/doc/images/animation-tutorial-ballbearing-animation.png b/doc/qtdesignstudio/examples/doc/images/animation-tutorial-ballbearing-animation.png new file mode 100644 index 0000000000..916b2c97c7 Binary files /dev/null and b/doc/qtdesignstudio/examples/doc/images/animation-tutorial-ballbearing-animation.png differ diff --git a/doc/qtdesignstudio/examples/doc/images/animation-tutorial-binding-2.png b/doc/qtdesignstudio/examples/doc/images/animation-tutorial-binding-2.png new file mode 100644 index 0000000000..d32c5be3d9 Binary files /dev/null and b/doc/qtdesignstudio/examples/doc/images/animation-tutorial-binding-2.png differ diff --git a/doc/qtdesignstudio/examples/doc/images/animation-tutorial-binding.png b/doc/qtdesignstudio/examples/doc/images/animation-tutorial-binding.png new file mode 100644 index 0000000000..06648e6628 Binary files /dev/null and b/doc/qtdesignstudio/examples/doc/images/animation-tutorial-binding.png differ diff --git a/doc/qtdesignstudio/examples/doc/images/animation-tutorial-breadcrumb.png b/doc/qtdesignstudio/examples/doc/images/animation-tutorial-breadcrumb.png new file mode 100644 index 0000000000..10f266e67e Binary files /dev/null and b/doc/qtdesignstudio/examples/doc/images/animation-tutorial-breadcrumb.png differ diff --git a/doc/qtdesignstudio/examples/doc/images/animation-tutorial-insert-keyframe.png b/doc/qtdesignstudio/examples/doc/images/animation-tutorial-insert-keyframe.png new file mode 100644 index 0000000000..511bab8642 Binary files /dev/null and b/doc/qtdesignstudio/examples/doc/images/animation-tutorial-insert-keyframe.png differ diff --git a/doc/qtdesignstudio/examples/doc/images/animation-tutorial-per-property-recording.png b/doc/qtdesignstudio/examples/doc/images/animation-tutorial-per-property-recording.png new file mode 100644 index 0000000000..2f89cc584b Binary files /dev/null and b/doc/qtdesignstudio/examples/doc/images/animation-tutorial-per-property-recording.png differ diff --git a/doc/qtdesignstudio/examples/doc/images/animation-tutorial-property.png b/doc/qtdesignstudio/examples/doc/images/animation-tutorial-property.png new file mode 100644 index 0000000000..78d66e63ba Binary files /dev/null and b/doc/qtdesignstudio/examples/doc/images/animation-tutorial-property.png differ diff --git a/doc/qtdesignstudio/examples/doc/images/animation-tutorial-timeline-1.png b/doc/qtdesignstudio/examples/doc/images/animation-tutorial-timeline-1.png new file mode 100644 index 0000000000..f369fe746f Binary files /dev/null and b/doc/qtdesignstudio/examples/doc/images/animation-tutorial-timeline-1.png differ diff --git a/doc/qtdesignstudio/examples/doc/images/animation-tutorial-timeline-2.png b/doc/qtdesignstudio/examples/doc/images/animation-tutorial-timeline-2.png new file mode 100644 index 0000000000..93eac2e2de Binary files /dev/null and b/doc/qtdesignstudio/examples/doc/images/animation-tutorial-timeline-2.png differ diff --git a/doc/qtdesignstudio/examples/doc/images/animation-tutorial.gif b/doc/qtdesignstudio/examples/doc/images/animation-tutorial.gif new file mode 100644 index 0000000000..e663c6b685 Binary files /dev/null and b/doc/qtdesignstudio/examples/doc/images/animation-tutorial.gif differ -- cgit v1.2.3 From 599c8820572eaa363201ebea754b0f6ebf73a325 Mon Sep 17 00:00:00 2001 From: Mats Honkamaa Date: Fri, 30 Sep 2022 11:36:30 +0300 Subject: Doc: Update custom property documentation Task-number: QDS-7735 Change-Id: I1f4551e6d5f1319c73bc6e1b05c3c0390feecda9 Reviewed-by: Leena Miettinen --- .../images/add-local-custom-property.png | Bin 0 -> 11561 bytes .../images/add-new-property-dialog.png | Bin 0 -> 12007 bytes doc/qtdesignstudio/images/custom-properties.png | Bin 0 -> 13496 bytes .../components/qtquick-component-instances.qdoc | 2 +- .../src/components/qtquick-components-custom.qdoc | 2 +- .../src/overviews/qtquick-creating-ui-logic.qdoc | 2 +- .../src/qtdesignstudio-components.qdocinc | 2 +- .../src/qtdesignstudio-simulink.qdoc | 2 +- doc/qtdesignstudio/src/qtdesignstudio-terms.qdoc | 2 +- doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc | 2 +- ...qtdesignstudio-3d-custom-effects-materials.qdoc | 2 +- .../qtquick-connection-editor-properties.qdoc | 72 ++++++++++----------- .../src/views/qtquick-connection-editor.qdoc | 2 +- .../src/views/qtquick-connection-view.qdoc | 2 +- .../src/views/qtquick-properties-view.qdoc | 20 ++++++ 15 files changed, 65 insertions(+), 47 deletions(-) create mode 100644 doc/qtdesignstudio/images/add-local-custom-property.png create mode 100644 doc/qtdesignstudio/images/add-new-property-dialog.png create mode 100644 doc/qtdesignstudio/images/custom-properties.png diff --git a/doc/qtdesignstudio/images/add-local-custom-property.png b/doc/qtdesignstudio/images/add-local-custom-property.png new file mode 100644 index 0000000000..68b848f5aa Binary files /dev/null and b/doc/qtdesignstudio/images/add-local-custom-property.png differ diff --git a/doc/qtdesignstudio/images/add-new-property-dialog.png b/doc/qtdesignstudio/images/add-new-property-dialog.png new file mode 100644 index 0000000000..6aac047855 Binary files /dev/null and b/doc/qtdesignstudio/images/add-new-property-dialog.png differ diff --git a/doc/qtdesignstudio/images/custom-properties.png b/doc/qtdesignstudio/images/custom-properties.png new file mode 100644 index 0000000000..531e62f903 Binary files /dev/null and b/doc/qtdesignstudio/images/custom-properties.png differ diff --git a/doc/qtdesignstudio/src/components/qtquick-component-instances.qdoc b/doc/qtdesignstudio/src/components/qtquick-component-instances.qdoc index 30249eb580..d3a04f89be 100644 --- a/doc/qtdesignstudio/src/components/qtquick-component-instances.qdoc +++ b/doc/qtdesignstudio/src/components/qtquick-component-instances.qdoc @@ -51,7 +51,7 @@ custom properties on the \uicontrol {Properties} tab in the \l {Connections} view. \image qmldesigner-dynamicprops.png "Connections View Properties tab" - For more information, see \l{Specifying Dynamic Properties}. + For more information, see \l{Specifying Custom Properties}. \li To enable users to interact with the component instances, connect the instances to signals on the \uicontrol Connections tab in the \uicontrol {Connections} view. For example, you can specify what diff --git a/doc/qtdesignstudio/src/components/qtquick-components-custom.qdoc b/doc/qtdesignstudio/src/components/qtquick-components-custom.qdoc index 33876c3d12..27e9ee1210 100644 --- a/doc/qtdesignstudio/src/components/qtquick-components-custom.qdoc +++ b/doc/qtdesignstudio/src/components/qtquick-components-custom.qdoc @@ -63,7 +63,7 @@ \uicontrol Navigator or the \uicontrol {2D} view. \li Edit component properties in the \uicontrol Properties view. The available properties depend on the component type. You can - \l{Specifying Dynamic Properties}{add properties for + \l{Specifying Custom Properties}{add properties for components} on the \uicontrol {Properties} tab in the \uicontrol Connections view. \li To change the appearance and behavior of the component instances diff --git a/doc/qtdesignstudio/src/overviews/qtquick-creating-ui-logic.qdoc b/doc/qtdesignstudio/src/overviews/qtquick-creating-ui-logic.qdoc index 1b7be83102..561eb8c62c 100644 --- a/doc/qtdesignstudio/src/overviews/qtquick-creating-ui-logic.qdoc +++ b/doc/qtdesignstudio/src/overviews/qtquick-creating-ui-logic.qdoc @@ -136,7 +136,7 @@ \endif \row \li Adding custom properties for a particular component type - \li \l{Specifying Dynamic Properties} + \li \l{Specifying Custom Properties} \omit \row \li Adding properties for controlling states diff --git a/doc/qtdesignstudio/src/qtdesignstudio-components.qdocinc b/doc/qtdesignstudio/src/qtdesignstudio-components.qdocinc index 19473763a1..330b2ee7be 100644 --- a/doc/qtdesignstudio/src/qtdesignstudio-components.qdocinc +++ b/doc/qtdesignstudio/src/qtdesignstudio-components.qdocinc @@ -71,7 +71,7 @@ \li Edit component properties in the \l Properties view. The available properties depend on the component type. You can - \l{Specifying Dynamic Properties}{add properties for components} on + \l{Specifying Custom Properties}{add properties for components} on the \uicontrol Properties tab in the {Connections} view. \endlist diff --git a/doc/qtdesignstudio/src/qtdesignstudio-simulink.qdoc b/doc/qtdesignstudio/src/qtdesignstudio-simulink.qdoc index 3a7b5d0037..5970a72126 100644 --- a/doc/qtdesignstudio/src/qtdesignstudio-simulink.qdoc +++ b/doc/qtdesignstudio/src/qtdesignstudio-simulink.qdoc @@ -165,7 +165,7 @@ Navigator to add the properties on the \uicontrol Properties tab in the \l Connections view. - See \l {Specifying Dynamic Properties} for a detailed description of how + See \l {Specifying Custom Properties} for a detailed description of how to add a custom property. The name of the property and the data type need to match those of the send or receive property of the Simulink model. diff --git a/doc/qtdesignstudio/src/qtdesignstudio-terms.qdoc b/doc/qtdesignstudio/src/qtdesignstudio-terms.qdoc index a501611d8c..15026d2c51 100644 --- a/doc/qtdesignstudio/src/qtdesignstudio-terms.qdoc +++ b/doc/qtdesignstudio/src/qtdesignstudio-terms.qdoc @@ -219,7 +219,7 @@ \li \l{Preset Components} \li \l{Specifying Component Properties} \li \l{Adding Bindings Between Properties} - \li \l{Specifying Dynamic Properties} + \li \l{Specifying Custom Properties} \endlist \section1 Signal diff --git a/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc b/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc index 2c7f0f5355..bcccd0bf39 100644 --- a/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc +++ b/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc @@ -144,7 +144,7 @@ \list \li\l{Connecting Components to Signals} \li\l{Adding Bindings Between Properties} - \li\l{Specifying Dynamic Properties} + \li\l{Specifying Custom Properties} \endlist \li \l{Adding States} \endlist diff --git a/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-3d-custom-effects-materials.qdoc b/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-3d-custom-effects-materials.qdoc index 872196b761..741551dffe 100644 --- a/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-3d-custom-effects-materials.qdoc +++ b/doc/qtdesignstudio/src/qtquick3d-editor/qtdesignstudio-3d-custom-effects-materials.qdoc @@ -217,5 +217,5 @@ \image studio-custom-material-uniform-properties.png "Uniforms as properties in Connections view Properties tab" For more information about adding properties, see - \l{Specifying Dynamic Properties}. + \l{Specifying Custom Properties}. */ diff --git a/doc/qtdesignstudio/src/views/qtquick-connection-editor-properties.qdoc b/doc/qtdesignstudio/src/views/qtquick-connection-editor-properties.qdoc index 65de3356c8..887bd9700f 100644 --- a/doc/qtdesignstudio/src/views/qtquick-connection-editor-properties.qdoc +++ b/doc/qtdesignstudio/src/views/qtquick-connection-editor-properties.qdoc @@ -31,10 +31,10 @@ \else \nextpage quick-connections-backend.html \endif + \sa {Specifying Component Properties} + \title Specifying Custom Properties - \title Specifying Dynamic Properties - - Each preset \l{glossary-component}{component} has a set of preset properties + Each \l{Preset Components}{preset component }has a set of preset properties that you can specify values for. You can add custom properties that would not otherwise exist for a particular \l{Component Types}{component type}. You bind the properties to dynamic expressions to define global properties @@ -55,49 +55,35 @@ should have an \e int or \e real property for speed to which the UI is bound. - You can add properties for components on the \uicontrol Properties tab in - in the \l {Connections} view. - - \image qmldesigner-dynamicprops.png "Custom properties in the Connections view Custom Properties tab" + \section1 Adding Properties for a Component - To add properties for a component: + To add a custom property for a component: \list 1 - \li Go to the \uicontrol Properties tab in the \l Connections view. + \li Go to the \uicontrol {Local Custom Properties} section in the + \uicontrol Properties view. \li Select the \inlineimage icons/plus.png - (\uicontrol Add) button to add a dynamic property for the currently - selected component. The component ID is displayed in the \uicontrol Item - column. - \li Double-click the value in the \uicontrol Property column to give a - name to the property. Property names must begin with a lower case - letter and can only contain letters, numbers, and underscores. - JavaScript \e {reserved words} are not valid property names. - \li Double-click the value in the \uicontrol {Property Type} column to - specify the \l{Supported Property Types}{type of the property}. - \li Double-click the value in the \uicontrol {Property Value} column - to specify the value of the property. + (\uicontrol Add) button to add a custom property for the currently + selected component. + \image add-local-custom-property.png + \li Set the \uicontrol Name and \uicontrol Type for the property. + \image add-new-property-dialog.png \endlist - Right-click a property and select \uicontrol {Open Binding Editor} in - the context menu to bind the value of the property to that of another one - or to data accessible in the application in \uicontrol {Binding Editor}. - For more information, see \l{Setting Bindings}. - - \image qmldesigner-binding-editor.png "Binding Editor" + \section1 Binding a Property Value - The properties you add for a component are displayed in the \l Properties - view when you select a component of that type in the \l Navigator or - \l {2D} view. + To bind the value of the property to that of another one or to data + accessible in the application. - \image qtquick-custom-properties.png "Custom properties in Properties view" - - For more information about setting property values in the - \l Properties view, see \l{Specifying Component Properties}. + \list 1 + \li In the \uicontrol Properties view, select + \inlineimage icons/action-icon.png + next to the property. + \li Select \uicontrol {Set Binding}. + \image qmldesigner-binding-editor.png "Binding Editor" + \endlist - \if defined(qtcreator) - For an example of using custom properties in an application, see - \l{Creating a Mobile Application}. - \endif + For more information, see \l{Setting Bindings}. \section1 Supported Property Types @@ -134,6 +120,9 @@ \row \li string \li Free form text string + \row + \li TextureInput + \li Specifies a texture exposed to the shaders of a CustomMaterial or Effect. \row \li url \li Resource locator, such as a file name. It can be either absolute, @@ -144,5 +133,14 @@ \li variant \li Generic property type. For example, variant properties can store numbers, strings, objects, arrays, and functions. + \row + \li vector2d + \li Refers to a value with x and y attributes. + \row + \li vector3d + \li Refers to a value with x, y, and z attributes. + \row + \li vector4d + \li Refers to a value with x, y, z, and w attributes. \endtable */ diff --git a/doc/qtdesignstudio/src/views/qtquick-connection-editor.qdoc b/doc/qtdesignstudio/src/views/qtquick-connection-editor.qdoc index 62c9bdb543..9c8360f565 100644 --- a/doc/qtdesignstudio/src/views/qtquick-connection-editor.qdoc +++ b/doc/qtdesignstudio/src/views/qtquick-connection-editor.qdoc @@ -48,7 +48,7 @@ the value of a property changes, the values of any properties that are bound to it are automatically updated accordingly. - \li \l{Specifying Dynamic Properties} + \li \l{Specifying Custom Properties} Each preset component has a set of preset properties that you can specify values for. You can add custom properties that would diff --git a/doc/qtdesignstudio/src/views/qtquick-connection-view.qdoc b/doc/qtdesignstudio/src/views/qtquick-connection-view.qdoc index cc13bc0ee6..f7ba59a7dc 100644 --- a/doc/qtdesignstudio/src/views/qtquick-connection-view.qdoc +++ b/doc/qtdesignstudio/src/views/qtquick-connection-view.qdoc @@ -85,7 +85,7 @@ \li \uicontrol Properties \li Add custom properties that would not otherwise exist for a particular preset component or your own custom component. - \li \l{Specifying Dynamic Properties} + \li \l{Specifying Custom Properties} \if defined(qtcreator) \row \li \uicontrol Backends diff --git a/doc/qtdesignstudio/src/views/qtquick-properties-view.qdoc b/doc/qtdesignstudio/src/views/qtquick-properties-view.qdoc index ca8f331767..8eb86df321 100644 --- a/doc/qtdesignstudio/src/views/qtquick-properties-view.qdoc +++ b/doc/qtdesignstudio/src/views/qtquick-properties-view.qdoc @@ -44,6 +44,26 @@ \image qmldesigner-element-properties.png "Rectangle and Text properties" + \section1 Custom Properties + + Custom Properties are properties that the user has added to the component. + + There are two types of custom properties: + + \table + \header + \li Custom Property Type + \li Description + \row + \li Local Custom Property + \li A property that has been added for a \l{Preset Components}{preset component}. + \row + \li Exposed Custom Property + \li A property that has been added inside a component. + \endtable + + \image custom-properties.png + \section1 Summary of Properties View Buttons The following table lists the \uicontrol Properties view buttons: -- cgit v1.2.3 From 9dda372b7a1fc09aaad609db979cb7d966b61465 Mon Sep 17 00:00:00 2001 From: Mahmoud Badri Date: Mon, 3 Oct 2022 12:34:38 +0300 Subject: QmlDesigner: Fix material browser context menu open issue Allow opening material browser context menu when search is empty. Fixes: QDS-7837 Change-Id: I473b62d1f1b94a42d5c60f0e06a6d2b76b74ca6d Reviewed-by: Reviewed-by: Samuel Ghinet Reviewed-by: Mahmoud Badri --- .../qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml b/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml index d783a9bb05..b8712a9e65 100644 --- a/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml +++ b/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml @@ -310,10 +310,8 @@ Item { height: root.cellHeight onShowContextMenu: { - if (searchBox.isEmpty()) { - root.currentMaterial = model - cxtMenu.popup() - } + root.currentMaterial = model + cxtMenu.popup() } } } @@ -371,10 +369,8 @@ Item { height: root.cellHeight onShowContextMenu: { - if (searchBox.isEmpty()) { - root.currentBundleMaterial = modelData - cxtMenuBundle.popup() - } + root.currentBundleMaterial = modelData + cxtMenuBundle.popup() } } } -- cgit v1.2.3 From 18fd37e331cebed85fcb12d0a81b131e0a7529f6 Mon Sep 17 00:00:00 2001 From: Mahmoud Badri Date: Mon, 3 Oct 2022 15:07:43 +0300 Subject: QmlDesigner: Expand material browser sections when searching Make sure material browser sections that have matches are expanded while searching. Fixes: QDS-7836 Change-Id: Ie30c5425e8efee65cc4bdfa473b269841e73a9d3 Reviewed-by: Samuel Ghinet Reviewed-by: Mahmoud Badri --- .../materialBrowserQmlSource/MaterialBrowser.qml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml b/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml index b8712a9e65..1e50f3f99b 100644 --- a/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml +++ b/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml @@ -241,7 +241,22 @@ Item { width: root.width - addMaterialButton.width - onSearchChanged: (searchText) => rootView.handleSearchFilterChanged(searchText) + onSearchChanged: (searchText) => { + rootView.handleSearchFilterChanged(searchText) + + // make sure searched categories that have matches are expanded + if (!materialBrowserModel.isEmpty && !userMaterialsSection.expanded) + userMaterialsSection.expanded = true + + if (!materialBrowserBundleModel.isEmpty && !bundleMaterialsSection.expanded) + bundleMaterialsSection.expanded = true + + for (let i = 0; i < bundleMaterialsSectionRepeater.count; ++i) { + let sec = bundleMaterialsSectionRepeater.itemAt(i) + if (sec.visible && !sec.expanded) + sec.expanded = true + } + } } IconButton { @@ -338,6 +353,8 @@ Item { } Section { + id: bundleMaterialsSection + width: root.width caption: qsTr("Material Library") addTopPadding: noMatchText.visible @@ -345,6 +362,8 @@ Item { Column { Repeater { + id: bundleMaterialsSectionRepeater + model: materialBrowserBundleModel delegate: Section { -- cgit v1.2.3 From dbbed3dc681ada183d72b9a130873a629321de18 Mon Sep 17 00:00:00 2001 From: Mahmoud Badri Date: Tue, 4 Oct 2022 11:24:05 +0300 Subject: QmlDesigner: Fix property groups missing on new project creation Fixes: QDS-7469 Change-Id: I97809f1e143e92374c72e9fc58f2440742cbcc71 Reviewed-by: Samuel Ghinet Reviewed-by: Qt CI Bot Reviewed-by: Ali Kianian Reviewed-by: Mahmoud Badri --- .../qmldesigner/components/materialbrowser/materialbrowserview.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp index f159593d51..4cedfb9260 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp @@ -25,7 +25,6 @@ #include "materialbrowserview.h" -#include "bindingproperty.h" #include "bundlematerial.h" #include "materialbrowserwidget.h" #include "materialbrowsermodel.h" @@ -249,12 +248,12 @@ void MaterialBrowserView::modelAttached(Model *model) m_widget->materialBrowserModel()->setHasMaterialRoot(rootModelNode().isSubclassOf("QtQuick3D.Material")); m_hasQuick3DImport = model->hasImport("QtQuick3D"); - loadPropertyGroups(); // Project load is already very busy and may even trigger puppet reset, so let's wait a moment // before refreshing the model QTimer::singleShot(1000, this, [this]() { refreshModel(true); + loadPropertyGroups(); // Needs the delay because it uses metaInfo }); } -- cgit v1.2.3 From 90900fc95227045b2cbc1b4a2dcddcca9199e8fd Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 4 Oct 2022 11:26:12 +0200 Subject: UpdateInfo: Ignore multiple update check requests The existing code would kill the currently running process, but - It's unclear why it should do that. If the user wants to cancel the currently running one, they can do that in any case. - The existing code killed the current maintenancetool, but did not cancel the task in the progress manager. Task-number: QTCREATORBUG-28236 Change-Id: I06c2d6b733d637e38cae120dc1a375f7952bfa85 Reviewed-by: Jarek Kobus --- src/plugins/updateinfo/updateinfoplugin.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/updateinfo/updateinfoplugin.cpp b/src/plugins/updateinfo/updateinfoplugin.cpp index 78d31e7291..520dff4cc7 100644 --- a/src/plugins/updateinfo/updateinfoplugin.cpp +++ b/src/plugins/updateinfo/updateinfoplugin.cpp @@ -140,7 +140,8 @@ void UpdateInfoPlugin::doAutoCheckForUpdates() void UpdateInfoPlugin::startCheckForUpdates() { - stopCheckForUpdates(); + if (d->m_maintenanceToolProcess) + return; // do not trigger while update task is already running QFutureInterface futureIf; FutureProgress *futureProgress -- cgit v1.2.3 From 47887da778215045831d8284cf896e8934e75cda Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Thu, 29 Sep 2022 10:27:57 +0200 Subject: QmlDesigner: Forward default value in settings Change-Id: Id60a8ff569a15212b410f73ab707e5e37a3ca5a1 Reviewed-by: Tim Jenssen Reviewed-by: Qt CI Bot --- src/plugins/qmldesigner/designersettings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/designersettings.cpp b/src/plugins/qmldesigner/designersettings.cpp index dacadf7404..033dca2716 100644 --- a/src/plugins/qmldesigner/designersettings.cpp +++ b/src/plugins/qmldesigner/designersettings.cpp @@ -57,7 +57,7 @@ void DesignerSettings::insert(const QHash &settingsHash) QVariant DesignerSettings::value(const QByteArray &key, const QVariant &defaultValue) const { QMutexLocker locker(&m_mutex); - return m_cache.value(key); + return m_cache.value(key, defaultValue); } void DesignerSettings::restoreValue(QSettings *settings, const QByteArray &key, const QVariant &defaultValue) -- cgit v1.2.3