Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
Implement some properties and hook them up to the UI.
Wolthera van Hövell tot Westerflier390900eac85e
diff --git a/libs/flake/CMakeLists.txt b/libs/flake/CMakeLists.txtindex 4f36fac71d..84402cf679 100644--- a/libs/flake/CMakeLists.txt+++ b/libs/flake/CMakeLists.txt@@ -226,6 +226,8 @@ set(kritaflake_SRCStext/KoPolygonUtils.cpptext/KoSvgTextPropertyData.cpptext/lager/KoSvgTextPropertiesModel.cpp+ text/lager/CssLengthPercentageModel.cpp+ text/lager/LineHeightModel.cppresources/KoSvgSymbolCollectionResource.cppresources/KoGamutMask.cppdiff --git a/libs/flake/text/KoSvgTextPropertyData.h b/libs/flake/text/KoSvgTextPropertyData.hindex c58b46ed30..93517f5ff8 100644--- a/libs/flake/text/KoSvgTextPropertyData.h+++ b/libs/flake/text/KoSvgTextPropertyData.h@@ -10,6 +10,7 @@#include "kritaflake_export.h"#include <boost/operators.hpp>+#include <QDebug>/*** @brief The KoSvgTextPropertyData structdiff --git a/libs/flake/text/lager/CssLengthPercentageModel.cpp b/libs/flake/text/lager/CssLengthPercentageModel.cppnew file mode 100644index 0000000000..b1566e0072--- /dev/null+++ b/libs/flake/text/lager/CssLengthPercentageModel.cpp@@ -0,0 +1,13 @@+/*+ * SPDX-FileCopyrightText: 2024 Wolthera van Hövell tot Westerflier <[email protected]>+ *+ * SPDX-License-Identifier: GPL-2.0-or-later+ */+#include "CssLengthPercentageModel.h"+#include <KisLager.h>++CssLengthPercentageModel::CssLengthPercentageModel(lager::cursor<KoSvgText::CssLengthPercentage> _data)+ : length(_data)+ , LAGER_QT(value) {length[&KoSvgText::CssLengthPercentage::value]}+, LAGER_QT(unitType) {length[&KoSvgText::CssLengthPercentage::unit].zoom(kislager::lenses::do_static_cast<KoSvgText::CssLengthPercentage::UnitType, int>)}+{}diff --git a/libs/flake/text/lager/CssLengthPercentageModel.h b/libs/flake/text/lager/CssLengthPercentageModel.hnew file mode 100644index 0000000000..48a350818d--- /dev/null+++ b/libs/flake/text/lager/CssLengthPercentageModel.h@@ -0,0 +1,29 @@+/*+ * SPDX-FileCopyrightText: 2024 Wolthera van Hövell tot Westerflier <[email protected]>+ *+ * SPDX-License-Identifier: GPL-2.0-or-later+ */+#ifndef CSSLENGTHPERCENTAGEMODEL_H+#define CSSLENGTHPERCENTAGEMODEL_H++#include <QObject>+#include <KoSvgText.h>+#include <lager/state.hpp>+#include <lager/cursor.hpp>+#include <lager/extra/qt.hpp>++#include <kritaflake_export.h>++class KRITAFLAKE_EXPORT CssLengthPercentageModel : public QObject+{+ Q_OBJECT+public:+ CssLengthPercentageModel(lager::cursor<KoSvgText::CssLengthPercentage> _data = lager::make_state(KoSvgText::CssLengthPercentage(), lager::automatic_tag{}));++ lager::cursor<KoSvgText::CssLengthPercentage> length;++ LAGER_QT_CURSOR(qreal, value);+ LAGER_QT_CURSOR(int, unitType);+};++#endif // CSSLENGTHPERCENTAGEMODEL_Hdiff --git a/libs/flake/text/lager/KoSvgTextPropertiesModel.cpp b/libs/flake/text/lager/KoSvgTextPropertiesModel.cppindex f34d82876e..9f53f47fde 100644--- a/libs/flake/text/lager/KoSvgTextPropertiesModel.cpp+++ b/libs/flake/text/lager/KoSvgTextPropertiesModel.cpp@@ -6,22 +6,62 @@#include "KoSvgTextPropertiesModel.h"#include "KoSvgTextProperties.h"#include <lager/constant.hpp>+#include <QDebug>namespace {-auto createTextProperty = lager::lenses::getset(- [](const KoSvgTextPropertyData value) {- return value.commonProperties.propertyOrDefault(KoSvgTextProperties::WritingModeId);+auto createCommonProperties = lager::lenses::getset (+ [] (const KoSvgTextPropertyData &value) -> KoSvgTextProperties {+ return value.commonProperties;},- [](KoSvgTextPropertyData value, const QVariant &variant) {- value.commonProperties.setProperty(KoSvgTextProperties::WritingModeId, variant);+[] (KoSvgTextPropertyData data, const KoSvgTextProperties &props) -> KoSvgTextPropertyData {+ data.commonProperties = props;+ return data;+}+ );++auto createTextProperty = [](KoSvgTextProperties::PropertyId propId) { return lager::lenses::getset(+ [propId](const KoSvgTextProperties &value) -> QVariant {+ return value.propertyOrDefault(propId);+ },+ [propId](KoSvgTextProperties value, const QVariant &variant) -> KoSvgTextProperties {+ value.setProperty(propId, variant);return value;}- );+ );+ };+auto integerProperty = lager::lenses::getset(+ [](const QVariant &value) -> int {return value.toInt();},+ [](QVariant value, const int &val){value = QVariant::fromValue(val); return value;});+auto boolProperty = lager::lenses::getset(+ [](const QVariant &value) -> bool {return value.toBool();},+ [](QVariant value, const bool &val){value = QVariant::fromValue(val); return value;});+auto lengthPercentageProperty = lager::lenses::getset(+ [](const QVariant &value) -> KoSvgText::CssLengthPercentage {return value.value<KoSvgText::CssLengthPercentage>();},+ [](QVariant value, const KoSvgText::CssLengthPercentage &val){value = QVariant::fromValue(val); return value;});+auto stringListProperty = lager::lenses::getset(+ [](const QVariant &value) -> QStringList {return value.value<QStringList>();},+ [](QVariant value, const QStringList &val){value = QVariant::fromValue(val); return value;});+auto lineHeightProperty = lager::lenses::getset(+ [](const QVariant &value) -> KoSvgText::LineHeightInfo {return value.value<KoSvgText::LineHeightInfo>();},+ [](QVariant value, const KoSvgText::LineHeightInfo &val){value = QVariant::fromValue(val); return value;});}KoSvgTextPropertiesModel::KoSvgTextPropertiesModel(lager::cursor<KoSvgTextPropertyData> _textData): textData(_textData)- , LAGER_QT(writingMode) {lager::with(_textData).zoom(createTextProperty)}+ , commonProperties(textData.zoom(createCommonProperties))+ , fontSizeData(commonProperties.zoom(createTextProperty(KoSvgTextProperties::FontSizeId)).zoom(lengthPercentageProperty))+ , lineHeightData(commonProperties.zoom(createTextProperty(KoSvgTextProperties::LineHeightId)).zoom(lineHeightProperty))+ , fontSizeModel(fontSizeData)+ , lineHeightModel(lineHeightData)+ , LAGER_QT(writingMode) {commonProperties.zoom(createTextProperty(KoSvgTextProperties::WritingModeId)).zoom(integerProperty)}+ , LAGER_QT(direction) {commonProperties.zoom(createTextProperty(KoSvgTextProperties::DirectionId)).zoom(integerProperty)}+ , LAGER_QT(textAlignAll) {commonProperties.zoom(createTextProperty(KoSvgTextProperties::TextAlignAllId)).zoom(integerProperty)}+ , LAGER_QT(fontWeight) {commonProperties.zoom(createTextProperty(KoSvgTextProperties::FontWeightId)).zoom(integerProperty)}+ , LAGER_QT(fontWidth) {commonProperties.zoom(createTextProperty(KoSvgTextProperties::FontStretchId)).zoom(integerProperty)}+ , LAGER_QT(fontStyle) {commonProperties.zoom(createTextProperty(KoSvgTextProperties::FontStyleId)).zoom(integerProperty)}+ , LAGER_QT(fontOpticalSizeLink) {commonProperties.zoom(createTextProperty(KoSvgTextProperties::FontOpticalSizingId)).zoom(boolProperty)}+ , LAGER_QT(fontFamilies) {commonProperties.zoom(createTextProperty(KoSvgTextProperties::FontFamiliesId)).zoom(stringListProperty)}{+ lager::watch(textData, std::bind(&KoSvgTextPropertiesModel::textPropertyChanged, this));}diff --git a/libs/flake/text/lager/KoSvgTextPropertiesModel.h b/libs/flake/text/lager/KoSvgTextPropertiesModel.hindex 66e6c60088..6daeca053b 100644--- a/libs/flake/text/lager/KoSvgTextPropertiesModel.h+++ b/libs/flake/text/lager/KoSvgTextPropertiesModel.h@@ -10,18 +10,43 @@#include <lager/cursor.hpp>#include <lager/extra/qt.hpp>#include <lager/state.hpp>++#include "KoSvgText.h"#include "KoSvgTextPropertyData.h"+#include "CssLengthPercentageModel.h"+#include "LineHeightModel.h"+#include <kritaflake_export.h>class KRITAFLAKE_EXPORT KoSvgTextPropertiesModel : public QObject{Q_OBJECTpublic:- KoSvgTextPropertiesModel(lager::cursor<KoSvgTextPropertyData> _textData = (lager::make_state(KoSvgTextPropertyData())));+ KoSvgTextPropertiesModel(lager::cursor<KoSvgTextPropertyData> _textData = lager::make_state(KoSvgTextPropertyData(), lager::automatic_tag{}));lager::cursor<KoSvgTextPropertyData> textData;+ lager::cursor<KoSvgTextProperties> commonProperties;+ lager::cursor<KoSvgText::CssLengthPercentage> fontSizeData;+ lager::cursor<KoSvgText::LineHeightInfo> lineHeightData;++ CssLengthPercentageModel fontSizeModel;+ LineHeightModel lineHeightModel;++ LAGER_QT_CURSOR(int, writingMode);+ LAGER_QT_CURSOR(int, direction);+ LAGER_QT_CURSOR(int, textAlignAll);++ LAGER_QT_CURSOR(int, fontWeight);+ LAGER_QT_CURSOR(int, fontWidth);+ LAGER_QT_CURSOR(int, fontStyle);+ LAGER_QT_CURSOR(bool, fontOpticalSizeLink);++ LAGER_QT_CURSOR(QStringList, fontFamilies);+- LAGER_QT_CURSOR(QVariant, writingMode);+Q_SIGNALS:+ void textPropertyChanged();+ void fontSizeChanged();};#endif // KOSVGTEXTPROPERTIESMODEL_Hdiff --git a/libs/flake/text/lager/LineHeightModel.cpp b/libs/flake/text/lager/LineHeightModel.cppnew file mode 100644index 0000000000..8dd3083fa3--- /dev/null+++ b/libs/flake/text/lager/LineHeightModel.cpp@@ -0,0 +1,85 @@+/*+ * SPDX-FileCopyrightText: 2024 Wolthera van Hövell tot Westerflier <[email protected]>+ *+ * SPDX-License-Identifier: GPL-2.0-or-later+ */+#include "LineHeightModel.h"++namespace {+auto lengthPercentage = lager::lenses::getset (+ [] (const KoSvgText::LineHeightInfo &value) -> KoSvgText::CssLengthPercentage {+ return value.length;+},+[] (KoSvgText::LineHeightInfo data, const KoSvgText::CssLengthPercentage &val) -> KoSvgText::LineHeightInfo {+ data.length = val;+ return data;+}+ );++auto getValue = lager::lenses::getset (+ [] (const KoSvgText::LineHeightInfo &data) -> qreal {+ if (data.isNumber) {+ return data.value;+ } else {+ return data.length.value;+ }+}, [] (KoSvgText::LineHeightInfo data, const qreal &val) -> KoSvgText::LineHeightInfo {+ if (data.isNumber) {+ data.value = val;+ } else {+ data.length.value = val;+ }+ return data;+});++auto getUnit = lager::lenses::getset (+ [] (const KoSvgText::LineHeightInfo &data) -> LineHeightModel::LineHeightType {+ if (data.isNumber) {+ return LineHeightModel::Lines;+ } else {+ switch(data.length.unit) {+ case KoSvgText::CssLengthPercentage::Absolute:+ return LineHeightModel::LineHeightType::Absolute;+ case KoSvgText::CssLengthPercentage::Em:+ return LineHeightModel::LineHeightType::Em;+ case KoSvgText::CssLengthPercentage::Ex:+ return LineHeightModel::LineHeightType::Ex;+ case KoSvgText::CssLengthPercentage::Percentage:+ return LineHeightModel::LineHeightType::Percentage;+ }+ return LineHeightModel::LineHeightType::Absolute;+ }+}, [] (KoSvgText::LineHeightInfo data, const LineHeightModel::LineHeightType &val) -> KoSvgText::LineHeightInfo {+ if (val == LineHeightModel::Lines) {+ data.isNumber = true;+ } else {+ switch(val) {+ case LineHeightModel::LineHeightType::Absolute:+ data.length.unit = KoSvgText::CssLengthPercentage::Absolute;+ break;+ case LineHeightModel::LineHeightType::Em:+ data.length.unit = KoSvgText::CssLengthPercentage::Em;+ break;+ case LineHeightModel::LineHeightType::Ex:+ data.length.unit = KoSvgText::CssLengthPercentage::Ex;+ break;+ case LineHeightModel::LineHeightType::Percentage:+ data.length.unit = KoSvgText::CssLengthPercentage::Percentage;+ break;+ default:+ break;+ }+ }+ return data;++});+}++LineHeightModel::LineHeightModel(lager::cursor<KoSvgText::LineHeightInfo> _data)+ : data(_data)+ , LAGER_QT(isNormal) {data[&KoSvgText::LineHeightInfo::isNormal]}+ , LAGER_QT(value) {data.zoom(getValue)}+ , LAGER_QT(unit) {data.zoom(getUnit)}+{++}diff --git a/libs/flake/text/lager/LineHeightModel.h b/libs/flake/text/lager/LineHeightModel.hnew file mode 100644index 0000000000..e20dbd2279--- /dev/null+++ b/libs/flake/text/lager/LineHeightModel.h@@ -0,0 +1,39 @@+/*+ * SPDX-FileCopyrightText: 2024 Wolthera van Hövell tot Westerflier <[email protected]>+ *+ * SPDX-License-Identifier: GPL-2.0-or-later+ */+#ifndef LINEHEIGHTMODEL_H+#define LINEHEIGHTMODEL_H++#include <QObject>+#include <KoSvgText.h>+#include <lager/state.hpp>+#include <lager/cursor.hpp>+#include <lager/extra/qt.hpp>++#include <kritaflake_export.h>++class KRITAFLAKE_EXPORT LineHeightModel: public QObject+{+ Q_OBJECT+public:+ LineHeightModel(lager::cursor<KoSvgText::LineHeightInfo> _data = lager::make_state(KoSvgText::LineHeightInfo(), lager::automatic_tag{}));++ enum LineHeightType {+ Absolute,+ Em,+ Ex,+ Percentage,+ Lines+ };+ Q_ENUM(LineHeightType)++ lager::cursor<KoSvgText::LineHeightInfo> data;++ LAGER_QT_CURSOR(bool, isNormal);+ LAGER_QT_CURSOR(qreal, value);+ LAGER_QT_CURSOR(LineHeightType, unit);+};++#endif // LINEHEIGHTMODEL_Hdiff --git a/plugins/dockers/textproperties/TextPropertiesDock.cpp b/plugins/dockers/textproperties/TextPropertiesDock.cppindex b539ee9bb6..1c72e942a6 100644--- a/plugins/dockers/textproperties/TextPropertiesDock.cpp+++ b/plugins/dockers/textproperties/TextPropertiesDock.cpp@@ -12,6 +12,8 @@#include <QQmlEngine>#include <QQmlContext>#include <QQuickItem>+#include <QFontDatabase>+#include <QStringListModel>#include <KisViewManager.h>#include <kis_canvas_resource_provider.h>@@ -21,15 +23,20 @@#include <KoCanvasResourcesIds.h>#include <KoSvgTextPropertyData.h>#include <text/lager/KoSvgTextPropertiesModel.h>+#include <text/lager/CssLengthPercentageModel.h>+#include <text/lager/LineHeightModel.h>+#include <lager/state.hpp>/// Strange place to put this, do we have a better spot?KIS_DECLARE_STATIC_INITIALIZER {qmlRegisterType<KoSvgTextPropertiesModel>("org.krita.flake.text", 1, 0, "KoSvgTextPropertiesModel");+ qmlRegisterType<CssLengthPercentageModel>("org.krita.flake.text", 1, 0, "CssLengthPercentageModel");+ qmlRegisterType<LineHeightModel>("org.krita.flake.text", 1, 0, "LineHeightModel");}-class TextPropertiesDock::Private+struct TextPropertiesDock::Private{-+ KoSvgTextPropertiesModel *textData {new KoSvgTextPropertiesModel()};};TextPropertiesDock::TextPropertiesDock()@@ -51,10 +58,17 @@ TextPropertiesDock::TextPropertiesDock()m_quickWidget->setPalette(this->palette());m_quickWidget->setMinimumHeight(100);- m_quickWidget->rootContext()->setContextProperty("textPropertiesModel", new KoSvgTextPropertiesModel());+ QFontDatabase fontDataBase = QFontDatabase();+ m_quickWidget->rootContext()->setContextProperty("textPropertiesModel", d->textData);+ m_quickWidget->rootContext()->setContextProperty("fontSizeModel", &d->textData->fontSizeModel);+ m_quickWidget->rootContext()->setContextProperty("lineHeightModel", &d->textData->lineHeightModel);+ m_quickWidget->rootContext()->setContextProperty("fontFamiliesModel", QVariant::fromValue(fontDataBase.families()));+ connect(d->textData, SIGNAL(textPropertyChanged()),+ this, SLOT(slotTextPropertiesChanged()));m_quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView);m_quickWidget->setSource(QUrl("qrc:/TextProperties.qml"));+}TextPropertiesDock::~TextPropertiesDock()@@ -101,7 +115,11 @@ void TextPropertiesDock::slotCanvasResourcesChanged(int key, const QVariant &val{if (key == KoCanvasResource::SvgTextPropertyData) {KoSvgTextPropertyData data = value.value<KoSvgTextPropertyData>();- KoSvgTextPropertiesModel textPropertyModel((lager::make_state(data)));- m_quickWidget->engine()->rootContext()->setContextProperty("textPropertiesModel", &textPropertyModel);+ d->textData->textData.set(data);}}++void TextPropertiesDock::slotTextPropertiesChanged()+{+ qDebug() << Q_FUNC_INFO << d->textData->textData.get();+}diff --git a/plugins/dockers/textproperties/TextPropertiesDock.h b/plugins/dockers/textproperties/TextPropertiesDock.hindex 89aea2befd..52dfa717d2 100644--- a/plugins/dockers/textproperties/TextPropertiesDock.h+++ b/plugins/dockers/textproperties/TextPropertiesDock.h@@ -29,12 +29,13 @@ public:public Q_SLOTS:void slotCanvasResourcesChanged(int key, const QVariant &value);+ void slotTextPropertiesChanged();private:QPointer<KisCanvas2> m_canvas;QQuickWidget *m_quickWidget {0};- class Private;+ struct Private;const QScopedPointer<Private> d;};diff --git a/plugins/dockers/textproperties/qml/FontFamily.qml b/plugins/dockers/textproperties/qml/FontFamily.qmlindex f0a84c7eef..066a88b8bb 100644--- a/plugins/dockers/textproperties/qml/FontFamily.qml+++ b/plugins/dockers/textproperties/qml/FontFamily.qml@@ -10,9 +10,24 @@ import QtQuick.Layouts 1.12CollapsibleGroupProperty {propertyName: "Font Family:";+ property var fontFamilies: [];+ property var fontFamilyModel : [];+ onFontFamiliesChanged: {+ if (fontFamilies.length >0) {+ mainFamilyCmb.currentIndex = mainFamilyCmb.find(fontFamilies[0]);+ }+ familyListView.model = fontFamilies;+ height: childrenRect.height;+ }+titleItem: ComboBox {id: mainFamilyCmb;+ model: fontFamilyModel;Layout.fillWidth: true;+ onActivated: {if (fontFamilies.length >0) {+ fontFamilies[0] = currentText;+ }+ }}contentItem: GridLayout {@@ -31,28 +46,18 @@ CollapsibleGroupProperty {ScrollView {id: fullFamilyList;Layout.fillWidth: true;+ Layout.preferredHeight: ItemDelegate.implicitHeight*3;background: Rectangle {color: sysPalette.alternateBase;border.color: sysPalette.text;border.width: 1;}-- Layout.preferredHeight: childrenRect.height;ListView {+ id: familyListView;anchors.fill: parent;- model: ListModel {- ListElement {- text: "Font A";- }- ListElement {- text: "Font B";- }- ListElement {- text: "Font C";- }- }+ model: []delegate: ItemDelegate {- text: model.text;+ text: modelData;width: parent.width;}}diff --git a/plugins/dockers/textproperties/qml/FontSize.qml b/plugins/dockers/textproperties/qml/FontSize.qmlindex bece4d267d..ed09f90087 100644--- a/plugins/dockers/textproperties/qml/FontSize.qml+++ b/plugins/dockers/textproperties/qml/FontSize.qml@@ -8,6 +8,9 @@ import QtQuick.Controls 2.0import QtQuick.Layouts 1.12TextPropertyBase {++ property alias fontSize: fontSizeSpn.value;+RowLayout {spacing: columnSpacing;width: parent.width;diff --git a/plugins/dockers/textproperties/qml/FontStyle.qml b/plugins/dockers/textproperties/qml/FontStyle.qmlindex fef1c4a20c..5f28acbb68 100644--- a/plugins/dockers/textproperties/qml/FontStyle.qml+++ b/plugins/dockers/textproperties/qml/FontStyle.qml@@ -10,6 +10,11 @@ import QtQuick.Layouts 1.12CollapsibleGroupProperty {propertyName: "Font Style";+ property alias fontWeight: fontWeightSpn.value;+ property alias fontWidth: fontStretchSpn.value;+ property alias fontSlant: fontSlantCmb.currentIndex;+ property alias fontOptical: opticalSizeCbx.checked;+titleItem: ComboBox {id: styleCmb;Layout.fillWidth: true;@@ -35,6 +40,8 @@ CollapsibleGroupProperty {SpinBox {id: fontWeightSpn+ from: 0;+ to: 1000;Layout.fillWidth: true}@@ -53,6 +60,8 @@ CollapsibleGroupProperty {SpinBox {id: fontStretchSpn+ from: 0;+ to: 200;Layout.fillWidth: true}@@ -62,12 +71,15 @@ CollapsibleGroupProperty {display: AbstractButton.IconOnlyicon.source: "qrc:///light_view-refresh.svg"}- Item {- width: 1;- height: 1;}- CheckBox {- id: italicsCbx- text: "Italics"+ Label {+ text: "Slant:"+ Layout.alignment: Qt.AlignRight | Qt.AlignVCenter+ horizontalAlignment: Text.AlignRight;+ }++ ComboBox {+ id: fontSlantCmb+ model: ["Normal", "Italic", "Oblique"]Layout.fillWidth: true}diff --git a/plugins/dockers/textproperties/qml/LineHeight.qml b/plugins/dockers/textproperties/qml/LineHeight.qmlindex 0e13092285..73fa260b09 100644--- a/plugins/dockers/textproperties/qml/LineHeight.qml+++ b/plugins/dockers/textproperties/qml/LineHeight.qml@@ -6,8 +6,14 @@import QtQuick 2.0import QtQuick.Controls 2.0import QtQuick.Layouts 1.12+import org.krita.flake.text 1.0TextPropertyBase {+ property alias isNormal: lineHeightNormalCbx.checked;+ property alias lineHeight: lineHeightSpn.value;+ property var lineHeightUnit;+ onLineHeightUnitChanged: lineHeightUnitCmb.currentIndex = lineHeightUnitCmb.indexOfValue(lineHeightUnit);+GridLayout {columns: 3;columnSpacing: columnSpacing;@@ -40,6 +46,10 @@ TextPropertyBase {Layout.columnSpan: 2;text: "Normal"id: lineHeightNormalCbx;+ onCheckedChanged: {+ lineHeightSpn.enabled = !checked;+ lineHeightUnitCmb.enabled = !checked;+ }}Item {width: firstColumnWidth;@@ -48,10 +58,22 @@ TextPropertyBase {SpinBox {id: lineHeightSpnLayout.fillWidth: true;+ enabled: !lineHeightNormalCbx.enabled;}ComboBox {- model: ["Pt", "Em", "Ex"]+ id: lineHeightUnitCmb+ model: [+ { text: "Pt", value: LineHeightModel.Pt},+ { text: "Em", value: LineHeightModel.Em},+ { text: "Ex", value: LineHeightModel.Ex},+ { text: "%", value: LineHeightModel.Percentage},+ { text: "Lines", value: LineHeightModel.Lines},+ ]+ textRole: "text";+ valueRole: "value";+ enabled: !lineHeightNormalCbx.enabled;+ onActivated: lineHeightUnit = lineHeightUnitCmb.currentValue;}}}diff --git a/plugins/dockers/textproperties/qml/TextProperties.qml b/plugins/dockers/textproperties/qml/TextProperties.qmlindex b6023a6d1e..bc3c5e5c2c 100644--- a/plugins/dockers/textproperties/qml/TextProperties.qml+++ b/plugins/dockers/textproperties/qml/TextProperties.qml@@ -15,10 +15,6 @@ Rectangle {color: sysPalette.window;anchors.fill: parent;- property KoSvgTextPropertiesModel textPropertyModel : textPropertiesModel;-- onTextPropertyModelChanged: console.log("Writing Mode:" ,textPropertyModel.writingMode);-SystemPalette {id: sysPalette;colorGroup: SystemPalette.Active@@ -56,12 +52,27 @@ Rectangle {model: ObjectModel {FontSize {width: characterProperties.width;++ fontSize: fontSizeModel.value;+ onFontSizeChanged: {fontSizeModel.value = fontSize; console.log(fontSizeModel.value);}+}FontFamily {width: characterProperties.width;+ fontFamilies: textPropertiesModel.fontFamilies;+ onFontFamiliesChanged: textPropertiesModel.fontFamilies = fontFamilies;+ fontFamilyModel: fontFamiliesModel;}FontStyle {width: characterProperties.width;+ fontWeight: textPropertiesModel.fontWeight;+ onFontWeightChanged: {textPropertiesModel.fontWeight = fontWeight;}+ fontWidth: textPropertiesModel.fontWidth;+ onFontWidthChanged: textPropertiesModel.fontWidth = fontWidth;+ fontSlant: textPropertiesModel.fontStyle;+ onFontSlantChanged: textPropertiesModel.fontStyle = fontSlant;+ fontOptical: textPropertiesModel.fontOpticalSizeLink;+ onFontOpticalChanged: textPropertiesModel.fontOpticalSizeLink = fontOptical;}LetterSpacing {width: characterProperties.width;@@ -71,6 +82,12 @@ Rectangle {}LineHeight {width: characterProperties.width;+ isNormal: lineHeightModel.isNormal;+ onIsNormalChanged: lineHeightModel.isNormal = isNormal;+ lineHeight: lineHeightModel.value;+ onLineHeightChanged: lineHeightModel.value = lineHeight;+ lineHeightUnit: lineHeightModel.unit;+ onLineHeightUnitChanged: lineHeightModel.unit = lineHeightUnit;}LineBreak {width: characterProperties.width;@@ -120,7 +137,8 @@ Rectangle {model: ObjectModel {WritingMode {width: parent.width;- writingMode: root.textPropertyModel.writingMode;+ writingMode: textPropertiesModel.writingMode;+ onWritingModeChanged: {textPropertiesModel.writingMode = writingMode;}}Direction{width: parent.width;