2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2020 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2019-11-13 11:16:55 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
2022-08-19 13:04:26 +03:00
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QMenu>
|
|
|
|
|
#include <QPointer>
|
2022-09-12 16:23:05 +03:00
|
|
|
#include <QVector3D>
|
2022-08-19 13:04:26 +03:00
|
|
|
#include <QWidget>
|
|
|
|
|
|
2020-03-12 15:55:30 +02:00
|
|
|
#include <coreplugin/icontext.h>
|
2022-08-25 12:27:41 +03:00
|
|
|
#include "itemlibraryinfo.h"
|
2022-08-19 13:04:26 +03:00
|
|
|
#include <modelnode.h>
|
2019-11-13 11:16:55 +01:00
|
|
|
|
|
|
|
|
namespace QmlDesigner {
|
|
|
|
|
|
2020-02-11 11:33:25 +02:00
|
|
|
class Edit3DView;
|
|
|
|
|
class Edit3DCanvas;
|
|
|
|
|
class ToolBox;
|
|
|
|
|
|
|
|
|
|
class Edit3DWidget : public QWidget
|
2019-11-13 11:16:55 +01:00
|
|
|
{
|
2020-02-11 11:33:25 +02:00
|
|
|
Q_OBJECT
|
2019-11-13 11:16:55 +01:00
|
|
|
|
|
|
|
|
public:
|
2020-02-11 11:33:25 +02:00
|
|
|
Edit3DWidget(Edit3DView *view);
|
2019-11-13 11:16:55 +01:00
|
|
|
|
2020-02-11 11:33:25 +02:00
|
|
|
Edit3DCanvas *canvas() const;
|
|
|
|
|
Edit3DView *view() const;
|
2020-03-12 15:55:30 +02:00
|
|
|
void contextHelp(const Core::IContext::HelpCallback &callback) const;
|
2019-11-13 11:16:55 +01:00
|
|
|
|
2020-03-19 13:05:36 +02:00
|
|
|
void showCanvas(bool show);
|
2022-01-21 17:15:01 +02:00
|
|
|
QMenu *visibilityTogglesMenu() const;
|
|
|
|
|
void showVisibilityTogglesMenu(bool show, const QPoint &pos);
|
2020-03-19 13:05:36 +02:00
|
|
|
|
2022-05-31 16:19:29 +03:00
|
|
|
QMenu *backgroundColorMenu() const;
|
|
|
|
|
void showBackgroundColorMenu(bool show, const QPoint &pos);
|
|
|
|
|
|
2022-09-12 16:23:05 +03:00
|
|
|
void showContextMenu(const QPoint &pos, const ModelNode &modelNode, const QVector3D &pos3d);
|
2022-08-26 17:45:11 +03:00
|
|
|
void updateCreateSubMenu(const QStringList &keys,
|
|
|
|
|
const QHash<QString, QList<ItemLibraryEntry>> &entriesMap);
|
2022-08-25 12:27:41 +03:00
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void onCreateAction();
|
2022-08-19 13:04:26 +03:00
|
|
|
|
2021-09-30 13:42:48 +03:00
|
|
|
protected:
|
|
|
|
|
void dragEnterEvent(QDragEnterEvent *dragEnterEvent) override;
|
|
|
|
|
void dropEvent(QDropEvent *dropEvent) override;
|
|
|
|
|
|
2019-11-13 11:16:55 +01:00
|
|
|
private:
|
2020-03-19 13:05:36 +02:00
|
|
|
void linkActivated(const QString &link);
|
2022-08-19 13:04:26 +03:00
|
|
|
void createContextMenu();
|
2020-03-19 13:05:36 +02:00
|
|
|
|
2022-10-31 18:47:24 +02:00
|
|
|
bool isPasteAvailable() const;
|
|
|
|
|
|
2020-02-11 11:33:25 +02:00
|
|
|
QPointer<Edit3DView> m_edit3DView;
|
|
|
|
|
QPointer<Edit3DView> m_view;
|
|
|
|
|
QPointer<Edit3DCanvas> m_canvas;
|
2020-03-19 13:05:36 +02:00
|
|
|
QPointer<QLabel> m_onboardingLabel;
|
2020-02-11 11:33:25 +02:00
|
|
|
QPointer<ToolBox> m_toolBox;
|
2020-03-12 15:55:30 +02:00
|
|
|
Core::IContext *m_context = nullptr;
|
2022-01-21 17:15:01 +02:00
|
|
|
QPointer<QMenu> m_visibilityTogglesMenu;
|
2022-05-31 16:19:29 +03:00
|
|
|
QPointer<QMenu> m_backgroundColorMenu;
|
2022-08-19 13:04:26 +03:00
|
|
|
QPointer<QMenu> m_contextMenu;
|
2022-11-01 17:31:52 +02:00
|
|
|
QPointer<QAction> m_editComponentAction;
|
2022-08-19 13:04:26 +03:00
|
|
|
QPointer<QAction> m_editMaterialAction;
|
2022-10-28 18:13:05 +03:00
|
|
|
QPointer<QAction> m_copyAction;
|
2022-10-31 18:47:24 +02:00
|
|
|
QPointer<QAction> m_pasteAction;
|
|
|
|
|
QPointer<QAction> m_deleteAction;
|
2022-11-08 10:54:45 +02:00
|
|
|
QPointer<QAction> m_fitSelectedAction;
|
2022-11-01 11:51:25 +02:00
|
|
|
QPointer<QAction> m_alignCameraAction;
|
|
|
|
|
QPointer<QAction> m_alignViewAction;
|
2022-08-25 12:27:41 +03:00
|
|
|
QPointer<QMenu> m_createSubMenu;
|
2022-08-19 13:04:26 +03:00
|
|
|
ModelNode m_contextMenuTarget;
|
2022-09-12 16:23:05 +03:00
|
|
|
QVector3D m_contextMenuPos3d;
|
2022-08-25 12:27:41 +03:00
|
|
|
QHash<QString, ItemLibraryEntry> m_nameToEntry;
|
2019-11-13 11:16:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace QmlDesigner
|