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>
This commit is contained in:
Lukasz Ornatek
2020-10-14 20:07:26 +02:00
committed by Thomas Hartmann
parent 57e77ec449
commit 80dda222e0
2 changed files with 27 additions and 7 deletions

View File

@@ -28,18 +28,34 @@
#include "richtexteditor/richtexteditor.h" #include "richtexteditor/richtexteditor.h"
#include "QStringListModel"
namespace QmlDesigner { namespace QmlDesigner {
AnnotationCommentTab::AnnotationCommentTab(QWidget *parent) : AnnotationCommentTab::AnnotationCommentTab(QWidget *parent)
QWidget(parent), : QWidget(parent)
ui(new Ui::AnnotationCommentTab) , ui(new Ui::AnnotationCommentTab)
{ {
ui->setupUi(this); ui->setupUi(this);
m_editor = new RichTextEditor; m_editor = new RichTextEditor;
ui->formLayout->setWidget(3, QFormLayout::FieldRole, m_editor); 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); this, &AnnotationCommentTab::commentTitleChanged);
} }
@@ -52,7 +68,7 @@ Comment AnnotationCommentTab::currentComment() const
{ {
Comment result; Comment result;
result.setTitle(ui->titleEdit->text().trimmed()); result.setTitle(ui->titleEdit->currentText().trimmed());
result.setAuthor(ui->authorEdit->text().trimmed()); result.setAuthor(ui->authorEdit->text().trimmed());
result.setText(m_editor->richText().trimmed()); result.setText(m_editor->richText().trimmed());
@@ -77,7 +93,7 @@ void AnnotationCommentTab::setComment(const Comment &comment)
void AnnotationCommentTab::resetUI() void AnnotationCommentTab::resetUI()
{ {
ui->titleEdit->setText(m_comment.title()); ui->titleEdit->setCurrentText(m_comment.title());
ui->authorEdit->setText(m_comment.author()); ui->authorEdit->setText(m_comment.author());
m_editor->setRichText(m_comment.deescapedText()); m_editor->setRichText(m_comment.deescapedText());

View File

@@ -24,7 +24,11 @@
</widget> </widget>
</item> </item>
<item row="1" column="1"> <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>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLabel" name="textLabel"> <widget class="QLabel" name="textLabel">