aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukasz Ornatek <lukasz.ornatek@qt.io>2020-10-14 20:07:26 +0200
committerThomas Hartmann <thomas.hartmann@qt.io>2020-10-16 11:50:09 +0000
commit80dda222e0aab4f7e88627b6ad5288b91db03643 (patch)
treede16974667a6207ac4953784205ef07b67c2e695
parent57e77ec44918766beea31e6a243f0e33cfd08e96 (diff)
Automatic generation of Description & Display Condition tab
Task-number: QDS-2862 Change-Id: I367f336e84025b593e51faf282ad9c923cfeac54 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Michael Winkelmann <michael.winkelmann@qt.io>
-rw-r--r--src/plugins/qmldesigner/components/annotationeditor/annotationcommenttab.cpp28
-rw-r--r--src/plugins/qmldesigner/components/annotationeditor/annotationcommenttab.ui6
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 4f958d59f6..c7e1ab192c 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 4a69703d57..b3a9a85e6c 100644
--- a/src/plugins/qmldesigner/components/annotationeditor/annotationcommenttab.ui
+++ b/src/plugins/qmldesigner/components/annotationeditor/annotationcommenttab.ui
@@ -24,7 +24,11 @@
</widget>
</item>
<item row="1" column="1">
- <widget class="QLineEdit" name="titleEdit"/>
+ <widget class="QComboBox" name="titleEdit">
+ <property name="editable">
+ <bool>true</bool>
+ </property>
+ </widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="textLabel">