aboutsummaryrefslogtreecommitdiffstats
path: root/share/qtcreator/qml/qmlpuppet/commands
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2020-09-10 16:02:31 +0300
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2020-09-16 07:00:06 +0000
commit90d9cb36f3ae756fe08ddfbf74756ada62df6918 (patch)
tree9b277ed53e957412923756eadb3c7530a44b23f9 /share/qtcreator/qml/qmlpuppet/commands
parentf849bd110552571f985ae691677d7c44b8affd82 (diff)
QmlDesigner: Add navigator preview tooltip for materials
Request 3D preview image for material instances from puppet to show on tooltip. Support for effect previews is also done, but handler for it is not registered, as effects cannot be shared between windows due to issue QTBUG-86616. Also refactored the preview image support out of navigator to make it more accessible by other components. Change-Id: Ie08ba218f929660c2e43d39578997a5a1a883efd Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'share/qtcreator/qml/qmlpuppet/commands')
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/commands.pri6
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/puppettocreatorcommand.h2
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/requestmodelnodepreviewimagecommand.cpp73
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/requestmodelnodepreviewimagecommand.h60
4 files changed, 138 insertions, 3 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/commands/commands.pri b/share/qtcreator/qml/qmlpuppet/commands/commands.pri
index 680abb2744..270c326a33 100644
--- a/share/qtcreator/qml/qmlpuppet/commands/commands.pri
+++ b/share/qtcreator/qml/qmlpuppet/commands/commands.pri
@@ -34,7 +34,8 @@ HEADERS += $$PWD/synchronizecommand.h \ \
$$PWD/update3dviewstatecommand.h \
$$PWD/puppettocreatorcommand.h \
$$PWD/inputeventcommand.h \
- $$PWD/view3dactioncommand.h
+ $$PWD/view3dactioncommand.h \
+ $$PWD/requestmodelnodepreviewimagecommand.h
SOURCES += $$PWD/synchronizecommand.cpp \
$$PWD/changepreviewimagesizecommand.cpp \
@@ -68,4 +69,5 @@ SOURCES += $$PWD/synchronizecommand.cpp \
$$PWD/update3dviewstatecommand.cpp \
$$PWD/puppettocreatorcommand.cpp \
$$PWD/inputeventcommand.cpp \
- $$PWD/view3dactioncommand.cpp
+ $$PWD/view3dactioncommand.cpp \
+ $$PWD/requestmodelnodepreviewimagecommand.cpp
diff --git a/share/qtcreator/qml/qmlpuppet/commands/puppettocreatorcommand.h b/share/qtcreator/qml/qmlpuppet/commands/puppettocreatorcommand.h
index a713656bde..dc125d4ead 100644
--- a/share/qtcreator/qml/qmlpuppet/commands/puppettocreatorcommand.h
+++ b/share/qtcreator/qml/qmlpuppet/commands/puppettocreatorcommand.h
@@ -34,7 +34,7 @@ namespace QmlDesigner {
class PuppetToCreatorCommand
{
public:
- enum Type { Edit3DToolState, Render3DView, ActiveSceneChanged, None };
+ enum Type { Edit3DToolState, Render3DView, ActiveSceneChanged, RenderModelNodePreviewImage, None };
PuppetToCreatorCommand(Type type, const QVariant &data);
PuppetToCreatorCommand() = default;
diff --git a/share/qtcreator/qml/qmlpuppet/commands/requestmodelnodepreviewimagecommand.cpp b/share/qtcreator/qml/qmlpuppet/commands/requestmodelnodepreviewimagecommand.cpp
new file mode 100644
index 0000000000..c29ec216c8
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/commands/requestmodelnodepreviewimagecommand.cpp
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 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.
+**
+****************************************************************************/
+
+#include "requestmodelnodepreviewimagecommand.h"
+
+#include <QDataStream>
+#include <QDebug>
+
+namespace QmlDesigner {
+
+RequestModelNodePreviewImageCommand::RequestModelNodePreviewImageCommand() = default;
+
+RequestModelNodePreviewImageCommand::RequestModelNodePreviewImageCommand(qint32 id, const QSize &size)
+ : m_instanceId(id)
+ , m_size(size)
+{
+}
+
+qint32 RequestModelNodePreviewImageCommand::instanceId() const
+{
+ return m_instanceId;
+}
+
+QSize QmlDesigner::RequestModelNodePreviewImageCommand::size() const
+{
+ return m_size;
+}
+
+QDataStream &operator<<(QDataStream &out, const RequestModelNodePreviewImageCommand &command)
+{
+ out << int(command.instanceId());
+ out << command.size();
+
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, RequestModelNodePreviewImageCommand &command)
+{
+ in >> command.m_instanceId;
+ in >> command.m_size;
+ return in;
+}
+
+QDebug operator <<(QDebug debug, const RequestModelNodePreviewImageCommand &command)
+{
+ return debug.nospace() << "RequestModelNodePreviewImageCommand("
+ << "instanceId: " << command.instanceId() << ", "
+ << "size: " << command.size() << ")";
+}
+
+} // namespace QmlDesigner
diff --git a/share/qtcreator/qml/qmlpuppet/commands/requestmodelnodepreviewimagecommand.h b/share/qtcreator/qml/qmlpuppet/commands/requestmodelnodepreviewimagecommand.h
new file mode 100644
index 0000000000..f18055695b
--- /dev/null
+++ b/share/qtcreator/qml/qmlpuppet/commands/requestmodelnodepreviewimagecommand.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 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.
+**
+****************************************************************************/
+
+#pragma once
+
+#include <QtCore/qmetatype.h>
+#include <QtCore/qdatastream.h>
+#include <QtGui/qevent.h>
+
+#include "instancecontainer.h"
+
+namespace QmlDesigner {
+
+class RequestModelNodePreviewImageCommand
+{
+ friend QDataStream &operator>>(QDataStream &in, RequestModelNodePreviewImageCommand &command);
+ friend QDebug operator <<(QDebug debug, const RequestModelNodePreviewImageCommand &command);
+
+public:
+ RequestModelNodePreviewImageCommand();
+ explicit RequestModelNodePreviewImageCommand(qint32 id, const QSize &size);
+
+ qint32 instanceId() const;
+ QSize size() const;
+
+private:
+ qint32 m_instanceId;
+ QSize m_size;
+};
+
+QDataStream &operator<<(QDataStream &out, const RequestModelNodePreviewImageCommand &command);
+QDataStream &operator>>(QDataStream &in, RequestModelNodePreviewImageCommand &command);
+
+QDebug operator <<(QDebug debug, const RequestModelNodePreviewImageCommand &command);
+
+} // namespace QmlDesigner
+
+Q_DECLARE_METATYPE(QmlDesigner::RequestModelNodePreviewImageCommand)