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

This commit is contained in:
The Qt Project
2022-06-07 10:51:20 +00:00
32 changed files with 341 additions and 43 deletions

View File

@@ -826,8 +826,15 @@ bool GeneralHelper::getBounds(QQuick3DViewport *view3D, QQuick3DNode *node, QVec
auto renderNode = static_cast<QSSGRenderNode *>(nodePriv->spatialNode); auto renderNode = static_cast<QSSGRenderNode *>(nodePriv->spatialNode);
if (recursive && renderNode) { if (recursive && renderNode) {
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
if (renderNode->flags.testFlag(QSSGRenderNode::Flag::TransformDirty)) if (renderNode->flags.testFlag(QSSGRenderNode::Flag::TransformDirty))
renderNode->calculateLocalTransform(); renderNode->calculateLocalTransform();
#else
if (renderNode->isDirty(QSSGRenderNode::DirtyFlag::TransformDirty)) {
renderNode->localTransform = QSSGRenderNode::calculateTransformMatrix(
node->position(), node->scale(), node->pivot(), node->rotation());
}
#endif
localTransform = renderNode->localTransform; localTransform = renderNode->localTransform;
} }

View File

@@ -192,7 +192,11 @@ void SelectionBoxGeometry::doUpdateGeometry()
m = targetRN->parent->globalTransform; m = targetRN->parent->globalTransform;
} }
rootRN->localTransform = m; rootRN->localTransform = m;
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
rootRN->markDirty(QSSGRenderNode::TransformDirtyFlag::TransformNotDirty); rootRN->markDirty(QSSGRenderNode::TransformDirtyFlag::TransformNotDirty);
#else
rootRN->markDirty(QSSGRenderNode::DirtyFlag::TransformDirty);
#endif
rootRN->calculateGlobalVariables(); rootRN->calculateGlobalVariables();
} else if (!m_spatialNodeUpdatePending) { } else if (!m_spatialNodeUpdatePending) {
// Necessary spatial nodes do not yet exist. Defer selection box creation one frame. // Necessary spatial nodes do not yet exist. Defer selection box creation one frame.
@@ -236,8 +240,15 @@ void SelectionBoxGeometry::getBounds(
if (node != m_targetNode) { if (node != m_targetNode) {
if (renderNode) { if (renderNode) {
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
if (renderNode->flags.testFlag(QSSGRenderNode::Flag::TransformDirty)) if (renderNode->flags.testFlag(QSSGRenderNode::Flag::TransformDirty))
renderNode->calculateLocalTransform(); renderNode->calculateLocalTransform();
#else
if (renderNode->isDirty(QSSGRenderNode::DirtyFlag::TransformDirty)) {
renderNode->localTransform = QSSGRenderNode::calculateTransformMatrix(
node->position(), node->scale(), node->pivot(), node->rotation());
}
#endif
localTransform = renderNode->localTransform; localTransform = renderNode->localTransform;
} }
trackNodeChanges(node); trackNodeChanges(node);

View File

@@ -52,7 +52,12 @@ void import3D(const QString &sourceAsset, const QString &outDir, const QString &
if (!optDoc.isNull() && optDoc.isObject()) { if (!optDoc.isNull() && optDoc.isObject()) {
QJsonObject optObj = optDoc.object(); QJsonObject optObj = optDoc.object();
if (importer->importFile(sourceAsset, outDir, optObj.toVariantMap(), &errorStr) #if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
const auto &optionsMap = optObj;
#else
const auto optionsMap = optObj.toVariantMap();
#endif // QT_VERSION >= 6.4.0
if (importer->importFile(sourceAsset, outDir, optionsMap, &errorStr)
!= QSSGAssetImportManager::ImportState::Success) { != QSSGAssetImportManager::ImportState::Success) {
} }
} else { } else {

View File

@@ -118,6 +118,7 @@
#endif #endif
#ifdef IMPORT_QUICK3D_ASSETS #ifdef IMPORT_QUICK3D_ASSETS
#include <QtCore/qjsonobject.h>
#include <QtQuick3DAssetImport/private/qssgassetimportmanager_p.h> #include <QtQuick3DAssetImport/private/qssgassetimportmanager_p.h>
#endif #endif
@@ -303,7 +304,15 @@ void Qt5InformationNodeInstanceServer::resolveImportSupport()
#ifdef IMPORT_QUICK3D_ASSETS #ifdef IMPORT_QUICK3D_ASSETS
QSSGAssetImportManager importManager; QSSGAssetImportManager importManager;
const QHash<QString, QStringList> supportedExtensions = importManager.getSupportedExtensions(); const QHash<QString, QStringList> supportedExtensions = importManager.getSupportedExtensions();
const QHash<QString, QVariantMap> supportedOptions = importManager.getAllOptions(); #if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0))
#define AS_VARIANT_MAP(IT) IT.value().toVariantMap()
using PluginOptionMaps = QSSGAssetImportManager::PluginOptionMaps;
#else
#define AS_VARIANT_MAP(IT) IT.value()
using PluginOptionMaps = QHash<QString, QVariantMap>;
#endif // QT_VERSION >= 6.4.0
const PluginOptionMaps supportedOptions = importManager.getAllOptions();
QVariantMap supportMap; QVariantMap supportMap;
@@ -317,7 +326,7 @@ void Qt5InformationNodeInstanceServer::resolveImportSupport()
QVariantMap optMap; QVariantMap optMap;
auto itOpt = supportedOptions.constBegin(); auto itOpt = supportedOptions.constBegin();
while (itOpt != supportedOptions.constEnd()) { while (itOpt != supportedOptions.constEnd()) {
optMap.insert(itOpt.key(), itOpt.value()); optMap.insert(itOpt.key(), AS_VARIANT_MAP(itOpt));
++itOpt; ++itOpt;
} }

View File

@@ -27,7 +27,7 @@
Metadata { Metadata {
id: metadataFile id: metadataFile
defaultVersion: v21 defaultVersion: v22
VersionData { VersionData {
id: v14 id: v14
@@ -64,4 +64,10 @@ Metadata {
name: "Qt for MCUs 2.1" name: "Qt for MCUs 2.1"
path: "qul-21.qml" path: "qul-21.qml"
} }
VersionData {
id: v22
name: "Qt for MCUs 2.2"
path: "qul-22.qml"
}
} }

View File

@@ -0,0 +1,225 @@
/****************************************************************************
**
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
//differences from 2.0:
//2.1: + text.elide
//2.2: + text.wrapMode
VersionData {
name: "Qt for MCUs 2.2"
bannedItems: ["QtQuick.AnimatedImage",
"QtQuick.FocusScope",
"QtQuick.TextInput",
"QtQuick.TextEdit",
"QtQuick.Flow",
"QtQuick.Grid",
"QtQuick.GridView",
"QtQuick.PathView",
"QtQuick.Loader",
"QtQuick.Controls",
"QtQuick.Controls.BusyIndicator",
"QtQuick.Controls.ButtonGroup",
"QtQuick.Controls.CheckDelegate",
"QtQuick.Controls.Container",
"QtQuick.Controls.ComboBox",
"QtQuick.Controls.DelayButton",
"QtQuick.Controls.Frame",
"QtQuick.Controls.GroupBox",
"QtQuick.Controls.ItemDelegate",
"QtQuick.Controls.Label",
"QtQuick.Controls.Page",
"QtQuick.Controls.PageIndicator",
"QtQuick.Controls.Pane",
"QtQuick.Controls.RadioDelegate",
"QtQuick.Controls.RangeSlider",
"QtQuick.Controls.RoundButton",
"QtQuick.Controls.ScrollView",
"QtQuick.Controls.SpinBox",
"QtQuick.Controls.StackView",
"QtQuick.Controls.SwipeDelegate",
"QtQuick.Controls.SwitchDelegate",
"QtQuick.Controls.ToolBar",
"QtQuick.Controls.ToolButton",
"QtQuick.Controls.TabBar",
"QtQuick.Controls.TabButton",
"QtQuick.Controls.TextArea",
"QtQuick.Controls.TextField",
"QtQuick.Controls.ToolSeparator",
"QtQuick.Controls.Tumbler",
"QtQuick.Shapes.ConicalGradient",
"QtQuick.Shapes.LinearGradient",
"QtQuick.Shapes.RadialGradient",
"QtQuick.Shapes.ShapeGradient"]
allowedImports: ["QtQuick",
"QtQuick.Shapes",
"QtQuick.Controls",
"QtQuick.Timeline",
"QtQuickUltralite.Extras",
"QtQuickUltralite.Layers"]
bannedImports: ["FlowView"]
//ComplexProperty is not a type, it's just a way to handle bigger props
ComplexProperty {
prefix: "font"
bannedProperties: ["wordSpacing", "letterSpacing", "hintingPreference",
"kerning", "preferShaping", "capitalization",
"strikeout", "underline", "styleName"]
}
QtQuick.Item {
bannedProperties: ["layer", "opacity", "smooth", "antialiasing",
"baselineOffset", "focus", "activeFocusOnTab",
"rotation", "scale", "transformOrigin"]
}
QtQuick.Rectangle {
bannedProperties: ["gradient", "border"]
}
QtQuick.Flickable {
bannedProperties: ["boundsBehavior", "boundsMovement", "flickDeceleration",
"flickableDirection", "leftMargin", "rightMargin", "bottomMargin", "topMargin",
"originX", "originY", "pixelAligned", "pressDelay", "synchronousDrag"]
}
QtQuick.MouseArea {
bannedProperties: ["propagateComposedEvents", "preventStealing", "cursorShape",
"scrollGestureEnabled", "drag", "acceptedButtons", "hoverEnabled"]
}
QtQuick.Image {
allowChildren: false
allowedProperties: ["rotation", "scale", "transformOrigin"]
bannedProperties: ["mirror", "mipmap", "cache", "autoTransform", "asynchronous",
"sourceSize", "smooth"]
}
QtQuick.BorderImage {
bannedProperties: ["asynchronous", "cache", "currentFrame", "frameCount",
"horizontalTileMode", "mirror", "progress", "smooth", "sourceSize",
"status", "verticalTileMode"]
}
QtQuick.Text {
allowChildren: false
allowedProperties: ["rotation", "scale", "transformOrigin"]
bannedProperties: ["lineHeight", "lineHeightMode", "style",
"styleColor", "minimumPointSize", "minimumPixelSize",
"fontSizeMode", "renderType", "renderTypeQuality", "textFormat", "maximumLineCount"]
}
//Padding is not an actual item, but rather set of properties in Text
Padding {
bannedProperties: ["bottomPadding", "topPadding", "leftPadding", "rightPadding"]
}
QtQuick.Column {
bannedProperties: ["bottomPadding", "leftPadding", "rightPadding", "topPadding"]
}
QtQuick.Row {
bannedProperties: ["bottomPadding", "leftPadding", "rightPadding", "topPadding",
"effectiveLayoutDirection", "layoutDirection"]
}
QtQuick.ListView {
bannedProperties: ["cacheBuffer", "highlightRangeMode", "highlightMoveDuration",
"highlightResizeDuration", "preferredHighlightBegin", "layoutDirection",
"preferredHighlightEnd", "highlightFollowsCurrentItem", "keyNavigationWraps",
"snapMode", "highlightMoveVelocity", "highlightResizeVelocity"]
}
QtQuick.Animation {
bannedProperties: ["paused"]
}
//Quick Controls2 Items and properties:
QtQuick.Controls.Control {
bannedProperties: ["focusPolicy", "hoverEnabled", "wheelEnabled"]
}
QtQuick.Controls.AbstractButton {
bannedProperties: ["display", "autoExclusive"]
}
QtQuick.Controls.ProgressBar {
bannedProperties: ["indeterminate"]
}
QtQuick.Controls.Slider {
bannedProperties: ["live", "snapMode", "touchDragThreshold"]
}
//Path and Shapes related:
QtQuick.Path {
bannedProperties: ["scale", "pathElements"]
}
QtQuick.PathArc {
bannedProperties: ["relativeX", "relativeY"]
}
QtQuick.PathLine {
bannedProperties: ["relativeX", "relativeY"]
}
QtQuick.PathMove {
bannedProperties: ["relativeX", "relativeY"]
}
QtQuick.PathQuad {
bannedProperties: ["relativeX", "relativeY",
"relativeControlX", "relativeControlY"]
}
QtQuick.PathCubic {
bannedProperties: ["relativeX", "relativeY",
"relativeControl1X", "relativeControl1Y",
"relativeControl2X", "relativeControl2Y"]
}
QtQuick.PathElement {
//nothing
}
QtQuick.PathSvg {
//nothing
}
QtQuick.Shapes.Shape {
bannedProperties: ["asynchronous", "containsMode", "data",
"renderType", "status", "vendorExtensionsEnabled"]
}
QtQuick.Shapes.ShapePath {
bannedProperties: ["dashOffset", "dashPattern",
"fillGradient", "strokeStyle"]
}
}

View File

@@ -49,13 +49,18 @@ Rectangle {
id: cubeModel id: cubeModel
eulerRotation.y: 45 eulerRotation.y: 45
eulerRotation.x: 30 eulerRotation.x: 30
materials: cubeMaterial materials: defaultMaterial
source: "#Cube" source: "#Cube"
}
}
}
Item {
id: __materialLibrary__
DefaultMaterial { DefaultMaterial {
id: cubeMaterial id: defaultMaterial
objectName: "Default Material"
diffuseColor: "#4aee45" diffuseColor: "#4aee45"
} }
} }
} }
}
}

View File

@@ -323,6 +323,7 @@ extend_qtc_plugin(QmlDesigner
materialeditorqmlbackend.cpp materialeditorqmlbackend.h materialeditorqmlbackend.cpp materialeditorqmlbackend.h
materialeditortransaction.cpp materialeditortransaction.h materialeditortransaction.cpp materialeditortransaction.h
materialeditorview.cpp materialeditorview.h materialeditorview.cpp materialeditorview.h
materialeditor.qrc
) )
extend_qtc_plugin(QmlDesigner extend_qtc_plugin(QmlDesigner

View File

@@ -344,13 +344,13 @@ void Edit3DView::createEdit3DActions()
m_backgroundColorSelectionAction = new Edit3DAction( m_backgroundColorSelectionAction = new Edit3DAction(
QmlDesigner::Constants::EDIT3D_EDIT_SELECT_BACKGROUND_COLOR, View3DActionCommand::SelectBackgroundColor, QmlDesigner::Constants::EDIT3D_EDIT_SELECT_BACKGROUND_COLOR, View3DActionCommand::SelectBackgroundColor,
QCoreApplication::translate("SelectBackgroundColorAction", "Select Background color"), QCoreApplication::translate("SelectBackgroundColorAction", "Select Background Color"),
{}, false, false, {}, {}, showBackgroundColorSelection, {}, false, false, {}, {}, showBackgroundColorSelection,
QCoreApplication::translate("SelectBackgroundColorAction", "Choose a color for the background.")); QCoreApplication::translate("SelectBackgroundColorAction", "Select a color for the background of the 3D Editor."));
m_resetBackgroundColorAction = new Edit3DAction( m_resetBackgroundColorAction = new Edit3DAction(
QmlDesigner::Constants::EDIT3D_EDIT_RESET_BACKGROUND_COLOR, View3DActionCommand::ResetBackgroundColor, QmlDesigner::Constants::EDIT3D_EDIT_RESET_BACKGROUND_COLOR, View3DActionCommand::ResetBackgroundColor,
QCoreApplication::translate("ResetBackgroundColorAction", "Reset Background color"), QCoreApplication::translate("ResetBackgroundColorAction", "Reset Background Color"),
{}, false, false, {}, {}, [](const SelectionContext &) { {}, false, false, {}, {}, [](const SelectionContext &) {
QList<QColor> colors = {QRgb(0x222222), QRgb(0x999999)}; QList<QColor> colors = {QRgb(0x222222), QRgb(0x999999)};
auto view = QmlDesignerPlugin::instance()->viewManager().nodeInstanceView(); auto view = QmlDesignerPlugin::instance()->viewManager().nodeInstanceView();
@@ -362,7 +362,7 @@ void Edit3DView::createEdit3DActions()
QmlDesigner::DesignerSettingsKey::EDIT3DVIEW_BACKGROUND_COLOR, QmlDesigner::DesignerSettingsKey::EDIT3DVIEW_BACKGROUND_COLOR,
QVariant::fromValue(colorsToSave)); QVariant::fromValue(colorsToSave));
}, },
QCoreApplication::translate("ResetBackgroundColorAction", "Reset Background color to the default value.")); QCoreApplication::translate("ResetBackgroundColorAction", "Reset background color of the 3D Editor to the default value."));
m_showSelectionBoxAction = new Edit3DAction( m_showSelectionBoxAction = new Edit3DAction(
QmlDesigner::Constants::EDIT3D_EDIT_SHOW_SELECTION_BOX, View3DActionCommand::ShowSelectionBox, QmlDesigner::Constants::EDIT3D_EDIT_SHOW_SELECTION_BOX, View3DActionCommand::ShowSelectionBox,

View File

@@ -141,7 +141,9 @@ Edit3DWidget::Edit3DWidget(Edit3DView *view) :
m_visibilityTogglesMenu = new Edit3DVisibilityTogglesMenu(this); m_visibilityTogglesMenu = new Edit3DVisibilityTogglesMenu(this);
handleActions(view->visibilityToggleActions(), m_visibilityTogglesMenu, false); handleActions(view->visibilityToggleActions(), m_visibilityTogglesMenu, false);
m_backgroundColorMenu = new Edit3DVisibilityTogglesMenu(this); m_backgroundColorMenu = new QMenu(this);
m_backgroundColorMenu->setToolTipsVisible(true);
handleActions(view->backgroundColorActions(), m_backgroundColorMenu, false); handleActions(view->backgroundColorActions(), m_backgroundColorMenu, false);
view->setSeeker(seeker); view->setSeeker(seeker);

View File

@@ -207,10 +207,11 @@ void ItemLibraryCategoriesModel::clearSelectedCategory(int categoryIndex)
QPointer<ItemLibraryCategory> ItemLibraryCategoriesModel::selectCategory(int categoryIndex) QPointer<ItemLibraryCategory> ItemLibraryCategoriesModel::selectCategory(int categoryIndex)
{ {
if (categoryIndex == -1 || m_categoryList.isEmpty()) if (m_categoryList.isEmpty() || categoryIndex < 0 || categoryIndex >= m_categoryList.size())
return nullptr; return nullptr;
const QPointer<ItemLibraryCategory> category = m_categoryList.at(categoryIndex); const QPointer<ItemLibraryCategory> category = m_categoryList.at(categoryIndex);
if (!category->categorySelected()) { if (!category->categorySelected()) {
category->setCategorySelected(true); category->setCategorySelected(true);
emit dataChanged(index(categoryIndex),index(categoryIndex), {m_roleNames.key("categorySelected")}); emit dataChanged(index(categoryIndex),index(categoryIndex), {m_roleNames.key("categorySelected")});

View File

@@ -72,6 +72,7 @@ void ItemLibraryView::modelAttached(Model *model)
AbstractView::modelAttached(model); AbstractView::modelAttached(model);
m_widget->clearSearchFilter(); m_widget->clearSearchFilter();
m_widget->switchToComponentsView();
m_widget->setModel(model); m_widget->setModel(model);
updateImports(); updateImports();
if (model) if (model)

View File

@@ -278,7 +278,7 @@ void ItemLibraryWidget::handleAddImport(int index)
imports.append(import); imports.append(import);
model->changeImports(imports, {}); model->changeImports(imports, {});
QMetaObject::invokeMethod(m_itemsWidget->rootObject(), "switchToComponentsView"); switchToComponentsView();
updateSearch(); updateSearch();
} }
@@ -310,7 +310,7 @@ void ItemLibraryWidget::setModel(Model *model)
m_subCompEditMode = subCompEditMode; m_subCompEditMode = subCompEditMode;
// Switch out of add module view if it's active // Switch out of add module view if it's active
if (m_subCompEditMode) if (m_subCompEditMode)
QMetaObject::invokeMethod(m_itemsWidget->rootObject(), "switchToComponentsView"); switchToComponentsView();
emit subCompEditModeChanged(); emit subCompEditModeChanged();
} }
} }
@@ -330,6 +330,11 @@ void ItemLibraryWidget::clearSearchFilter()
QMetaObject::invokeMethod(m_itemsWidget->rootObject(), "clearSearchFilter"); QMetaObject::invokeMethod(m_itemsWidget->rootObject(), "clearSearchFilter");
} }
void ItemLibraryWidget::switchToComponentsView()
{
QMetaObject::invokeMethod(m_itemsWidget->rootObject(), "switchToComponentsView");
}
void ItemLibraryWidget::reloadQmlSource() void ItemLibraryWidget::reloadQmlSource()
{ {
const QString itemLibraryQmlPath = qmlSourcesPath() + "/ItemsView.qml"; const QString itemLibraryQmlPath = qmlSourcesPath() + "/ItemsView.qml";

View File

@@ -73,8 +73,9 @@ public:
QList<QToolButton *> createToolBarWidgets(); QList<QToolButton *> createToolBarWidgets();
static QString qmlSourcesPath(); static QString qmlSourcesPath();
void clearSearchFilter();
void clearSearchFilter();
void switchToComponentsView();
void delayedUpdateModel(); void delayedUpdateModel();
void updateModel(); void updateModel();
void updatePossibleImports(const QList<Import> &possibleImports); void updatePossibleImports(const QList<Import> &possibleImports);

View File

@@ -252,7 +252,6 @@ void MaterialBrowserView::importsChanged(const QList<Import> &addedImports, cons
m_hasQuick3DImport = hasQuick3DImport; m_hasQuick3DImport = hasQuick3DImport;
refreshModel(); refreshModel();
} }
void MaterialBrowserView::customNotification(const AbstractView *view, const QString &identifier, void MaterialBrowserView::customNotification(const AbstractView *view, const QString &identifier,

View File

@@ -81,11 +81,15 @@ public:
{ {
Q_UNUSED(requestedSize) Q_UNUSED(requestedSize)
static QPixmap defaultPreview = QPixmap::fromImage(QImage(":/materialeditor/images/defaultmaterialpreview.png"));
QPixmap pixmap{150, 150}; QPixmap pixmap{150, 150};
qint32 internalId = id.toInt(); qint32 internalId = id.toInt();
if (m_pixmaps.contains(internalId)) if (m_pixmaps.contains(internalId))
pixmap = m_pixmaps.value(internalId); pixmap = m_pixmaps.value(internalId);
else
pixmap = defaultPreview;
if (size) if (size)
*size = pixmap.size(); *size = pixmap.size();

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/materialeditor">
<file>images/defaultmaterialpreview.png</file>
</qresource>
</RCC>

View File

@@ -77,16 +77,21 @@ public:
{ {
Q_UNUSED(requestedSize) Q_UNUSED(requestedSize)
static QPixmap defaultPreview = QPixmap::fromImage(QImage(":/materialeditor/images/defaultmaterialpreview.png"));
QPixmap pixmap{150, 150}; QPixmap pixmap{150, 150};
if (id == "preview") { if (id == "preview") {
if (!m_previewPixmap.isNull()) if (!m_previewPixmap.isNull())
pixmap = m_previewPixmap; pixmap = m_previewPixmap;
else
pixmap = defaultPreview;
} else { } else {
QString path = Core::ICore::resourcePath("qmldesigner/materialEditorQmlSources/images/" + id).toString(); qWarning() << __FUNCTION__ << "Unsupported image id:" << id;
pixmap = QPixmap{path}; pixmap.fill(Qt::red);
} }
if (size) if (size)
*size = pixmap.size(); *size = pixmap.size();

View File

@@ -87,18 +87,22 @@ void MaterialEditorView::ensureMaterialLibraryNode()
if (m_materialLibrary.isValid()) if (m_materialLibrary.isValid())
return; return;
const QList<ModelNode> materials = rootModelNode().subModelNodesOfType("QtQuick3D.Material");
if (materials.isEmpty())
return;
// create material library node // create material library node
TypeName nodeType = rootModelNode().isSubclassOf("QtQuick3D.Node") ? "Quick3D.Node" : "QtQuick.Item"; TypeName nodeType = rootModelNode().isSubclassOf("QtQuick3D.Node") ? "QtQuick3D.Node" : "QtQuick.Item";
NodeMetaInfo metaInfo = model()->metaInfo(nodeType); NodeMetaInfo metaInfo = model()->metaInfo(nodeType);
m_materialLibrary = createModelNode(nodeType, metaInfo.majorVersion(), metaInfo.minorVersion()); m_materialLibrary = createModelNode(nodeType, metaInfo.majorVersion(), metaInfo.minorVersion());
m_materialLibrary.setIdWithoutRefactoring(Constants::MATERIAL_LIB_ID); m_materialLibrary.setIdWithoutRefactoring(Constants::MATERIAL_LIB_ID);
rootModelNode().defaultNodeListProperty().reparentHere(m_materialLibrary); rootModelNode().defaultNodeListProperty().reparentHere(m_materialLibrary);
const QList<ModelNode> materials = rootModelNode().subModelNodesOfType("QtQuick3D.Material");
if (materials.isEmpty())
return;
RewriterTransaction transaction = beginRewriterTransaction(
"MaterialEditorView::ensureMaterialLibraryNode");
try {
// move all materials to under material library node // move all materials to under material library node
for (const ModelNode &node : materials) { for (const ModelNode &node : materials) {
// if material has no name, set name to id // if material has no name, set name to id
@@ -110,6 +114,9 @@ void MaterialEditorView::ensureMaterialLibraryNode()
m_materialLibrary.defaultNodeListProperty().reparentHere(node); m_materialLibrary.defaultNodeListProperty().reparentHere(node);
} }
} catch (Exception &e) {
e.showException();
}
} }
MaterialEditorView::~MaterialEditorView() MaterialEditorView::~MaterialEditorView()
@@ -560,8 +567,6 @@ void MaterialEditorView::modelAttached(Model *model)
m_hasQuick3DImport = model->hasImport("QtQuick3D"); m_hasQuick3DImport = model->hasImport("QtQuick3D");
ensureMaterialLibraryNode();
if (!m_setupCompleted) { if (!m_setupCompleted) {
reloadQml(); reloadQml();
m_setupCompleted = true; m_setupCompleted = true;
@@ -739,7 +744,6 @@ void MaterialEditorView::importsChanged(const QList<Import> &addedImports, const
m_hasQuick3DImport = model()->hasImport("QtQuick3D"); m_hasQuick3DImport = model()->hasImport("QtQuick3D");
m_qmlBackEnd->contextObject()->setHasQuick3DImport(m_hasQuick3DImport); m_qmlBackEnd->contextObject()->setHasQuick3DImport(m_hasQuick3DImport);
ensureMaterialLibraryNode(); // create the material lib if Quick3D import is added
resetView(); resetView();
} }

View File

@@ -97,8 +97,8 @@ void ImageCacheCollector::start(Utils::SmallStringView name,
model->setRewriterView(&rewriterView); model->setRewriterView(&rewriterView);
bool is3DRoot = !rewriterView.inErrorState() bool is3DRoot = !rewriterView.inErrorState()
&& (rewriterView.rootModelNode().isSubclassOf("Quick3D.Node") && (rewriterView.rootModelNode().isSubclassOf("QtQuick3D.Node")
|| rewriterView.rootModelNode().isSubclassOf("Quick3D.Material")); || rewriterView.rootModelNode().isSubclassOf("QtQuick3D.Material"));
if (rewriterView.inErrorState() || (!rewriterView.rootModelNode().metaInfo().isGraphicalItem() if (rewriterView.inErrorState() || (!rewriterView.rootModelNode().metaInfo().isGraphicalItem()
&& !is3DRoot)) { && !is3DRoot)) {

View File

@@ -1150,12 +1150,12 @@ CreateSceneCommand NodeInstanceView::createCreateSceneCommand()
if (stateNode.isValid() && stateNode.metaInfo().isSubclassOf("QtQuick.State", 1, 0)) if (stateNode.isValid() && stateNode.metaInfo().isSubclassOf("QtQuick.State", 1, 0))
stateInstanceId = stateNode.internalId(); stateInstanceId = stateNode.internalId();
auto value QVariant value
#ifndef QMLDESIGNER_TEST #ifndef QMLDESIGNER_TEST
= QmlDesigner::DesignerSettings::getValue( = QmlDesigner::DesignerSettings::getValue(
QmlDesigner::DesignerSettingsKey::EDIT3DVIEW_BACKGROUND_COLOR); QmlDesigner::DesignerSettingsKey::EDIT3DVIEW_BACKGROUND_COLOR);
#else #else
= QColor(); = {};
#endif #endif
QList<QColor> edit3dBackgroundColor; QList<QColor> edit3dBackgroundColor;
if (value.isValid()) if (value.isValid())

View File

@@ -80,7 +80,8 @@ void DesignerSettings::fromSettings(QSettings *settings)
restoreValue(settings, DesignerSettingsKey::ALWAYS_DESIGN_MODE, true); restoreValue(settings, DesignerSettingsKey::ALWAYS_DESIGN_MODE, true);
restoreValue(settings, DesignerSettingsKey::DISABLE_ITEM_LIBRARY_UPDATE_TIMER, false); restoreValue(settings, DesignerSettingsKey::DISABLE_ITEM_LIBRARY_UPDATE_TIMER, false);
restoreValue(settings, DesignerSettingsKey::ASK_BEFORE_DELETING_ASSET, true); restoreValue(settings, DesignerSettingsKey::ASK_BEFORE_DELETING_ASSET, true);
restoreValue(settings, DesignerSettingsKey::EDIT3DVIEW_BACKGROUND_COLOR, QList<QString>{"#222222", "#999999"}); const QStringList defaultValue = QStringList() << "#222222" << "#999999";
restoreValue(settings, DesignerSettingsKey::EDIT3DVIEW_BACKGROUND_COLOR, defaultValue);
settings->endGroup(); settings->endGroup();
settings->endGroup(); settings->endGroup();

View File

@@ -693,6 +693,7 @@ Project {
"materialeditor/materialeditortransaction.h", "materialeditor/materialeditortransaction.h",
"materialeditor/materialeditorview.cpp", "materialeditor/materialeditorview.cpp",
"materialeditor/materialeditorview.h", "materialeditor/materialeditorview.h",
"materialeditor/materialeditor.qrc",
"navigator/iconcheckboxitemdelegate.cpp", "navigator/iconcheckboxitemdelegate.cpp",
"navigator/iconcheckboxitemdelegate.h", "navigator/iconcheckboxitemdelegate.h",
"navigator/nameitemdelegate.cpp", "navigator/nameitemdelegate.cpp",

0
tests/system/shared/suites_qtta.py Executable file → Normal file
View File

0
tests/system/suite_CCOM/tst_CCOM01/test.py Executable file → Normal file
View File

0
tests/system/suite_CCOM/tst_CCOM02/test.py Executable file → Normal file
View File

0
tests/system/suite_HELP/tst_HELP02/test.py Executable file → Normal file
View File

0
tests/system/suite_HELP/tst_HELP05/test.py Executable file → Normal file
View File

0
tests/system/suite_HELP/tst_HELP06/test.py Executable file → Normal file
View File

0
tests/system/suite_WELP/tst_WELP01/test.py Executable file → Normal file
View File

0
tests/system/tools/objectsToTable.py Executable file → Normal file
View File