diff --git a/share/qtcreator/qmldesigner/contentLibraryQmlSource/ContentLibraryEffectsView.qml b/share/qtcreator/qmldesigner/contentLibraryQmlSource/ContentLibraryEffectsView.qml index ca8650d116a..87777c04463 100644 --- a/share/qtcreator/qmldesigner/contentLibraryQmlSource/ContentLibraryEffectsView.qml +++ b/share/qtcreator/qmldesigner/contentLibraryQmlSource/ContentLibraryEffectsView.qml @@ -109,29 +109,35 @@ HelperWidgets.ScrollView { id: infoText text: { - if (!ContentLibraryBackend.rootView.isQt6Project) + if (!ContentLibraryBackend.rootView.isQt6Project) { qsTr("Content Library effects are not supported in Qt5 projects.") - else if (!ContentLibraryBackend.rootView.hasQuick3DImport) - qsTr('To use Content Library, first - add the QtQuick3D module in the Components view.') - .arg(StudioTheme.Values.themeInteraction) - else if (!ContentLibraryBackend.effectsModel.hasRequiredQuick3DImport) + } else if (!ContentLibraryBackend.rootView.hasQuick3DImport) { + qsTr('To use Content Library effects, add the QtQuick3D module and the View3D + component in the Components view, or click + + here.').arg(StudioTheme.Values.themeInteraction) + } else if (!ContentLibraryBackend.effectsModel.hasRequiredQuick3DImport) { qsTr("To use Content Library, version 6.4 or later of the QtQuick3D module is required.") - else if (!ContentLibraryBackend.rootView.hasMaterialLibrary) + } else if (!ContentLibraryBackend.rootView.hasMaterialLibrary) { qsTr("Content Library is disabled inside a non-visual component.") - else if (!ContentLibraryBackend.effectsModel.bundleExists) + } else if (!ContentLibraryBackend.effectsModel.bundleExists) { qsTr("No effects available.") - else if (!searchBox.isEmpty()) + } else if (!searchBox.isEmpty()) { qsTr("No match found.") - else + } else { "" + } } textFormat: Text.RichText color: StudioTheme.Values.themeTextColor font.pixelSize: StudioTheme.Values.baseFontSize topPadding: 10 leftPadding: 10 + rightPadding: 10 visible: ContentLibraryBackend.effectsModel.isEmpty + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.WordWrap + width: root.width onLinkActivated: ContentLibraryBackend.rootView.addQtQuick3D() } diff --git a/share/qtcreator/qmldesigner/contentLibraryQmlSource/ContentLibraryMaterialsView.qml b/share/qtcreator/qmldesigner/contentLibraryQmlSource/ContentLibraryMaterialsView.qml index 0ace2e7efd0..acdcdb21c9d 100644 --- a/share/qtcreator/qmldesigner/contentLibraryQmlSource/ContentLibraryMaterialsView.qml +++ b/share/qtcreator/qmldesigner/contentLibraryQmlSource/ContentLibraryMaterialsView.qml @@ -114,30 +114,34 @@ HelperWidgets.ScrollView { id: infoText text: { - if (!ContentLibraryBackend.rootView.isQt6Project) + if (!ContentLibraryBackend.rootView.isQt6Project) { qsTr("Content Library materials are not supported in Qt5 projects.") - else if (!ContentLibraryBackend.rootView.hasQuick3DImport) - qsTr('To use Content Library, first - add the QtQuick3D module in the Components view.') - .arg(StudioTheme.Values.themeInteraction) - else if (!root.materialsModel.hasRequiredQuick3DImport) + } else if (!ContentLibraryBackend.rootView.hasQuick3DImport) { + qsTr('To use Content Library materials, add the QtQuick3D module and the View3D + component in the Components view, or click + + here.').arg(StudioTheme.Values.themeInteraction) + } else if (!root.materialsModel.hasRequiredQuick3DImport) { qsTr("To use Content Library, version 6.3 or later of the QtQuick3D module is required.") - else if (!ContentLibraryBackend.rootView.hasMaterialLibrary) + } else if (!ContentLibraryBackend.rootView.hasMaterialLibrary) { qsTr("Content Library 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.") - else if (!searchBox.isEmpty()) + } else if (!searchBox.isEmpty()) { qsTr("No match found.") - else + } else { "" + } } textFormat: Text.RichText color: StudioTheme.Values.themeTextColor font.pixelSize: StudioTheme.Values.baseFontSize topPadding: 10 leftPadding: 10 + rightPadding: 10 wrapMode: Text.WordWrap width: root.width - x + horizontalAlignment: Text.AlignHCenter onLinkActivated: ContentLibraryBackend.rootView.addQtQuick3D() } diff --git a/share/qtcreator/qmldesigner/contentLibraryQmlSource/ContentLibraryUserView.qml b/share/qtcreator/qmldesigner/contentLibraryQmlSource/ContentLibraryUserView.qml index 29d662615c5..2c371385dd1 100644 --- a/share/qtcreator/qmldesigner/contentLibraryQmlSource/ContentLibraryUserView.qml +++ b/share/qtcreator/qmldesigner/contentLibraryQmlSource/ContentLibraryUserView.qml @@ -213,26 +213,33 @@ Item { text: { let categoryName = (categoryTitle === "3D") ? categoryTitle + " assets" : categoryTitle.toLowerCase() - if (!ContentLibraryBackend.rootView.isQt6Project) + if (!ContentLibraryBackend.rootView.isQt6Project) { qsTr("Content Library is not supported in Qt5 projects.") - else if (!ContentLibraryBackend.rootView.hasQuick3DImport && categoryTitle !== "Textures") - qsTr(`To use %1, first - add the QtQuick3D module in the Components view.`) - .arg(categoryName) - .arg(StudioTheme.Values.themeInteraction) - else if (!ContentLibraryBackend.rootView.hasMaterialLibrary && categoryTitle !== "Textures") + } else if (!ContentLibraryBackend.rootView.hasQuick3DImport && categoryTitle !== "Textures") { + qsTr('To use %1, add the QtQuick3D module and the View3D + component in the Components view, or click + + here.') + .arg(categoryName) + .arg(StudioTheme.Values.themeInteraction) + } else if (!ContentLibraryBackend.rootView.hasMaterialLibrary && categoryTitle !== "Textures") { qsTr("Content Library is disabled inside a non-visual component.") - else if (categoryEmpty) + } else if (categoryEmpty) { qsTr("There are no "+ categoryName + " in the User Assets.") - else + } else { "" + } } textFormat: Text.RichText color: StudioTheme.Values.themeTextColor font.pixelSize: StudioTheme.Values.baseFontSize topPadding: 10 leftPadding: 10 + rightPadding: 10 visible: infoText.text !== "" + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.WordWrap + width: root.width onLinkActivated: ContentLibraryBackend.rootView.addQtQuick3D() } diff --git a/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml b/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml index 987934e295f..6d935dc39f3 100644 --- a/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml +++ b/share/qtcreator/qmldesigner/materialBrowserQmlSource/MaterialBrowser.qml @@ -596,14 +596,18 @@ Item { anchors.centerIn: parent text: { - if (!materialBrowserModel.isQt6Project) + if (!materialBrowserModel.isQt6Project) { qsTr("Material Browser is not supported in Qt5 projects.") - else if (!materialBrowserModel.hasQuick3DImport) - qsTr("To use Material Browser, first add the QtQuick3D module in the Components view.") - else if (!materialBrowserModel.hasMaterialLibrary) + } else if (!materialBrowserModel.hasQuick3DImport) { + qsTr('To use the Material Browser, add the QtQuick3D module and the View3D + component in the Components view, or click + + here.').arg(StudioTheme.Values.themeInteraction) + } else if (!materialBrowserModel.hasMaterialLibrary) { qsTr("Material Browser is disabled inside a non-visual component.") - else + } else { "" + } } textFormat: Text.RichText @@ -611,6 +615,8 @@ Item { font.pixelSize: StudioTheme.Values.mediumFontSize horizontalAlignment: Text.AlignHCenter wrapMode: Text.WordWrap + + onLinkActivated: rootView.addQtQuick3D() } } diff --git a/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp index e3553ff5a36..124a6ab252d 100644 --- a/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp +++ b/src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp @@ -184,6 +184,7 @@ Edit3DWidget::Edit3DWidget(Edit3DView *view) // Onboarding label contains instructions for new users how to get 3D content into the project m_onboardingLabel = new QLabel(this); m_onboardingLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); + m_onboardingLabel->setWordWrap(true); connect(m_onboardingLabel, &QLabel::linkActivated, this, &Edit3DWidget::linkActivated); fillLayout->addWidget(m_onboardingLabel.data()); @@ -418,19 +419,11 @@ void Edit3DWidget::showOnboardingLabel() if (text.isEmpty()) { if (m_view->externalDependencies().isQt6Project()) { QString labelText = - tr("Your file does not import Qt Quick 3D.

