summaryrefslogtreecommitdiffstats
path: root/src/designer/src/components/formeditor/qdesigner_resource.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-12-18 09:53:21 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-01-18 08:34:37 +0000
commit85624e87256005a2560a658722da5c982c8374ad (patch)
tree3cbf263ea6959e8292ad036df60fa234fc052c12 /src/designer/src/components/formeditor/qdesigner_resource.cpp
parentf63d6afdc3d172c68bd88fd35e1a1cddf4379a6c (diff)
Qt Designer: Support id-based translations
- Introduce a per-string id attribute and a global attribute indicating whether the form uses ids. - Introduce a new "id" subproperty in the property editor which is used depending on the form setting. - Add a settings to the form settings dialog. [ChangeLog][Qt Designer] Qt Designer now supports id-based translations. Task-number: QTBUG-34610 Change-Id: I9b0aa36fba0543960212a257e6aa2d9c23ab84c5 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/designer/src/components/formeditor/qdesigner_resource.cpp')
-rw-r--r--src/designer/src/components/formeditor/qdesigner_resource.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/designer/src/components/formeditor/qdesigner_resource.cpp b/src/designer/src/components/formeditor/qdesigner_resource.cpp
index 4da1e7b4c..bd6a3aa52 100644
--- a/src/designer/src/components/formeditor/qdesigner_resource.cpp
+++ b/src/designer/src/components/formeditor/qdesigner_resource.cpp
@@ -338,6 +338,9 @@ inline void translationParametersToDom(const PropertySheetTranslatableData &data
const QString propertyExtracomment = data.comment();
if (!propertyExtracomment.isEmpty())
e->setAttributeExtraComment(propertyExtracomment);
+ const QString &id = data.id();
+ if (!id.isEmpty())
+ e->setAttributeId(id);
if (!data.translatable())
e->setAttributeNotr(QStringLiteral("true"));
}
@@ -349,6 +352,8 @@ inline void translationParametersFromDom(const DomElement *e, PropertySheetTrans
data->setDisambiguation(e->attributeComment());
if (e->hasAttributeExtraComment())
data->setComment(e->attributeExtraComment());
+ if (e->hasAttributeId())
+ data->setId(e->attributeId());
if (e->hasAttributeNotr()) {
const QString notr = e->attributeNotr();
const bool translatable = !(notr == QStringLiteral("true") || notr == QStringLiteral("yes"));
@@ -502,6 +507,8 @@ void QDesignerResource::saveDom(DomUI *ui, QWidget *widget)
ui->setElementExportMacro(exportMacro);
}
+ ui->setAttributeIdbasedtr(m_formWindow->useIdBasedTranslations());
+
const QVariantMap designerFormData = m_formWindow->formData();
if (!designerFormData.empty()) {
DomPropertyList domPropertyList;
@@ -626,6 +633,9 @@ QWidget *QDesignerResource::create(DomUI *ui, QWidget *parentWidget)
QDesignerWidgetItemInstaller wii; // Make sure we use QDesignerWidgetItem.
QWidget *mainWidget = QAbstractFormBuilder::create(ui, parentWidget);
+ if (m_formWindow)
+ m_formWindow->setUseIdBasedTranslations(ui->attributeIdbasedtr());
+
if (mainWidget && m_formWindow) {
m_formWindow->setAuthor(ui->elementAuthor());
m_formWindow->setComment(ui->elementComment());