forked from qt-creator/qt-creator
QmlDesigner: Add link to add QtQuick3D from ContentLibrary
Fixes: QDS-11766 Change-Id: I092cfc07fda96f73be20383f7601e50f89c7207f Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
@@ -107,11 +107,14 @@ HelperWidgets.ScrollView {
|
|||||||
|
|
||||||
Text {
|
Text {
|
||||||
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 add the QtQuick3D module in the <b>Components</b> view.")
|
qsTr('To use <b>Content Library</b>, first <a href="#add_import" style="text-decoration:none;color:%1">
|
||||||
|
add the QtQuick3D module</a> in the <b>Components</b> view.')
|
||||||
|
.arg(StudioTheme.Values.themeInteraction)
|
||||||
else if (!ContentLibraryBackend.effectsModel.hasRequiredQuick3DImport)
|
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)
|
||||||
@@ -123,11 +126,14 @@ HelperWidgets.ScrollView {
|
|||||||
else
|
else
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
|
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
|
||||||
visible: ContentLibraryBackend.effectsModel.isEmpty
|
visible: ContentLibraryBackend.effectsModel.isEmpty
|
||||||
|
|
||||||
|
onLinkActivated: ContentLibraryBackend.rootView.addQtQuick3D()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -112,11 +112,14 @@ HelperWidgets.ScrollView {
|
|||||||
|
|
||||||
Text {
|
Text {
|
||||||
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 add the QtQuick3D module in the <b>Components</b> view.")
|
qsTr('To use <b>Content Library</b>, first <a href="#add_import" style="text-decoration:none;color:%1">
|
||||||
|
add the QtQuick3D module</a> in the <b>Components</b> view.')
|
||||||
|
.arg(StudioTheme.Values.themeInteraction)
|
||||||
else if (!root.materialsModel.hasRequiredQuick3DImport)
|
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)
|
||||||
@@ -128,13 +131,15 @@ HelperWidgets.ScrollView {
|
|||||||
else
|
else
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
|
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
|
||||||
visible: root.materialsModel.isEmpty
|
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
width: root.width - x
|
width: root.width - x
|
||||||
|
|
||||||
|
onLinkActivated: ContentLibraryBackend.rootView.addQtQuick3D()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -206,11 +206,13 @@ 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 " + categoryName + ", first add the QtQuick3D module in the <b>Components</b> view.")
|
qsTr(`To use %1, first <a href="#add_import" style="text-decoration:none;color:%2">
|
||||||
|
add the <b>QtQuick3D</b> module</a> in the <b>Components</b> view.`)
|
||||||
|
.arg(categoryName)
|
||||||
|
.arg(StudioTheme.Values.themeInteraction)
|
||||||
else if (!ContentLibraryBackend.rootView.hasMaterialLibrary && categoryTitle !== "Textures")
|
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)
|
||||||
@@ -218,11 +220,14 @@ Item {
|
|||||||
else
|
else
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
|
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
|
||||||
visible: infoText.text !== ""
|
visible: infoText.text !== ""
|
||||||
|
|
||||||
|
onLinkActivated: ContentLibraryBackend.rootView.addQtQuick3D()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -74,6 +74,15 @@ WidgetInfo ContentLibraryView::widgetInfo()
|
|||||||
|
|
||||||
m_bundleHelper = std::make_unique<BundleHelper>(this, m_widget);
|
m_bundleHelper = std::make_unique<BundleHelper>(this, m_widget);
|
||||||
|
|
||||||
|
connect(m_widget, &ContentLibraryWidget::importQtQuick3D, this, [&] {
|
||||||
|
DesignDocument *document = QmlDesignerPlugin::instance()->currentDesignDocument();
|
||||||
|
if (document && !document->inFileComponentModelActive() && model()) {
|
||||||
|
ModelUtils::addImportWithCheck(
|
||||||
|
"QtQuick3D",
|
||||||
|
[](const Import &import) { return !import.hasVersion() || import.majorVersion() >= 6; },
|
||||||
|
model());
|
||||||
|
}
|
||||||
|
});
|
||||||
connect(m_widget, &ContentLibraryWidget::bundleMaterialDragStarted, this,
|
connect(m_widget, &ContentLibraryWidget::bundleMaterialDragStarted, this,
|
||||||
[&] (QmlDesigner::ContentLibraryMaterial *mat) {
|
[&] (QmlDesigner::ContentLibraryMaterial *mat) {
|
||||||
m_draggedBundleMaterial = mat;
|
m_draggedBundleMaterial = mat;
|
||||||
|
@@ -679,6 +679,11 @@ bool ContentLibraryWidget::areNodes3D(const QByteArray &data) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContentLibraryWidget::addQtQuick3D()
|
||||||
|
{
|
||||||
|
emit importQtQuick3D();
|
||||||
|
}
|
||||||
|
|
||||||
QSize ContentLibraryWidget::sizeHint() const
|
QSize ContentLibraryWidget::sizeHint() const
|
||||||
{
|
{
|
||||||
return {420, 420};
|
return {420, 420};
|
||||||
|
@@ -102,6 +102,7 @@ public:
|
|||||||
Q_INVOKABLE void updateSceneEnvState();
|
Q_INVOKABLE void updateSceneEnvState();
|
||||||
Q_INVOKABLE void markTextureUpdated(const QString &textureKey);
|
Q_INVOKABLE void markTextureUpdated(const QString &textureKey);
|
||||||
Q_INVOKABLE bool areNodes3D(const QByteArray &data) const;
|
Q_INVOKABLE bool areNodes3D(const QByteArray &data) const;
|
||||||
|
Q_INVOKABLE void addQtQuick3D();
|
||||||
|
|
||||||
QSize sizeHint() const override;
|
QSize sizeHint() const override;
|
||||||
|
|
||||||
@@ -128,6 +129,7 @@ signals:
|
|||||||
void acceptTexturesDrop(const QList<QUrl> &urls);
|
void acceptTexturesDrop(const QList<QUrl> &urls);
|
||||||
void acceptMaterialDrop(const QString &internalId);
|
void acceptMaterialDrop(const QString &internalId);
|
||||||
void accept3DDrop(const QByteArray &internalIds);
|
void accept3DDrop(const QByteArray &internalIds);
|
||||||
|
void importQtQuick3D();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||||
|
Reference in New Issue
Block a user