" - "To create a 3D view, add the" - " QtQuick3D" - " module in the" - " Components" - " view or click" + tr("To use the 3D view, add the QtQuick3D module and the View3D" + " component in the Components view or click" " here" ".

" - "To import 3D assets, select" - " +" - " in the" - " Assets" - " view."); + "To import 3D assets, select + in the Assets view."); text = labelText.arg(Utils::creatorColor(Utils::Theme::TextColorLink).name()); } else { text = tr("3D view is not supported in Qt5 projects."); diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp index 3e93a0922b4..a8b29b52b41 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -389,6 +390,11 @@ void MaterialBrowserWidget::exportMaterial() m_bundleHelper->exportBundle({mat}, m_previewImageProvider->getPixmap(mat)); } +void MaterialBrowserWidget::addQtQuick3D() +{ + Utils3D::addQuick3DImportAndView3D(m_materialBrowserView.data()); +} + QString MaterialBrowserWidget::qmlSourcesPath() { #ifdef SHARE_QML_PATH diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.h b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.h index 7ebec0b622c..647847cb276 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.h +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.h @@ -66,6 +66,7 @@ public: Q_INVOKABLE void addMaterialToContentLibrary(); Q_INVOKABLE void importMaterial(); Q_INVOKABLE void exportMaterial(); + Q_INVOKABLE void addQtQuick3D(); StudioQuickWidget *quickWidget() const;