Skip to content

armgit / krita

Public Imported from GitHub
0

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++

Fix some minor issues, like the OT feature value not updating, search case sensitivity and placeholder text.

Wolthera van Hövell tot Westerflier41fd12733357
diff --git a/plugins/dockers/textproperties/qml/OpenTypeFeatureDelegate.qml b/plugins/dockers/textproperties/qml/OpenTypeFeatureDelegate.qml
index 56bcf2abce..a3531c3cd1 100644
--- a/plugins/dockers/textproperties/qml/OpenTypeFeatureDelegate.qml
+++ b/plugins/dockers/textproperties/qml/OpenTypeFeatureDelegate.qml
@@ -21,6 +21,8 @@ Control {
property string toolTip;
property int featureValue: 0;
+ onFeatureValueChanged: svgTextLabel.updateFeatureValue();
+
property var fontFamilies: [];
property double fontSize: 12.0;
property double fontWeight: 400;
@@ -94,6 +96,10 @@ Control {
language: root.language;
Component.onCompleted: {
+ updateFeatureValue();
+ }
+
+ function updateFeatureValue() {
var newFeatures = {};
newFeatures[root.tag] = root.featureValue;
openTypeFeatures = newFeatures;
diff --git a/plugins/dockers/textproperties/qml/OpenTypeFeatureSettings.qml b/plugins/dockers/textproperties/qml/OpenTypeFeatureSettings.qml
index b605a63811..e932fb5841 100644
--- a/plugins/dockers/textproperties/qml/OpenTypeFeatureSettings.qml
+++ b/plugins/dockers/textproperties/qml/OpenTypeFeatureSettings.qml
@@ -108,7 +108,7 @@ TextPropertyBase {
fontSlant: properties.fontStyle.value;
fontWidth: properties.fontWidth;
fontAxesValues: properties.axisValues;
- featureValue: activeFeatureControl.currentIndex;
+ featureValue: activeFeatureDelegate.model.edit;
enableMouseEvents: false;
}
@@ -200,11 +200,13 @@ TextPropertyBase {
color: cmbAvailableFeatures.palette.text
selectionColor: cmbAvailableFeatures.palette.highlight
selectedTextColor: cmbAvailableFeatures.palette.highlightedText;
+ placeholderText: i18nc("@info:placeholder", "Search...");
property bool blockSignals: false;
property OpenTypeFeatureFilterModel filterModel: OpenTypeFeatureFilterModel {
sourceModel: fontFeatureModel.allFeatureModel();
+ filterCaseSensitivity: Qt.CaseInsensitive;
}
selectByMouse: true;
diff --git a/qmlmodules/components/SvgTextLabel.cpp b/qmlmodules/components/SvgTextLabel.cpp
index 962d7e2e6a..ab830c3a35 100644
--- a/qmlmodules/components/SvgTextLabel.cpp
+++ b/qmlmodules/components/SvgTextLabel.cpp
@@ -48,6 +48,8 @@ SvgTextLabel::SvgTextLabel(QQuickItem *parent)
setImplicitSize(10, 10);
setAntialiasing(true);
setOpaquePainting(true);
+
+ connect(this, SIGNAL(openTypeFeaturesChanged(QVariantMap)), this, SLOT(updateShape()));
}
SvgTextLabel::~SvgTextLabel()
@@ -60,9 +62,6 @@ void SvgTextLabel::paint(QPainter *painter)
KIS_SAFE_ASSERT_RECOVER_RETURN(d->shapePainter);
if (width() == 0 || height() == 0) return;
- if (d->shape->textProperties() != d->props) {
- updateShape();
- }
if (!painter->isActive()) return;
painter->save();
if (d->shape->boundingRect().isEmpty()) {
@@ -322,11 +321,15 @@ QRectF SvgTextLabel::minimumRect() const
void SvgTextLabel::updateShape()
{
+ if (d->shape->textProperties() == d->props) {
+ return;
+ }
d->shape->setPropertiesAtPos(-1, d->props);
d->shape->relayout();
if (!d->addedShapeToPainter && d->shapePainter && !d->shape->boundingRect().isEmpty()) {
d->shapePainter->setShapes({d->shape.data()});
d->addedShapeToPainter = true;
}
+ update(boundingRect().toAlignedRect());
emit minimumRectChanged();
}
diff --git a/qmlmodules/components/SvgTextLabel.h b/qmlmodules/components/SvgTextLabel.h
index 11ceb3ffdb..0d10be2801 100644
--- a/qmlmodules/components/SvgTextLabel.h
+++ b/qmlmodules/components/SvgTextLabel.h
@@ -126,10 +126,11 @@ protected:
* used to avoid relayout being called time and time again when the properties change.
*/
void componentComplete() override;
-
+private Q_SLOTS:
+ void updateShape();
private:
- void updateShape();
+
struct Private;
const QScopedPointer<Private> d;