QmlDesigner: Don't allow add QtQuick3D import for MCU project

Don't show the normal onboarding label on 3D view if current project
is a MCU project that doesn't support QtQuick3D.

Fixes: QDS-10012
Change-Id: Iaa309efac3a5b2c0f2fce2e5e96c9012eaf6750d
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2023-06-02 13:41:38 +03:00
parent 8654afc4d6
commit 85739119af
2 changed files with 25 additions and 1 deletions

View File

@@ -21,6 +21,7 @@
#include <auxiliarydataproperties.h>
#include <designeractionmanager.h>
#include <designermcumanager.h>
#include <import.h>
#include <nodeinstanceview.h>
#include <seekerslider.h>
@@ -167,6 +168,11 @@ Edit3DWidget::Edit3DWidget(Edit3DView *view)
createContextMenu();
m_mcuLabel = new QLabel(this);
m_mcuLabel->setText(tr("MCU project does not support Qt Quick 3D."));
m_mcuLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
fillLayout->addWidget(m_mcuLabel.data());
// Onboarding label contains instructions for new users how to get 3D content into the project
m_onboardingLabel = new QLabel(this);
QString labelText =
@@ -413,7 +419,24 @@ void Edit3DWidget::showCanvas(bool show)
m_canvas->updateRenderImage(emptyImage);
}
m_canvas->setVisible(show);
m_onboardingLabel->setVisible(!show);
if (show) {
m_onboardingLabel->setVisible(false);
m_mcuLabel->setVisible(false);
} else {
bool quick3dAllowed = true;
const DesignerMcuManager &mcuManager = DesignerMcuManager::instance();
if (mcuManager.isMCUProject()) {
const QStringList mcuAllowedList = mcuManager.allowedImports();
if (!mcuAllowedList.contains("QtQuick3d"))
quick3dAllowed = false;
}
m_onboardingLabel->setVisible(quick3dAllowed);
m_mcuLabel->setVisible(!quick3dAllowed);
}
}
QMenu *Edit3DWidget::visibilityTogglesMenu() const

View File

@@ -70,6 +70,7 @@ private:
QPointer<Edit3DView> m_view;
QPointer<Edit3DCanvas> m_canvas;
QPointer<QLabel> m_onboardingLabel;
QPointer<QLabel> m_mcuLabel;
QPointer<ToolBox> m_toolBox;
Core::IContext *m_context = nullptr;
QPointer<QMenu> m_visibilityTogglesMenu;