QmlDesigner: Make 3D edit view onboarding text translatable

Also add a potential related nullptr check.

Change-Id: I8c6e4facbdb0c2d94f7c2af54f83eef0eca0b796
Fixes: QDS-1993
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
This commit is contained in:
Miikka Heikkinen
2020-04-24 12:21:35 +03:00
parent 923bd79323
commit a248138685
2 changed files with 14 additions and 13 deletions

View File

@@ -312,6 +312,7 @@ QVector<Edit3DAction *> Edit3DView::rightActions() const
void Edit3DView::addQuick3DImport() void Edit3DView::addQuick3DImport()
{ {
if (model()) {
const QList<Import> imports = model()->possibleImports(); const QList<Import> imports = model()->possibleImports();
for (const auto &import : imports) { for (const auto &import : imports) {
if (import.url() == "QtQuick3D") { if (import.url() == "QtQuick3D") {
@@ -322,6 +323,7 @@ void Edit3DView::addQuick3DImport()
return; return;
} }
} }
}
Core::AsynchronousMessageBox::warning(tr("Failed to Add Import"), Core::AsynchronousMessageBox::warning(tr("Failed to Add Import"),
tr("Could not add QtQuick3D import to project.")); tr("Could not add QtQuick3D import to project."));
} }

View File

@@ -106,12 +106,11 @@ 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);
QString labelText = QString labelText =
"No 3D import here yet!<br><br>" tr("Your file does not import Qt Quick 3D.<br><br>"
"To create a 3D View you need to add the QtQuick3D import to your file.<br>" "To create a 3D view, add the QtQuick3D import to your file in the QML Imports tab of the Library view. Or click"
"You can add the import via the QML Imports tab of the Library view, or alternatively 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> "
"to add it straight away.<br><br>" "here to add it immediately.<br><br>"
"If you want to import 3D assets from another tool, click on the \"Add New Assets...\" button in the Assets tab of the Library view."; "To import 3D assets from another tool, click on the \"Add New Assets...\" button in the Assets tab of the Library view.");
m_onboardingLabel->setText(labelText.arg(Utils::creatorTheme()->color(Utils::Theme::TextColorLink).name())); m_onboardingLabel->setText(labelText.arg(Utils::creatorTheme()->color(Utils::Theme::TextColorLink).name()));
m_onboardingLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); m_onboardingLabel->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
connect(m_onboardingLabel, &QLabel::linkActivated, this, &Edit3DWidget::linkActivated); connect(m_onboardingLabel, &QLabel::linkActivated, this, &Edit3DWidget::linkActivated);