2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-05-12 16:22:51 +02:00
|
|
|
**
|
2016-01-15 14:59:14 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2011-05-12 16:22:51 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-05-12 16:22:51 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2016-01-15 14:59:14 +01:00
|
|
|
** 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.
|
2011-05-12 16:22:51 +02:00
|
|
|
**
|
2015-09-18 11:34:48 +02:00
|
|
|
** GNU General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
2016-01-15 14:59:14 +01:00
|
|
|
** 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.
|
2011-05-12 16:22:51 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2011-05-12 16:22:51 +02:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2011-06-09 15:50:48 +02:00
|
|
|
|
|
|
|
#include <QtGlobal>
|
2020-11-23 17:47:07 +02:00
|
|
|
#include <QtQuick/qquickwindow.h>
|
2011-05-12 16:22:51 +02:00
|
|
|
|
|
|
|
#include "nodeinstanceserver.h"
|
2015-07-14 12:06:07 +02:00
|
|
|
#include <designersupportdelegate.h>
|
2011-05-12 16:22:51 +02:00
|
|
|
|
2011-06-09 15:50:48 +02:00
|
|
|
QT_BEGIN_NAMESPACE
|
2012-09-19 15:57:22 +02:00
|
|
|
class QQuickItem;
|
2020-11-23 17:47:07 +02:00
|
|
|
class QQmlEngine;
|
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
|
|
class QQuickRenderControl;
|
|
|
|
class QRhi;
|
|
|
|
class QRhiTexture;
|
|
|
|
class QRhiRenderBuffer;
|
|
|
|
class QRhiTextureRenderTarget;
|
|
|
|
class QRhiRenderPassDescriptor;
|
|
|
|
#endif
|
2011-06-09 15:50:48 +02:00
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
2011-05-12 16:22:51 +02:00
|
|
|
namespace QmlDesigner {
|
|
|
|
|
2011-06-09 15:50:48 +02:00
|
|
|
class Qt5NodeInstanceServer : public NodeInstanceServer
|
2011-05-12 16:22:51 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2011-06-09 15:50:48 +02:00
|
|
|
Qt5NodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient);
|
2018-05-07 14:56:23 +02:00
|
|
|
~Qt5NodeInstanceServer() override;
|
2011-06-09 15:50:48 +02:00
|
|
|
|
2015-06-03 15:34:34 +02:00
|
|
|
QQuickView *quickView() const override;
|
2020-11-23 17:47:07 +02:00
|
|
|
QQuickWindow *quickWindow() const override;
|
2015-06-03 15:34:34 +02:00
|
|
|
QQmlView *declarativeView() const override;
|
2020-11-23 17:47:07 +02:00
|
|
|
QQuickItem *rootItem() const override;
|
|
|
|
void setRootItem(QQuickItem *item) override;
|
|
|
|
|
2015-06-03 15:34:34 +02:00
|
|
|
QQmlEngine *engine() const override;
|
|
|
|
void refreshBindings() override;
|
2011-06-09 15:50:48 +02:00
|
|
|
|
2014-10-16 13:56:47 +02:00
|
|
|
DesignerSupport *designerSupport();
|
2011-05-12 16:22:51 +02:00
|
|
|
|
2015-06-03 15:34:34 +02:00
|
|
|
void createScene(const CreateSceneCommand &command) override;
|
|
|
|
void clearScene(const ClearSceneCommand &command) override;
|
|
|
|
void reparentInstances(const ReparentInstancesCommand &command) override;
|
2011-05-12 16:22:51 +02:00
|
|
|
|
2020-11-23 17:47:07 +02:00
|
|
|
QImage grabWindow() override;
|
2021-08-25 14:50:18 +03:00
|
|
|
QImage grabItem(QQuickItem *item) override;
|
2022-02-02 17:56:16 +02:00
|
|
|
bool renderWindow() override;
|
2020-11-23 17:47:07 +02:00
|
|
|
|
2021-08-26 15:47:56 +02:00
|
|
|
static QQuickItem *parentEffectItem(QQuickItem *item);
|
|
|
|
|
2011-05-12 16:22:51 +02:00
|
|
|
protected:
|
2015-06-03 15:34:34 +02:00
|
|
|
void initializeView() override;
|
2020-11-23 17:47:07 +02:00
|
|
|
void resizeCanvasToRootItem() override;
|
2011-06-09 15:50:48 +02:00
|
|
|
void resetAllItems();
|
2015-06-03 15:34:34 +02:00
|
|
|
void setupScene(const CreateSceneCommand &command) override;
|
2012-09-19 15:57:22 +02:00
|
|
|
QList<QQuickItem*> allItems() const;
|
2022-05-16 16:01:16 +03:00
|
|
|
bool rootIsRenderable3DObject() const;
|
2011-05-12 16:22:51 +02:00
|
|
|
|
2020-11-23 17:47:07 +02:00
|
|
|
struct RenderViewData {
|
|
|
|
QPointer<QQuickWindow> window = nullptr;
|
|
|
|
QQuickItem *rootItem = nullptr;
|
|
|
|
QQuickItem *contentItem = nullptr;
|
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
|
|
bool bufferDirty = true;
|
|
|
|
QQuickRenderControl *renderControl = nullptr;
|
|
|
|
QRhi *rhi = nullptr;
|
|
|
|
QRhiTexture *texture = nullptr;
|
|
|
|
QRhiRenderBuffer *buffer = nullptr;
|
|
|
|
QRhiTextureRenderTarget *texTarget = nullptr;
|
|
|
|
QRhiRenderPassDescriptor *rpDesc = nullptr;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
virtual bool initRhi(RenderViewData &viewData);
|
|
|
|
virtual QImage grabRenderControl(RenderViewData &viewData);
|
|
|
|
|
2011-05-12 16:22:51 +02:00
|
|
|
private:
|
2020-11-23 17:47:07 +02:00
|
|
|
RenderViewData m_viewData;
|
2014-10-16 13:56:47 +02:00
|
|
|
DesignerSupport m_designerSupport;
|
2020-11-23 17:47:07 +02:00
|
|
|
QQmlEngine *m_qmlEngine = nullptr;
|
2011-05-12 16:22:51 +02:00
|
|
|
};
|
|
|
|
|
2011-06-09 15:50:48 +02:00
|
|
|
} // QmlDesigner
|