From 57e77ec44918766beea31e6a243f0e33cfd08e96 Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Wed, 14 Oct 2020 14:02:49 +0200 Subject: [PATCH 1/2] qmlpreview: fix calling right localeIsoCode method Also add some QTC_CHECK to get at least some warning in case the functions are renamed in future. Change-Id: Ie4e78855152e9946950603c95fa881755e850c62 Reviewed-by: Marco Bubke (cherry picked from commit 165ccb828d5f741c91ebdc0bf6e50bd980497640) Reviewed-by: Tim Jenssen --- .../qmlpreviewplugin/qmlpreviewplugin.cpp | 20 +++++++++++++------ .../qmlmultilanguageaspect.cpp | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewplugin.cpp b/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewplugin.cpp index ac0f30118d5..e0d55eb21a1 100644 --- a/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewplugin.cpp +++ b/src/plugins/qmldesigner/qmlpreviewplugin/qmlpreviewplugin.cpp @@ -84,7 +84,9 @@ QmlPreviewPlugin::QmlPreviewPlugin() if (s_previewPlugin) { auto fpsAction = new FpsAction; designerActionManager.addDesignerAction(fpsAction); - s_previewPlugin->setProperty("fpsHandler", QVariant::fromValue(FpsLabelAction::fpsHandler)); + bool hasFpsHandler = + s_previewPlugin->setProperty("fpsHandler", QVariant::fromValue(FpsLabelAction::fpsHandler)); + QTC_CHECK(hasFpsHandler); auto switchLanguageAction = new SwitchLanguageAction; designerActionManager.addDesignerAction(switchLanguageAction); } @@ -132,7 +134,9 @@ void QmlPreviewPlugin::setQmlFile() if (s_previewPlugin) { const Utils::FilePath qmlFileName = QmlDesignerPlugin::instance()->currentDesignDocument()->fileName(); - s_previewPlugin->setProperty("previewedFile", qmlFileName.toString()); + bool hasPreviewedFile = + s_previewPlugin->setProperty("previewedFile", qmlFileName.toString()); + QTC_CHECK(hasPreviewedFile); } } @@ -146,14 +150,18 @@ float QmlPreviewPlugin::zoomFactor() void QmlPreviewPlugin::setZoomFactor(float zoomFactor) { - if (s_previewPlugin) - s_previewPlugin->setProperty("zoomFactor", zoomFactor); + if (s_previewPlugin) { + bool hasZoomFactor = s_previewPlugin->setProperty("zoomFactor", zoomFactor); + QTC_CHECK(hasZoomFactor); + } } void QmlPreviewPlugin::setLanguageLocale(const QString &locale) { - if (auto s_previewPlugin = getPreviewPlugin()) - s_previewPlugin->setProperty("locale", locale); + if (auto s_previewPlugin = getPreviewPlugin()) { + bool hasLocaleIsoCode = s_previewPlugin->setProperty("localeIsoCode", locale); + QTC_CHECK(hasLocaleIsoCode); + } } QObject *QmlPreviewPlugin::getPreviewPlugin() diff --git a/src/plugins/qmlprojectmanager/qmlmultilanguageaspect.cpp b/src/plugins/qmlprojectmanager/qmlmultilanguageaspect.cpp index 8e9654033b9..c2de9927627 100644 --- a/src/plugins/qmlprojectmanager/qmlmultilanguageaspect.cpp +++ b/src/plugins/qmlprojectmanager/qmlmultilanguageaspect.cpp @@ -95,7 +95,7 @@ void QmlMultiLanguageAspect::setCurrentLocale(const QString &locale) return; m_currentLocale = locale; if (auto previewPlugin = getPreviewPlugin()) - previewPlugin->setProperty("locale", locale); + previewPlugin->setProperty("localeIsoCode", locale); } QString QmlMultiLanguageAspect::currentLocale() const From 80dda222e0aab4f7e88627b6ad5288b91db03643 Mon Sep 17 00:00:00 2001 From: Lukasz Ornatek Date: Wed, 14 Oct 2020 20:07:26 +0200 Subject: [PATCH 2/2] Automatic generation of Description & Display Condition tab Task-number: QDS-2862 Change-Id: I367f336e84025b593e51faf282ad9c923cfeac54 Reviewed-by: Thomas Hartmann Reviewed-by: Michael Winkelmann --- .../annotationeditor/annotationcommenttab.cpp | 28 +++++++++++++++---- .../annotationeditor/annotationcommenttab.ui | 6 +++- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/plugins/qmldesigner/components/annotationeditor/annotationcommenttab.cpp b/src/plugins/qmldesigner/components/annotationeditor/annotationcommenttab.cpp index 4f958d59f6e..c7e1ab192c2 100644 --- a/src/plugins/qmldesigner/components/annotationeditor/annotationcommenttab.cpp +++ b/src/plugins/qmldesigner/components/annotationeditor/annotationcommenttab.cpp @@ -28,18 +28,34 @@ #include "richtexteditor/richtexteditor.h" +#include "QStringListModel" + namespace QmlDesigner { -AnnotationCommentTab::AnnotationCommentTab(QWidget *parent) : - QWidget(parent), - ui(new Ui::AnnotationCommentTab) +AnnotationCommentTab::AnnotationCommentTab(QWidget *parent) + : QWidget(parent) + , ui(new Ui::AnnotationCommentTab) { ui->setupUi(this); m_editor = new RichTextEditor; ui->formLayout->setWidget(3, QFormLayout::FieldRole, m_editor); - connect(ui->titleEdit, &QLineEdit::textEdited, + ui->titleEdit->setModel(new QStringListModel{QStringList{"Description", + "Display Condition", + "helper_lines" + "highlight" + "project author", + "project confirmed", + "project developer", + "project distributor", + "project modified", + "project type" + "project version", + "Screen Description" + "Section"}}); + + connect(ui->titleEdit, &QComboBox::currentTextChanged, this, &AnnotationCommentTab::commentTitleChanged); } @@ -52,7 +68,7 @@ Comment AnnotationCommentTab::currentComment() const { Comment result; - result.setTitle(ui->titleEdit->text().trimmed()); + result.setTitle(ui->titleEdit->currentText().trimmed()); result.setAuthor(ui->authorEdit->text().trimmed()); result.setText(m_editor->richText().trimmed()); @@ -77,7 +93,7 @@ void AnnotationCommentTab::setComment(const Comment &comment) void AnnotationCommentTab::resetUI() { - ui->titleEdit->setText(m_comment.title()); + ui->titleEdit->setCurrentText(m_comment.title()); ui->authorEdit->setText(m_comment.author()); m_editor->setRichText(m_comment.deescapedText()); diff --git a/src/plugins/qmldesigner/components/annotationeditor/annotationcommenttab.ui b/src/plugins/qmldesigner/components/annotationeditor/annotationcommenttab.ui index 4a69703d57d..b3a9a85e6c9 100644 --- a/src/plugins/qmldesigner/components/annotationeditor/annotationcommenttab.ui +++ b/src/plugins/qmldesigner/components/annotationeditor/annotationcommenttab.ui @@ -24,7 +24,11 @@ - + + + true + +