[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [krita] plugins/tools/svgtexttool: Set suffix of lineheight to %
From:       Wolthera_van_Hövell_tot_Westerflier <null () kde ! org>
Date:       2017-12-31 22:16:09
Message-ID: E1eVltp-0003Qz-8d () code ! kde ! org
[Download RAW message or body]

Git commit a774c4c9848300d14f86e92ff528d5cf027ec78d by Wolthera van Hövell tot \
Westerflier. Committed on 31/12/2017 at 22:15.
Pushed by woltherav into branch 'master'.

Set suffix of lineheight to %
Because percentage and em are dependent on different things, apparantly.

M  +7    -7    plugins/tools/svgtexttool/SvgTextEditor.cpp
M  +1    -1    plugins/tools/svgtexttool/SvgTextEditor.h

https://commits.kde.org/krita/a774c4c9848300d14f86e92ff528d5cf027ec78d

diff --git a/plugins/tools/svgtexttool/SvgTextEditor.cpp \
b/plugins/tools/svgtexttool/SvgTextEditor.cpp index 62493bf080e..e97f5a294c4 100644
--- a/plugins/tools/svgtexttool/SvgTextEditor.cpp
+++ b/plugins/tools/svgtexttool/SvgTextEditor.cpp
@@ -282,9 +282,9 @@ void SvgTextEditor::checkFormat()
 
     QDoubleSpinBox *spnLineHeight = \
qobject_cast<QDoubleSpinBox*>(qobject_cast<QWidgetAction*>(actionCollection()->action("svg_line_height"))->defaultWidget());
  if (blockFormat.lineHeightType()==QTextBlockFormat::SingleHeight) {
-        spnLineHeight->setValue(1.0);
+        spnLineHeight->setValue(100.0);
     } else if(blockFormat.lineHeightType()==QTextBlockFormat::ProportionalHeight) {
-        spnLineHeight->setValue(double(blockFormat.lineHeight()/100.0));
+        spnLineHeight->setValue(double(blockFormat.lineHeight()));
     }
 }
 
@@ -608,10 +608,10 @@ void SvgTextEditor::decreaseTextSize()
     m_textEditorWidget.richTextEdit->mergeCurrentCharFormat(format);
 }
 
-void SvgTextEditor::setLineHeight(double lineHeightEm)
+void SvgTextEditor::setLineHeight(double lineHeightPercentage)
 {
     QTextBlockFormat format = \
                m_textEditorWidget.richTextEdit->textCursor().blockFormat();
-    format.setLineHeight(lineHeightEm*100, QTextBlockFormat::ProportionalHeight);
+    format.setLineHeight(lineHeightPercentage, \
                QTextBlockFormat::ProportionalHeight);
      m_textEditorWidget.richTextEdit->textCursor().mergeBlockFormat(format);
 }
 
@@ -912,9 +912,9 @@ void SvgTextEditor::createActions()
     QWidgetAction *lineHeight = new QWidgetAction(this);
     lineHeight->setToolTip(i18n("Line height"));
     QDoubleSpinBox *spnLineHeight = new QDoubleSpinBox();
-    spnLineHeight->setRange(0.0, 99.0);
-    spnLineHeight->setSingleStep(0.1);
-    spnLineHeight->setSuffix(i18n(" em"));//Does this need to be translated?
+    spnLineHeight->setRange(0.0, 1000.0);
+    spnLineHeight->setSingleStep(10.0);
+    spnLineHeight->setSuffix("%");
     connect(spnLineHeight, SIGNAL(valueChanged(double)), \
SLOT(setLineHeight(double)));  lineHeight->setDefaultWidget(spnLineHeight);
     actionCollection()->addAction("svg_line_height", lineHeight);
diff --git a/plugins/tools/svgtexttool/SvgTextEditor.h \
b/plugins/tools/svgtexttool/SvgTextEditor.h index 4d9584d0f47..28849fba42e 100644
--- a/plugins/tools/svgtexttool/SvgTextEditor.h
+++ b/plugins/tools/svgtexttool/SvgTextEditor.h
@@ -97,7 +97,7 @@ private Q_SLOTS:
     void increaseTextSize();
     void decreaseTextSize();
 
-    void setLineHeight(double lineHeightEm);
+    void setLineHeight(double lineHeightPercentage);
     void alignLeft();
     void alignRight();
     void alignCenter();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic