forked from qt-creator/qt-creator
Merge "Merge remote-tracking branch 'origin/7.0' into 8.0" into 8.0
This commit is contained in:
@@ -826,8 +826,15 @@ bool GeneralHelper::getBounds(QQuick3DViewport *view3D, QQuick3DNode *node, QVec
|
||||
auto renderNode = static_cast<QSSGRenderNode *>(nodePriv->spatialNode);
|
||||
|
||||
if (recursive && renderNode) {
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
|
||||
if (renderNode->flags.testFlag(QSSGRenderNode::Flag::TransformDirty))
|
||||
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;
|
||||
}
|
||||
|
||||
|
@@ -192,7 +192,11 @@ void SelectionBoxGeometry::doUpdateGeometry()
|
||||
m = targetRN->parent->globalTransform;
|
||||
}
|
||||
rootRN->localTransform = m;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
|
||||
rootRN->markDirty(QSSGRenderNode::TransformDirtyFlag::TransformNotDirty);
|
||||
#else
|
||||
rootRN->markDirty(QSSGRenderNode::DirtyFlag::TransformDirty);
|
||||
#endif
|
||||
rootRN->calculateGlobalVariables();
|
||||
} else if (!m_spatialNodeUpdatePending) {
|
||||
// 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 (renderNode) {
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
|
||||
if (renderNode->flags.testFlag(QSSGRenderNode::Flag::TransformDirty))
|
||||
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;
|
||||
}
|
||||
trackNodeChanges(node);
|
||||
|
@@ -52,7 +52,12 @@ void import3D(const QString &sourceAsset, const QString &outDir, const QString &
|
||||
|
||||
if (!optDoc.isNull() && optDoc.isObject()) {
|
||||
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) {
|
||||
}
|
||||
} else {
|
||||
|
@@ -118,6 +118,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef IMPORT_QUICK3D_ASSETS
|
||||
#include <QtCore/qjsonobject.h>
|
||||
#include <QtQuick3DAssetImport/private/qssgassetimportmanager_p.h>
|
||||
#endif
|
||||
|
||||
@@ -303,7 +304,15 @@ void Qt5InformationNodeInstanceServer::resolveImportSupport()
|
||||
#ifdef IMPORT_QUICK3D_ASSETS
|
||||
QSSGAssetImportManager importManager;
|
||||
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;
|
||||
|
||||
@@ -317,7 +326,7 @@ void Qt5InformationNodeInstanceServer::resolveImportSupport()
|
||||
QVariantMap optMap;
|
||||
auto itOpt = supportedOptions.constBegin();
|
||||
while (itOpt != supportedOptions.constEnd()) {
|
||||
optMap.insert(itOpt.key(), itOpt.value());
|
||||
optMap.insert(itOpt.key(), AS_VARIANT_MAP(itOpt));
|
||||
++itOpt;
|
||||
}
|
||||
|
||||
|
@@ -27,7 +27,7 @@
|
||||
Metadata {
|
||||
id: metadataFile
|
||||
|
||||
defaultVersion: v21
|
||||
defaultVersion: v22
|
||||
|
||||
VersionData {
|
||||
id: v14
|
||||
@@ -64,4 +64,10 @@ Metadata {
|
||||
name: "Qt for MCUs 2.1"
|
||||
path: "qul-21.qml"
|
||||
}
|
||||
|
||||
VersionData {
|
||||
id: v22
|
||||
name: "Qt for MCUs 2.2"
|
||||
path: "qul-22.qml"
|
||||
}
|
||||
}
|
||||
|
225
share/qtcreator/qmldesigner/qt4mcu/qul-22.qml
Normal file
225
share/qtcreator/qmldesigner/qt4mcu/qul-22.qml
Normal 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"]
|
||||
}
|
||||
}
|
@@ -49,13 +49,18 @@ Rectangle {
|
||||
id: cubeModel
|
||||
eulerRotation.y: 45
|
||||
eulerRotation.x: 30
|
||||
materials: cubeMaterial
|
||||
materials: defaultMaterial
|
||||
source: "#Cube"
|
||||
DefaultMaterial {
|
||||
id: cubeMaterial
|
||||
diffuseColor: "#4aee45"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: __materialLibrary__
|
||||
DefaultMaterial {
|
||||
id: defaultMaterial
|
||||
objectName: "Default Material"
|
||||
diffuseColor: "#4aee45"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -323,6 +323,7 @@ extend_qtc_plugin(QmlDesigner
|
||||
materialeditorqmlbackend.cpp materialeditorqmlbackend.h
|
||||
materialeditortransaction.cpp materialeditortransaction.h
|
||||
materialeditorview.cpp materialeditorview.h
|
||||
materialeditor.qrc
|
||||
)
|
||||
|
||||
extend_qtc_plugin(QmlDesigner
|
||||
|
@@ -344,13 +344,13 @@ void Edit3DView::createEdit3DActions()
|
||||
|
||||
m_backgroundColorSelectionAction = new Edit3DAction(
|
||||
QmlDesigner::Constants::EDIT3D_EDIT_SELECT_BACKGROUND_COLOR, View3DActionCommand::SelectBackgroundColor,
|
||||
QCoreApplication::translate("SelectBackgroundColorAction", "Select Background color"),
|
||||
QCoreApplication::translate("SelectBackgroundColorAction", "Select Background Color"),
|
||||
{}, 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(
|
||||
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 &) {
|
||||
QList<QColor> colors = {QRgb(0x222222), QRgb(0x999999)};
|
||||
auto view = QmlDesignerPlugin::instance()->viewManager().nodeInstanceView();
|
||||
@@ -362,7 +362,7 @@ void Edit3DView::createEdit3DActions()
|
||||
QmlDesigner::DesignerSettingsKey::EDIT3DVIEW_BACKGROUND_COLOR,
|
||||
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(
|
||||
QmlDesigner::Constants::EDIT3D_EDIT_SHOW_SELECTION_BOX, View3DActionCommand::ShowSelectionBox,
|
||||
|
@@ -141,7 +141,9 @@ Edit3DWidget::Edit3DWidget(Edit3DView *view) :
|
||||
m_visibilityTogglesMenu = new Edit3DVisibilityTogglesMenu(this);
|
||||
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);
|
||||
|
||||
view->setSeeker(seeker);
|
||||
|
@@ -207,10 +207,11 @@ void ItemLibraryCategoriesModel::clearSelectedCategory(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;
|
||||
|
||||
const QPointer<ItemLibraryCategory> category = m_categoryList.at(categoryIndex);
|
||||
|
||||
if (!category->categorySelected()) {
|
||||
category->setCategorySelected(true);
|
||||
emit dataChanged(index(categoryIndex),index(categoryIndex), {m_roleNames.key("categorySelected")});
|
||||
|
@@ -72,6 +72,7 @@ void ItemLibraryView::modelAttached(Model *model)
|
||||
AbstractView::modelAttached(model);
|
||||
|
||||
m_widget->clearSearchFilter();
|
||||
m_widget->switchToComponentsView();
|
||||
m_widget->setModel(model);
|
||||
updateImports();
|
||||
if (model)
|
||||
|
@@ -278,7 +278,7 @@ void ItemLibraryWidget::handleAddImport(int index)
|
||||
imports.append(import);
|
||||
model->changeImports(imports, {});
|
||||
|
||||
QMetaObject::invokeMethod(m_itemsWidget->rootObject(), "switchToComponentsView");
|
||||
switchToComponentsView();
|
||||
updateSearch();
|
||||
}
|
||||
|
||||
@@ -310,7 +310,7 @@ void ItemLibraryWidget::setModel(Model *model)
|
||||
m_subCompEditMode = subCompEditMode;
|
||||
// Switch out of add module view if it's active
|
||||
if (m_subCompEditMode)
|
||||
QMetaObject::invokeMethod(m_itemsWidget->rootObject(), "switchToComponentsView");
|
||||
switchToComponentsView();
|
||||
emit subCompEditModeChanged();
|
||||
}
|
||||
}
|
||||
@@ -330,6 +330,11 @@ void ItemLibraryWidget::clearSearchFilter()
|
||||
QMetaObject::invokeMethod(m_itemsWidget->rootObject(), "clearSearchFilter");
|
||||
}
|
||||
|
||||
void ItemLibraryWidget::switchToComponentsView()
|
||||
{
|
||||
QMetaObject::invokeMethod(m_itemsWidget->rootObject(), "switchToComponentsView");
|
||||
}
|
||||
|
||||
void ItemLibraryWidget::reloadQmlSource()
|
||||
{
|
||||
const QString itemLibraryQmlPath = qmlSourcesPath() + "/ItemsView.qml";
|
||||
|
@@ -73,8 +73,9 @@ public:
|
||||
QList<QToolButton *> createToolBarWidgets();
|
||||
|
||||
static QString qmlSourcesPath();
|
||||
void clearSearchFilter();
|
||||
|
||||
void clearSearchFilter();
|
||||
void switchToComponentsView();
|
||||
void delayedUpdateModel();
|
||||
void updateModel();
|
||||
void updatePossibleImports(const QList<Import> &possibleImports);
|
||||
|
@@ -252,7 +252,6 @@ void MaterialBrowserView::importsChanged(const QList<Import> &addedImports, cons
|
||||
|
||||
m_hasQuick3DImport = hasQuick3DImport;
|
||||
refreshModel();
|
||||
|
||||
}
|
||||
|
||||
void MaterialBrowserView::customNotification(const AbstractView *view, const QString &identifier,
|
||||
|
@@ -81,11 +81,15 @@ public:
|
||||
{
|
||||
Q_UNUSED(requestedSize)
|
||||
|
||||
static QPixmap defaultPreview = QPixmap::fromImage(QImage(":/materialeditor/images/defaultmaterialpreview.png"));
|
||||
|
||||
QPixmap pixmap{150, 150};
|
||||
|
||||
qint32 internalId = id.toInt();
|
||||
if (m_pixmaps.contains(internalId))
|
||||
pixmap = m_pixmaps.value(internalId);
|
||||
else
|
||||
pixmap = defaultPreview;
|
||||
|
||||
if (size)
|
||||
*size = pixmap.size();
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
@@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/materialeditor">
|
||||
<file>images/defaultmaterialpreview.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
@@ -77,16 +77,21 @@ public:
|
||||
{
|
||||
Q_UNUSED(requestedSize)
|
||||
|
||||
static QPixmap defaultPreview = QPixmap::fromImage(QImage(":/materialeditor/images/defaultmaterialpreview.png"));
|
||||
|
||||
QPixmap pixmap{150, 150};
|
||||
|
||||
if (id == "preview") {
|
||||
if (!m_previewPixmap.isNull())
|
||||
pixmap = m_previewPixmap;
|
||||
else
|
||||
pixmap = defaultPreview;
|
||||
} else {
|
||||
QString path = Core::ICore::resourcePath("qmldesigner/materialEditorQmlSources/images/" + id).toString();
|
||||
pixmap = QPixmap{path};
|
||||
qWarning() << __FUNCTION__ << "Unsupported image id:" << id;
|
||||
pixmap.fill(Qt::red);
|
||||
}
|
||||
|
||||
|
||||
if (size)
|
||||
*size = pixmap.size();
|
||||
|
||||
|
@@ -87,28 +87,35 @@ void MaterialEditorView::ensureMaterialLibraryNode()
|
||||
if (m_materialLibrary.isValid())
|
||||
return;
|
||||
|
||||
const QList<ModelNode> materials = rootModelNode().subModelNodesOfType("QtQuick3D.Material");
|
||||
if (materials.isEmpty())
|
||||
return;
|
||||
|
||||
// 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);
|
||||
m_materialLibrary = createModelNode(nodeType, metaInfo.majorVersion(), metaInfo.minorVersion());
|
||||
|
||||
m_materialLibrary.setIdWithoutRefactoring(Constants::MATERIAL_LIB_ID);
|
||||
rootModelNode().defaultNodeListProperty().reparentHere(m_materialLibrary);
|
||||
|
||||
// move all materials to under material library node
|
||||
for (const ModelNode &node : materials) {
|
||||
// if material has no name, set name to id
|
||||
QString matName = node.variantProperty("objectName").value().toString();
|
||||
if (matName.isEmpty()) {
|
||||
VariantProperty objNameProp = node.variantProperty("objectName");
|
||||
objNameProp.setValue(node.id());
|
||||
}
|
||||
const QList<ModelNode> materials = rootModelNode().subModelNodesOfType("QtQuick3D.Material");
|
||||
if (materials.isEmpty())
|
||||
return;
|
||||
|
||||
m_materialLibrary.defaultNodeListProperty().reparentHere(node);
|
||||
RewriterTransaction transaction = beginRewriterTransaction(
|
||||
"MaterialEditorView::ensureMaterialLibraryNode");
|
||||
|
||||
try {
|
||||
// move all materials to under material library node
|
||||
for (const ModelNode &node : materials) {
|
||||
// if material has no name, set name to id
|
||||
QString matName = node.variantProperty("objectName").value().toString();
|
||||
if (matName.isEmpty()) {
|
||||
VariantProperty objNameProp = node.variantProperty("objectName");
|
||||
objNameProp.setValue(node.id());
|
||||
}
|
||||
|
||||
m_materialLibrary.defaultNodeListProperty().reparentHere(node);
|
||||
}
|
||||
} catch (Exception &e) {
|
||||
e.showException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -560,8 +567,6 @@ void MaterialEditorView::modelAttached(Model *model)
|
||||
|
||||
m_hasQuick3DImport = model->hasImport("QtQuick3D");
|
||||
|
||||
ensureMaterialLibraryNode();
|
||||
|
||||
if (!m_setupCompleted) {
|
||||
reloadQml();
|
||||
m_setupCompleted = true;
|
||||
@@ -739,7 +744,6 @@ void MaterialEditorView::importsChanged(const QList<Import> &addedImports, const
|
||||
m_hasQuick3DImport = model()->hasImport("QtQuick3D");
|
||||
m_qmlBackEnd->contextObject()->setHasQuick3DImport(m_hasQuick3DImport);
|
||||
|
||||
ensureMaterialLibraryNode(); // create the material lib if Quick3D import is added
|
||||
resetView();
|
||||
}
|
||||
|
||||
|
@@ -97,8 +97,8 @@ void ImageCacheCollector::start(Utils::SmallStringView name,
|
||||
model->setRewriterView(&rewriterView);
|
||||
|
||||
bool is3DRoot = !rewriterView.inErrorState()
|
||||
&& (rewriterView.rootModelNode().isSubclassOf("Quick3D.Node")
|
||||
|| rewriterView.rootModelNode().isSubclassOf("Quick3D.Material"));
|
||||
&& (rewriterView.rootModelNode().isSubclassOf("QtQuick3D.Node")
|
||||
|| rewriterView.rootModelNode().isSubclassOf("QtQuick3D.Material"));
|
||||
|
||||
if (rewriterView.inErrorState() || (!rewriterView.rootModelNode().metaInfo().isGraphicalItem()
|
||||
&& !is3DRoot)) {
|
||||
|
@@ -1150,12 +1150,12 @@ CreateSceneCommand NodeInstanceView::createCreateSceneCommand()
|
||||
if (stateNode.isValid() && stateNode.metaInfo().isSubclassOf("QtQuick.State", 1, 0))
|
||||
stateInstanceId = stateNode.internalId();
|
||||
|
||||
auto value
|
||||
QVariant value
|
||||
#ifndef QMLDESIGNER_TEST
|
||||
= QmlDesigner::DesignerSettings::getValue(
|
||||
QmlDesigner::DesignerSettingsKey::EDIT3DVIEW_BACKGROUND_COLOR);
|
||||
#else
|
||||
= QColor();
|
||||
= {};
|
||||
#endif
|
||||
QList<QColor> edit3dBackgroundColor;
|
||||
if (value.isValid())
|
||||
|
@@ -80,7 +80,8 @@ void DesignerSettings::fromSettings(QSettings *settings)
|
||||
restoreValue(settings, DesignerSettingsKey::ALWAYS_DESIGN_MODE, true);
|
||||
restoreValue(settings, DesignerSettingsKey::DISABLE_ITEM_LIBRARY_UPDATE_TIMER, false);
|
||||
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();
|
||||
|
@@ -693,6 +693,7 @@ Project {
|
||||
"materialeditor/materialeditortransaction.h",
|
||||
"materialeditor/materialeditorview.cpp",
|
||||
"materialeditor/materialeditorview.h",
|
||||
"materialeditor/materialeditor.qrc",
|
||||
"navigator/iconcheckboxitemdelegate.cpp",
|
||||
"navigator/iconcheckboxitemdelegate.h",
|
||||
"navigator/nameitemdelegate.cpp",
|
||||
|
0
tests/system/shared/suites_qtta.py
Executable file → Normal file
0
tests/system/shared/suites_qtta.py
Executable file → Normal file
0
tests/system/suite_CCOM/tst_CCOM01/test.py
Executable file → Normal file
0
tests/system/suite_CCOM/tst_CCOM01/test.py
Executable file → Normal file
0
tests/system/suite_CCOM/tst_CCOM02/test.py
Executable file → Normal file
0
tests/system/suite_CCOM/tst_CCOM02/test.py
Executable file → Normal file
0
tests/system/suite_HELP/tst_HELP02/test.py
Executable file → Normal file
0
tests/system/suite_HELP/tst_HELP02/test.py
Executable file → Normal file
0
tests/system/suite_HELP/tst_HELP05/test.py
Executable file → Normal file
0
tests/system/suite_HELP/tst_HELP05/test.py
Executable file → Normal file
0
tests/system/suite_HELP/tst_HELP06/test.py
Executable file → Normal file
0
tests/system/suite_HELP/tst_HELP06/test.py
Executable file → Normal file
0
tests/system/suite_WELP/tst_WELP01/test.py
Executable file → Normal file
0
tests/system/suite_WELP/tst_WELP01/test.py
Executable file → Normal file
0
tests/system/tools/objectsToTable.py
Executable file → Normal file
0
tests/system/tools/objectsToTable.py
Executable file → Normal file
Reference in New Issue
Block a user