Merge remote-tracking branch 'origin/6.0'

Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri

Change-Id: If8baed5564470e550a0ba5c7720915217eec2412
This commit is contained in:
Eike Ziller
2021-10-21 09:13:03 +02:00
459 changed files with 9236 additions and 6091 deletions

View File

@@ -31,6 +31,7 @@ DirectionalDraggable {
id: arrowRoot
Model {
readonly property bool _edit3dLocked: true // Make this non-pickable
geometry: LineGeometry {
id: lineGeometry
name: "Edit 3D ScalableArrow"
@@ -43,6 +44,7 @@ DirectionalDraggable {
Model {
id: arrowHead
readonly property bool _edit3dLocked: true // Make this non-pickable
source: "#Cone"
materials: [ arrowRoot.material ]
y: arrowRoot.length - 3

View File

@@ -42,6 +42,7 @@ DirectionalDraggable {
Model {
id: handle
readonly property bool _edit3dLocked: true // Make this non-pickable
source: "#Sphere"
materials: [ handleRoot.material ]
scale: Qt.vector3d(0.02, 0.02, 0.02)

View File

@@ -35,6 +35,7 @@ Model {
property Node targetNode: null
property Node scene: null
property bool selected: false
readonly property bool _edit3dLocked: true // Make this non-pickable
function updateGeometry()
{

View File

@@ -41,6 +41,7 @@ Model {
property real offset: 0
readonly property bool hovering: mouseAreaYZ.hovering || mouseAreaXZ.hovering
readonly property bool _edit3dLocked: true // Make this non-pickable
property vector3d _scenePosPressed
property real _posPressed

View File

@@ -721,6 +721,7 @@ Item {
Model {
id: pivotCap
readonly property bool _edit3dLocked: true // Make this non-pickable
source: "#Sphere"
scale: pivotAutoScale.getScale(Qt.vector3d(0.03, 0.03, 0.03))
position: pivotLine.startPos
@@ -760,7 +761,7 @@ Item {
onPressed: (mouse)=> {
if (viewRoot.editView) {
var pickResult = viewRoot.editView.pick(mouse.x, mouse.y);
var pickResult = _generalHelper.pickViewAt(viewRoot.editView, mouse.x, mouse.y);
handleObjectClicked(_generalHelper.resolvePick(pickResult.objectHit),
mouse.modifiers & Qt.ControlModifier);

View File

@@ -41,6 +41,7 @@ DirectionalDraggable {
Model {
id: handle
readonly property bool _edit3dLocked: true // Make this non-pickable
source: "#Sphere"
materials: [ handleRoot.material ]
scale: Qt.vector3d(0.02, 0.02, 0.02)

View File

@@ -39,6 +39,7 @@ Node {
// Note: Only one instance of HelperGrid is supported, as the geometry names are fixed
Model { // Main grid lines
readonly property bool _edit3dLocked: true // Make this non-pickable
geometry: GridGeometry {
id: gridGeometry
name: "3D Edit View Helper Grid"
@@ -55,6 +56,7 @@ Node {
}
Model { // Subdivision lines
readonly property bool _edit3dLocked: true // Make this non-pickable
geometry: GridGeometry {
lines: gridGeometry.lines
step: gridGeometry.step
@@ -73,6 +75,7 @@ Node {
}
Model { // Z Axis
readonly property bool _edit3dLocked: true // Make this non-pickable
geometry: GridGeometry {
lines: gridGeometry.lines
step: gridGeometry.step
@@ -89,6 +92,7 @@ Node {
]
}
Model { // X Axis
readonly property bool _edit3dLocked: true // Make this non-pickable
eulerRotation.z: 90
geometry: GridGeometry {
lines: gridGeometry.lines

View File

@@ -33,6 +33,7 @@ Model {
property alias geometryName: lightGeometry.name // Name must be unique for each geometry
property alias geometryType: lightGeometry.lightType
property Material material
readonly property bool _edit3dLocked: true // Make this non-pickable
function updateGeometry()
{

View File

@@ -36,6 +36,7 @@ Node {
property alias color: lineMat.diffuseColor
Model {
readonly property bool _edit3dLocked: true // Make this non-pickable
geometry: LineGeometry {
id: lineGeometry
}

View File

@@ -52,6 +52,7 @@ View3D {
Model {
id: model
readonly property bool _edit3dLocked: true // Make this non-pickable
source: "#Sphere"
materials: previewMaterial
}

View File

@@ -82,6 +82,7 @@ View3D {
Model {
id: model
readonly property bool _edit3dLocked: true // Make this non-pickable
eulerRotation.y: 45
source: sourceModel.source

View File

@@ -40,6 +40,7 @@ Model {
property alias mouseArea: mouseArea
readonly property bool hovering: mouseArea.hovering
readonly property bool _edit3dLocked: true // Make this non-pickable
property vector3d _scenePosPressed
property vector2d _planePosPressed

View File

@@ -189,6 +189,7 @@ Node {
Model {
id: freeRotator
readonly property bool _edit3dLocked: true // Make this non-pickable
source: "#Sphere"
materials: DefaultMaterial {
id: material

View File

@@ -45,6 +45,7 @@ Model {
property vector3d _targetPosOnScreen
property vector3d _startRotation
property bool _trackBall
readonly property bool _edit3dLocked: true // Make this non-pickable
signal rotateCommit()
signal rotateChange()

View File

@@ -166,6 +166,7 @@ Node {
Model {
id: centerCube
readonly property bool _edit3dLocked: true // Make this non-pickable
source: "#Cube"
scale: Qt.vector3d(0.024, 0.024, 0.024)
materials: DefaultMaterial {

View File

@@ -39,6 +39,7 @@ DirectionalDraggable {
property vector3d _startScale
Model {
readonly property bool _edit3dLocked: true // Make this non-pickable
source: "#Cube"
y: 10
scale: Qt.vector3d(0.020, 0.020, 0.020)

View File

@@ -45,6 +45,7 @@ Node {
Model {
id: selectionBoxModel
readonly property bool _edit3dLocked: true // Make this non-pickable
geometry: selectionBoxGeometry
scale: selectionBox.targetNode ? selectionBox.targetNode.scale : Qt.vector3d(1, 1, 1)

View File

@@ -41,6 +41,7 @@ DirectionalDraggable {
Model {
id: handle
readonly property bool _edit3dLocked: true // Make this non-pickable
source: "#Sphere"
materials: [ handleRoot.material ]
scale: Qt.vector3d(0.02, 0.02, 0.02)

View File

@@ -267,6 +267,31 @@ void GeneralHelper::delayedPropertySet(QObject *obj, int delay, const QString &p
});
}
// Returns the first valid QQuick3DPickResult from view at (posX, PosY).
QQuick3DPickResult GeneralHelper::pickViewAt(QQuick3DViewport *view, float posX, float posY)
{
if (!view)
return QQuick3DPickResult();
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 1)
// Make sure global picking is on
view->setGlobalPickingEnabled(true);
// With Qt 6.2+, select first suitable result from all picked objects
auto pickResults = view->pickAll(posX, posY);
for (auto pickResult : pickResults) {
if (isPickable(pickResult.objectHit()))
return pickResult;
}
#else
// With older Qt version we'll just pick the single object
auto pickResult = view->pick(posX, posY);
if (isPickable(pickResult.objectHit()))
return pickResult;
#endif
return QQuick3DPickResult();
}
QQuick3DNode *GeneralHelper::resolvePick(QQuick3DNode *pickNode)
{
if (pickNode) {
@@ -315,6 +340,10 @@ bool GeneralHelper::isHidden(QQuick3DNode *node)
return false;
}
bool GeneralHelper::isPickable(QQuick3DNode *node) {
return (node && !isLocked(node) && !isHidden(node) && node->visible());
}
void GeneralHelper::storeToolState(const QString &sceneId, const QString &tool, const QVariant &state,
int delay)
{

View File

@@ -35,6 +35,7 @@
#include <QTimer>
#include <QVariant>
#include <QVector3D>
#include <QtQuick3D/private/qquick3dpickresult_p.h>
QT_BEGIN_NAMESPACE
class QQuick3DCamera;
@@ -74,12 +75,14 @@ public:
Q_INVOKABLE bool fuzzyCompare(double a, double b);
Q_INVOKABLE void delayedPropertySet(QObject *obj, int delay, const QString &property,
const QVariant& value);
Q_INVOKABLE QQuick3DPickResult pickViewAt(QQuick3DViewport *view, float posX, float posY);
Q_INVOKABLE QQuick3DNode *resolvePick(QQuick3DNode *pickNode);
Q_INVOKABLE void registerGizmoTarget(QQuick3DNode *node);
Q_INVOKABLE void unregisterGizmoTarget(QQuick3DNode *node);
Q_INVOKABLE bool isLocked(QQuick3DNode *node);
Q_INVOKABLE bool isHidden(QQuick3DNode *node);
Q_INVOKABLE bool isPickable(QQuick3DNode *node);
Q_INVOKABLE void storeToolState(const QString &sceneId, const QString &tool,
const QVariant &state, int delayEmit = 0);

View File

@@ -2047,8 +2047,10 @@ void Qt5InformationNodeInstanceServer::handleInstanceHidden(const ServerNodeInst
// as changes in the node tree (reparenting, adding new nodes) can make the previously set
// hide status based on ancestor unreliable.
node->setProperty("_edit3dHidden", edit3dHidden);
#if QT_VERSION < QT_VERSION_CHECK(6, 2, 1)
if (auto model = qobject_cast<QQuick3DModel *>(node))
model->setPickable(!edit3dHidden); // allow 3D objects to receive mouse clicks
#endif
const auto childItems = node->childItems();
for (auto childItem : childItems) {
const ServerNodeInstance quick3dInstance = getQuick3DInstanceAndHidden(childItem);
@@ -2070,7 +2072,9 @@ void Qt5InformationNodeInstanceServer::handleInstanceHidden(const ServerNodeInst
value = QVariant::fromValue(node);
// Specify the actual pick target with dynamic property
checkModel->setProperty("_pickTarget", value);
#if QT_VERSION < QT_VERSION_CHECK(6, 2, 1)
checkModel->setPickable(!edit3dHidden);
#endif
}
};
if (auto childNode = qobject_cast<QQuick3DNode *>(childItem))

View File

@@ -37,7 +37,6 @@
#include <addimportcontainer.h>
#include <createscenecommand.h>
#include <reparentinstancescommand.h>
#include <removeinstancescommand.h>
#include <clearscenecommand.h>
#include <QDebug>
@@ -194,32 +193,6 @@ QList<QQuickItem*> Qt5NodeInstanceServer::allItems() const
return QList<QQuickItem*>();
}
void Qt5NodeInstanceServer::markRepeaterParentDirty(qint32 id) const
{
if (!hasInstanceForId(id))
return;
ServerNodeInstance instance = instanceForId(id);
if (!instance.isValid())
return;
ServerNodeInstance parentInstance = instance.parent();
if (!parentInstance.isValid())
return;
// If a Repeater instance was moved/removed, the old parent must be marked dirty to rerender it
const QByteArray type("QQuickRepeater");
if (ServerNodeInstance::isSubclassOf(instance.internalObject(), type))
DesignerSupport::addDirty(parentInstance.rootQuickItem(), QQuickDesignerSupport::Content);
// Repeater's parent must also be dirtied when a child of a repeater was moved/removed.
if (ServerNodeInstance::isSubclassOf(parentInstance.internalObject(), type)) {
ServerNodeInstance parentsParent = parentInstance.parent();
if (parentsParent.isValid())
DesignerSupport::addDirty(parentsParent.rootQuickItem(), QQuickDesignerSupport::Content);
}
}
bool Qt5NodeInstanceServer::initRhi(RenderViewData &viewData)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@@ -550,23 +523,8 @@ void Qt5NodeInstanceServer::clearScene(const ClearSceneCommand &command)
void Qt5NodeInstanceServer::reparentInstances(const ReparentInstancesCommand &command)
{
const QVector<ReparentContainer> &containerVector = command.reparentInstances();
for (const ReparentContainer &container : containerVector)
markRepeaterParentDirty(container.instanceId());
NodeInstanceServer::reparentInstances(command.reparentInstances());
startRenderTimer();
}
void Qt5NodeInstanceServer::removeInstances(const RemoveInstancesCommand &command)
{
const QVector<qint32> &idVector = command.instanceIds();
for (const qint32 id : idVector)
markRepeaterParentDirty(id);
NodeInstanceServer::removeInstances(command);
startRenderTimer();
}
} // QmlDesigner

View File

@@ -67,7 +67,6 @@ public:
void createScene(const CreateSceneCommand &command) override;
void clearScene(const ClearSceneCommand &command) override;
void reparentInstances(const ReparentInstancesCommand &command) override;
void removeInstances(const RemoveInstancesCommand &command) override;
QImage grabWindow() override;
QImage grabItem(QQuickItem *item) override;
@@ -80,7 +79,6 @@ protected:
void resetAllItems();
void setupScene(const CreateSceneCommand &command) override;
QList<QQuickItem*> allItems() const;
void markRepeaterParentDirty(qint32 id) const;
struct RenderViewData {
QPointer<QQuickWindow> window = nullptr;

View File

@@ -777,6 +777,8 @@ void QuickItemNodeInstance::reparent(const ObjectNodeInstance::Pointer &oldParen
setMovable(true);
}
markRepeaterParentDirty();
ObjectNodeInstance::reparent(oldParentInstance, oldParentProperty, newParentInstance, newParentProperty);
if (!newParentInstance)
@@ -841,6 +843,8 @@ void QuickItemNodeInstance::setPropertyVariant(const PropertyName &name, const Q
if (name == "layer.enabled" || name == "layer.effect")
setAllNodesDirtyRecursive(quickItem());
markRepeaterParentDirty();
ObjectNodeInstance::setPropertyVariant(name, value);
refresh();
@@ -860,6 +864,8 @@ void QuickItemNodeInstance::setPropertyBinding(const PropertyName &name, const Q
if (name.startsWith("anchors.") && isRootNodeInstance())
return;
markRepeaterParentDirty();
ObjectNodeInstance::setPropertyBinding(name, expression);
refresh();
@@ -937,6 +943,8 @@ void QuickItemNodeInstance::resetProperty(const PropertyName &name)
resetVertical();
}
markRepeaterParentDirty();
ObjectNodeInstance::resetProperty(name);
if (isInLayoutable())
@@ -1013,6 +1021,35 @@ QQuickItem *QuickItemNodeInstance::quickItem() const
return static_cast<QQuickItem*>(object());
}
void QuickItemNodeInstance::markRepeaterParentDirty() const
{
const qint32 id = instanceId();
if (id <= 0 && !isValid())
return;
QQuickItem *item = quickItem();
if (!item)
return;
QQuickItem *parentItem = item->parentItem();
if (!parentItem)
return;
// If a Repeater instance was changed in any way, the parent must be marked dirty to rerender it
const QByteArray type("QQuickRepeater");
if (ServerNodeInstance::isSubclassOf(item, type))
DesignerSupport::addDirty(parentItem, QQuickDesignerSupport::Content);
// Repeater's parent must also be dirtied when a child of a repeater was changed
if (ServerNodeInstance::isSubclassOf(parentItem, type)) {
QQuickItem *parentsParent = parentItem->parentItem();
if (parentsParent)
DesignerSupport::addDirty(parentsParent, QQuickDesignerSupport::Content);
}
}
} // namespace Internal
} // namespace QmlDesigner

View File

@@ -130,6 +130,7 @@ protected:
double x() const;
double y() const;
bool checkIfRefFromEffect(qint32 id);
void markRepeaterParentDirty() const;
private: //variables
QPointer<QQuickItem> m_contentItem;

View File

@@ -234,6 +234,25 @@ bool isInPathList(const QStringList &pathList, const QString &componentPath)
});
}
bool canBeCreatedAsPrimitive(const QStringList &pathList,
const InstanceContainer &instanceContainer,
QQmlContext *context,
QObject *&object)
{
if (isInPathList(pathList, instanceContainer.componentPath())) {
object = Internal::ObjectNodeInstance::createPrimitive(QString::fromUtf8(
instanceContainer.type()),
instanceContainer.majorNumber(),
instanceContainer.minorNumber(),
context);
if (object)
return true;
}
return false;
}
ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceServer,
const InstanceContainer &instanceContainer,
ComponentWrap componentWrap)
@@ -249,8 +268,8 @@ ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceSe
if (object == nullptr)
nodeInstanceServer->sendDebugOutput(DebugOutputCommand::ErrorType, QLatin1String("Custom parser object could not be created."), instanceContainer.instanceId());
} else if (!instanceContainer.componentPath().isEmpty()
&& !isInPathList(nodeInstanceServer->engine()->importPathList(),
instanceContainer.componentPath())) {
&& !canBeCreatedAsPrimitive(nodeInstanceServer->engine()->importPathList(),
instanceContainer, nodeInstanceServer->context(), object)) {
object = Internal::ObjectNodeInstance::createComponent(instanceContainer.componentPath(), nodeInstanceServer->context());
if (object == nullptr) {
object = Internal::ObjectNodeInstance::createPrimitive(QString::fromUtf8(instanceContainer.type()), instanceContainer.majorNumber(), instanceContainer.minorNumber(), nodeInstanceServer->context());
@@ -260,7 +279,7 @@ ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceSe
nodeInstanceServer->sendDebugOutput(DebugOutputCommand::ErrorType, message + errors, instanceContainer.instanceId());
}
}
} else {
} else if (!object) {
object = Internal::ObjectNodeInstance::createPrimitive(QString::fromUtf8(instanceContainer.type()), instanceContainer.majorNumber(), instanceContainer.minorNumber(), nodeInstanceServer->context());
if (object == nullptr)
nodeInstanceServer->sendDebugOutput(DebugOutputCommand::ErrorType, QLatin1String("Item could not be created."), instanceContainer.instanceId());
@@ -498,7 +517,7 @@ QDebug operator <<(QDebug debug, const ServerNodeInstance &instance)
return debug.space();
}
uint qHash(const ServerNodeInstance &instance)
ServerNodeInstance::QHashValueType qHash(const ServerNodeInstance &instance)
{
return ::qHash(instance.instanceId());
}

View File

@@ -67,6 +67,13 @@ namespace Internal {
class ServerNodeInstance
{
public:
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
using QHashValueType = uint;
#else
using QHashValueType = size_t;
#endif
friend class NodeInstanceServer;
friend class Qt4NodeInstanceServer;
friend class Qt4PreviewNodeInstanceServer;
@@ -76,7 +83,7 @@ class ServerNodeInstance
friend class Qt5CapturePreviewNodeInstanceServer;
friend class Qt5TestNodeInstanceServer;
friend class QHash<qint32, ServerNodeInstance>;
friend uint qHash(const ServerNodeInstance &instance);
friend QHashValueType qHash(const ServerNodeInstance &instance);
friend bool operator==(const ServerNodeInstance &first, const ServerNodeInstance &second);
friend QDebug operator<<(QDebug debug, const ServerNodeInstance &instance);
friend class NodeMetaInfo;
@@ -220,7 +227,7 @@ private: // variables
QSharedPointer<Internal::ObjectNodeInstance> m_nodeInstance;
};
uint qHash(const ServerNodeInstance &instance);
ServerNodeInstance::QHashValueType qHash(const ServerNodeInstance &instance);
bool operator ==(const ServerNodeInstance &first, const ServerNodeInstance &second);
bool operator <(const ServerNodeInstance &first, const ServerNodeInstance &second);
QDebug operator <<(QDebug debug, const ServerNodeInstance &instance);