forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.13' into 4.14
Change-Id: If549dd1bc610704ece881c408cf44192dabed8b9
This commit is contained in:
@@ -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());
|
||||||
|
|
||||||
|
@@ -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">
|
||||||
|
@@ -84,7 +84,9 @@ QmlPreviewPlugin::QmlPreviewPlugin()
|
|||||||
if (s_previewPlugin) {
|
if (s_previewPlugin) {
|
||||||
auto fpsAction = new FpsAction;
|
auto fpsAction = new FpsAction;
|
||||||
designerActionManager.addDesignerAction(fpsAction);
|
designerActionManager.addDesignerAction(fpsAction);
|
||||||
|
bool hasFpsHandler =
|
||||||
s_previewPlugin->setProperty("fpsHandler", QVariant::fromValue<QmlPreview::QmlPreviewFpsHandler>(FpsLabelAction::fpsHandler));
|
s_previewPlugin->setProperty("fpsHandler", QVariant::fromValue<QmlPreview::QmlPreviewFpsHandler>(FpsLabelAction::fpsHandler));
|
||||||
|
QTC_CHECK(hasFpsHandler);
|
||||||
auto switchLanguageAction = new SwitchLanguageAction;
|
auto switchLanguageAction = new SwitchLanguageAction;
|
||||||
designerActionManager.addDesignerAction(switchLanguageAction);
|
designerActionManager.addDesignerAction(switchLanguageAction);
|
||||||
}
|
}
|
||||||
@@ -132,7 +134,9 @@ void QmlPreviewPlugin::setQmlFile()
|
|||||||
if (s_previewPlugin) {
|
if (s_previewPlugin) {
|
||||||
const Utils::FilePath qmlFileName =
|
const Utils::FilePath qmlFileName =
|
||||||
QmlDesignerPlugin::instance()->currentDesignDocument()->fileName();
|
QmlDesignerPlugin::instance()->currentDesignDocument()->fileName();
|
||||||
|
bool hasPreviewedFile =
|
||||||
s_previewPlugin->setProperty("previewedFile", qmlFileName.toString());
|
s_previewPlugin->setProperty("previewedFile", qmlFileName.toString());
|
||||||
|
QTC_CHECK(hasPreviewedFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,14 +150,18 @@ float QmlPreviewPlugin::zoomFactor()
|
|||||||
|
|
||||||
void QmlPreviewPlugin::setZoomFactor(float zoomFactor)
|
void QmlPreviewPlugin::setZoomFactor(float zoomFactor)
|
||||||
{
|
{
|
||||||
if (s_previewPlugin)
|
if (s_previewPlugin) {
|
||||||
s_previewPlugin->setProperty("zoomFactor", zoomFactor);
|
bool hasZoomFactor = s_previewPlugin->setProperty("zoomFactor", zoomFactor);
|
||||||
|
QTC_CHECK(hasZoomFactor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlPreviewPlugin::setLanguageLocale(const QString &locale)
|
void QmlPreviewPlugin::setLanguageLocale(const QString &locale)
|
||||||
{
|
{
|
||||||
if (auto s_previewPlugin = getPreviewPlugin())
|
if (auto s_previewPlugin = getPreviewPlugin()) {
|
||||||
s_previewPlugin->setProperty("locale", locale);
|
bool hasLocaleIsoCode = s_previewPlugin->setProperty("localeIsoCode", locale);
|
||||||
|
QTC_CHECK(hasLocaleIsoCode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject *QmlPreviewPlugin::getPreviewPlugin()
|
QObject *QmlPreviewPlugin::getPreviewPlugin()
|
||||||
|
@@ -95,7 +95,7 @@ void QmlMultiLanguageAspect::setCurrentLocale(const QString &locale)
|
|||||||
return;
|
return;
|
||||||
m_currentLocale = locale;
|
m_currentLocale = locale;
|
||||||
if (auto previewPlugin = getPreviewPlugin())
|
if (auto previewPlugin = getPreviewPlugin())
|
||||||
previewPlugin->setProperty("locale", locale);
|
previewPlugin->setProperty("localeIsoCode", locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmlMultiLanguageAspect::currentLocale() const
|
QString QmlMultiLanguageAspect::currentLocale() const
|
||||||
|
Reference in New Issue
Block a user