forked from qt-creator/qt-creator
QmlDesigner: Unify add QtQuick3D links
Fixes: QDS-14876 Change-Id: I6b3eaba09807d67c02dc895eb596d5bdce87f70f Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -109,29 +109,35 @@ HelperWidgets.ScrollView {
|
|||||||
id: infoText
|
id: infoText
|
||||||
|
|
||||||
text: {
|
text: {
|
||||||
if (!ContentLibraryBackend.rootView.isQt6Project)
|
if (!ContentLibraryBackend.rootView.isQt6Project) {
|
||||||
qsTr("<b>Content Library</b> effects are not supported in Qt5 projects.")
|
qsTr("<b>Content Library</b> effects are not supported in Qt5 projects.")
|
||||||
else if (!ContentLibraryBackend.rootView.hasQuick3DImport)
|
} else if (!ContentLibraryBackend.rootView.hasQuick3DImport) {
|
||||||
qsTr('To use <b>Content Library</b>, first <a href="#add_import" style="text-decoration:none;color:%1">
|
qsTr('To use <b>Content Library</b> effects, add the <b>QtQuick3D</b> module and the <b>View3D</b>
|
||||||
add the QtQuick3D module</a> in the <b>Components</b> view.')
|
component in the <b>Components</b> view, or click
|
||||||
.arg(StudioTheme.Values.themeInteraction)
|
<a href=\"#add_import\"><span style=\"text-decoration:none;color:%1\">
|
||||||
else if (!ContentLibraryBackend.effectsModel.hasRequiredQuick3DImport)
|
here</span></a>.').arg(StudioTheme.Values.themeInteraction)
|
||||||
|
} else if (!ContentLibraryBackend.effectsModel.hasRequiredQuick3DImport) {
|
||||||
qsTr("To use <b>Content Library</b>, version 6.4 or later of the QtQuick3D module is required.")
|
qsTr("To use <b>Content Library</b>, version 6.4 or later of the QtQuick3D module is required.")
|
||||||
else if (!ContentLibraryBackend.rootView.hasMaterialLibrary)
|
} else if (!ContentLibraryBackend.rootView.hasMaterialLibrary) {
|
||||||
qsTr("<b>Content Library</b> is disabled inside a non-visual component.")
|
qsTr("<b>Content Library</b> is disabled inside a non-visual component.")
|
||||||
else if (!ContentLibraryBackend.effectsModel.bundleExists)
|
} else if (!ContentLibraryBackend.effectsModel.bundleExists) {
|
||||||
qsTr("No effects available.")
|
qsTr("No effects available.")
|
||||||
else if (!searchBox.isEmpty())
|
} else if (!searchBox.isEmpty()) {
|
||||||
qsTr("No match found.")
|
qsTr("No match found.")
|
||||||
else
|
} else {
|
||||||
""
|
""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
color: StudioTheme.Values.themeTextColor
|
color: StudioTheme.Values.themeTextColor
|
||||||
font.pixelSize: StudioTheme.Values.baseFontSize
|
font.pixelSize: StudioTheme.Values.baseFontSize
|
||||||
topPadding: 10
|
topPadding: 10
|
||||||
leftPadding: 10
|
leftPadding: 10
|
||||||
|
rightPadding: 10
|
||||||
visible: ContentLibraryBackend.effectsModel.isEmpty
|
visible: ContentLibraryBackend.effectsModel.isEmpty
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
width: root.width
|
||||||
|
|
||||||
onLinkActivated: ContentLibraryBackend.rootView.addQtQuick3D()
|
onLinkActivated: ContentLibraryBackend.rootView.addQtQuick3D()
|
||||||
}
|
}
|
||||||
|
@@ -114,30 +114,34 @@ HelperWidgets.ScrollView {
|
|||||||
id: infoText
|
id: infoText
|
||||||
|
|
||||||
text: {
|
text: {
|
||||||
if (!ContentLibraryBackend.rootView.isQt6Project)
|
if (!ContentLibraryBackend.rootView.isQt6Project) {
|
||||||
qsTr("<b>Content Library</b> materials are not supported in Qt5 projects.")
|
qsTr("<b>Content Library</b> materials are not supported in Qt5 projects.")
|
||||||
else if (!ContentLibraryBackend.rootView.hasQuick3DImport)
|
} else if (!ContentLibraryBackend.rootView.hasQuick3DImport) {
|
||||||
qsTr('To use <b>Content Library</b>, first <a href="#add_import" style="text-decoration:none;color:%1">
|
qsTr('To use <b>Content Library</b> materials, add the <b>QtQuick3D</b> module and the <b>View3D</b>
|
||||||
add the QtQuick3D module</a> in the <b>Components</b> view.')
|
component in the <b>Components</b> view, or click
|
||||||
.arg(StudioTheme.Values.themeInteraction)
|
<a href=\"#add_import\"><span style=\"text-decoration:none;color:%1\">
|
||||||
else if (!root.materialsModel.hasRequiredQuick3DImport)
|
here</span></a>.').arg(StudioTheme.Values.themeInteraction)
|
||||||
|
} else if (!root.materialsModel.hasRequiredQuick3DImport) {
|
||||||
qsTr("To use <b>Content Library</b>, version 6.3 or later of the QtQuick3D module is required.")
|
qsTr("To use <b>Content Library</b>, version 6.3 or later of the QtQuick3D module is required.")
|
||||||
else if (!ContentLibraryBackend.rootView.hasMaterialLibrary)
|
} else if (!ContentLibraryBackend.rootView.hasMaterialLibrary) {
|
||||||
qsTr("<b>Content Library</b> is disabled inside a non-visual component.")
|
qsTr("<b>Content Library</b> is disabled inside a non-visual component.")
|
||||||
else if (!root.materialsModel.bundleExists)
|
} else if (!root.materialsModel.bundleExists) {
|
||||||
qsTr("No materials available. Make sure you have an internet connection.")
|
qsTr("No materials available. Make sure you have an internet connection.")
|
||||||
else if (!searchBox.isEmpty())
|
} else if (!searchBox.isEmpty()) {
|
||||||
qsTr("No match found.")
|
qsTr("No match found.")
|
||||||
else
|
} else {
|
||||||
""
|
""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
color: StudioTheme.Values.themeTextColor
|
color: StudioTheme.Values.themeTextColor
|
||||||
font.pixelSize: StudioTheme.Values.baseFontSize
|
font.pixelSize: StudioTheme.Values.baseFontSize
|
||||||
topPadding: 10
|
topPadding: 10
|
||||||
leftPadding: 10
|
leftPadding: 10
|
||||||
|
rightPadding: 10
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
width: root.width - x
|
width: root.width - x
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
|
||||||
onLinkActivated: ContentLibraryBackend.rootView.addQtQuick3D()
|
onLinkActivated: ContentLibraryBackend.rootView.addQtQuick3D()
|
||||||
}
|
}
|
||||||
|
@@ -213,26 +213,33 @@ Item {
|
|||||||
text: {
|
text: {
|
||||||
let categoryName = (categoryTitle === "3D") ? categoryTitle + " assets"
|
let categoryName = (categoryTitle === "3D") ? categoryTitle + " assets"
|
||||||
: categoryTitle.toLowerCase()
|
: categoryTitle.toLowerCase()
|
||||||
if (!ContentLibraryBackend.rootView.isQt6Project)
|
if (!ContentLibraryBackend.rootView.isQt6Project) {
|
||||||
qsTr("<b>Content Library</b> is not supported in Qt5 projects.")
|
qsTr("<b>Content Library</b> is not supported in Qt5 projects.")
|
||||||
else if (!ContentLibraryBackend.rootView.hasQuick3DImport && categoryTitle !== "Textures")
|
} else if (!ContentLibraryBackend.rootView.hasQuick3DImport && categoryTitle !== "Textures") {
|
||||||
qsTr(`To use %1, first <a href="#add_import" style="text-decoration:none;color:%2">
|
qsTr('To use %1, add the <b>QtQuick3D</b> module and the <b>View3D</b>
|
||||||
add the <b>QtQuick3D</b> module</a> in the <b>Components</b> view.`)
|
component in the <b>Components</b> view, or click
|
||||||
.arg(categoryName)
|
<a href=\"#add_import\"><span style=\"text-decoration:none;color:%2\">
|
||||||
.arg(StudioTheme.Values.themeInteraction)
|
here</span></a>.')
|
||||||
else if (!ContentLibraryBackend.rootView.hasMaterialLibrary && categoryTitle !== "Textures")
|
.arg(categoryName)
|
||||||
|
.arg(StudioTheme.Values.themeInteraction)
|
||||||
|
} else if (!ContentLibraryBackend.rootView.hasMaterialLibrary && categoryTitle !== "Textures") {
|
||||||
qsTr("<b>Content Library</b> is disabled inside a non-visual component.")
|
qsTr("<b>Content Library</b> is disabled inside a non-visual component.")
|
||||||
else if (categoryEmpty)
|
} else if (categoryEmpty) {
|
||||||
qsTr("There are no "+ categoryName + " in the <b>User Assets</b>.")
|
qsTr("There are no "+ categoryName + " in the <b>User Assets</b>.")
|
||||||
else
|
} else {
|
||||||
""
|
""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
color: StudioTheme.Values.themeTextColor
|
color: StudioTheme.Values.themeTextColor
|
||||||
font.pixelSize: StudioTheme.Values.baseFontSize
|
font.pixelSize: StudioTheme.Values.baseFontSize
|
||||||
topPadding: 10
|
topPadding: 10
|
||||||
leftPadding: 10
|
leftPadding: 10
|
||||||
|
rightPadding: 10
|
||||||
visible: infoText.text !== ""
|
visible: infoText.text !== ""
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
width: root.width
|
||||||
|
|
||||||
onLinkActivated: ContentLibraryBackend.rootView.addQtQuick3D()
|
onLinkActivated: ContentLibraryBackend.rootView.addQtQuick3D()
|
||||||
}
|
}
|
||||||
|
@@ -596,14 +596,18 @@ Item {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
||||||
text: {
|
text: {
|
||||||
if (!materialBrowserModel.isQt6Project)
|
if (!materialBrowserModel.isQt6Project) {
|
||||||
qsTr("<b>Material Browser</b> is not supported in Qt5 projects.")
|
qsTr("<b>Material Browser</b> is not supported in Qt5 projects.")
|
||||||
else if (!materialBrowserModel.hasQuick3DImport)
|
} else if (!materialBrowserModel.hasQuick3DImport) {
|
||||||
qsTr("To use <b>Material Browser</b>, first add the QtQuick3D module in the <b>Components</b> view.")
|
qsTr('To use the <b>Material Browser</b>, add the <b>QtQuick3D</b> module and the <b>View3D</b>
|
||||||
else if (!materialBrowserModel.hasMaterialLibrary)
|
component in the <b>Components</b> view, or click
|
||||||
|
<a href=\"#add_import\"><span style=\"text-decoration:none;color:%1\">
|
||||||
|
here</span></a>.').arg(StudioTheme.Values.themeInteraction)
|
||||||
|
} else if (!materialBrowserModel.hasMaterialLibrary) {
|
||||||
qsTr("<b>Material Browser</b> is disabled inside a non-visual component.")
|
qsTr("<b>Material Browser</b> is disabled inside a non-visual component.")
|
||||||
else
|
} else {
|
||||||
""
|
""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
@@ -611,6 +615,8 @@ Item {
|
|||||||
font.pixelSize: StudioTheme.Values.mediumFontSize
|
font.pixelSize: StudioTheme.Values.mediumFontSize
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
|
|
||||||
|
onLinkActivated: rootView.addQtQuick3D()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -184,6 +184,7 @@ Edit3DWidget::Edit3DWidget(Edit3DView *view)
|
|||||||
// Onboarding label contains instructions for new users how to get 3D content into the project
|
// Onboarding label contains instructions for new users how to get 3D content into the project
|
||||||
m_onboardingLabel = new QLabel(this);
|
m_onboardingLabel = new QLabel(this);
|
||||||
m_onboardingLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
m_onboardingLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||||
|
m_onboardingLabel->setWordWrap(true);
|
||||||
connect(m_onboardingLabel, &QLabel::linkActivated, this, &Edit3DWidget::linkActivated);
|
connect(m_onboardingLabel, &QLabel::linkActivated, this, &Edit3DWidget::linkActivated);
|
||||||
fillLayout->addWidget(m_onboardingLabel.data());
|
fillLayout->addWidget(m_onboardingLabel.data());
|
||||||
|
|
||||||
@@ -418,19 +419,11 @@ void Edit3DWidget::showOnboardingLabel()
|
|||||||
if (text.isEmpty()) {
|
if (text.isEmpty()) {
|
||||||
if (m_view->externalDependencies().isQt6Project()) {
|
if (m_view->externalDependencies().isQt6Project()) {
|
||||||
QString labelText =
|
QString labelText =
|
||||||
tr("Your file does not import Qt Quick 3D.<br><br>"
|
tr("To use the <b>3D</b> view, add the <b>QtQuick3D</b> module and the <b>View3D</b>"
|
||||||
"To create a 3D view, add the"
|
" component in the <b>Components</b> view or click"
|
||||||
" <b>QtQuick3D</b>"
|
|
||||||
" module in the"
|
|
||||||
" <b>Components</b>"
|
|
||||||
" view or click"
|
|
||||||
" <a href=\"#add_import\"><span style=\"text-decoration:none;color:%1\">here</span></a>"
|
" <a href=\"#add_import\"><span style=\"text-decoration:none;color:%1\">here</span></a>"
|
||||||
".<br><br>"
|
".<br><br>"
|
||||||
"To import 3D assets, select"
|
"To import 3D assets, select <b>+</b> in the <b>Assets</b> view.");
|
||||||
" <b>+</b>"
|
|
||||||
" in the"
|
|
||||||
" <b>Assets</b>"
|
|
||||||
" view.");
|
|
||||||
text = labelText.arg(Utils::creatorColor(Utils::Theme::TextColorLink).name());
|
text = labelText.arg(Utils::creatorColor(Utils::Theme::TextColorLink).name());
|
||||||
} else {
|
} else {
|
||||||
text = tr("3D view is not supported in Qt5 projects.");
|
text = tr("3D view is not supported in Qt5 projects.");
|
||||||
|
@@ -18,6 +18,7 @@
|
|||||||
#include <qmldesignerplugin.h>
|
#include <qmldesignerplugin.h>
|
||||||
#include <studioquickwidget.h>
|
#include <studioquickwidget.h>
|
||||||
#include <theme.h>
|
#include <theme.h>
|
||||||
|
#include <utils3d.h>
|
||||||
#include <variantproperty.h>
|
#include <variantproperty.h>
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
@@ -389,6 +390,11 @@ void MaterialBrowserWidget::exportMaterial()
|
|||||||
m_bundleHelper->exportBundle({mat}, m_previewImageProvider->getPixmap(mat));
|
m_bundleHelper->exportBundle({mat}, m_previewImageProvider->getPixmap(mat));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MaterialBrowserWidget::addQtQuick3D()
|
||||||
|
{
|
||||||
|
Utils3D::addQuick3DImportAndView3D(m_materialBrowserView.data());
|
||||||
|
}
|
||||||
|
|
||||||
QString MaterialBrowserWidget::qmlSourcesPath()
|
QString MaterialBrowserWidget::qmlSourcesPath()
|
||||||
{
|
{
|
||||||
#ifdef SHARE_QML_PATH
|
#ifdef SHARE_QML_PATH
|
||||||
|
@@ -66,6 +66,7 @@ public:
|
|||||||
Q_INVOKABLE void addMaterialToContentLibrary();
|
Q_INVOKABLE void addMaterialToContentLibrary();
|
||||||
Q_INVOKABLE void importMaterial();
|
Q_INVOKABLE void importMaterial();
|
||||||
Q_INVOKABLE void exportMaterial();
|
Q_INVOKABLE void exportMaterial();
|
||||||
|
Q_INVOKABLE void addQtQuick3D();
|
||||||
|
|
||||||
StudioQuickWidget *quickWidget() const;
|
StudioQuickWidget *quickWidget() const;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user