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

Try to avoid updating the fontaxesmodel when the axes are the same.

Wolthera van Hövell tot Westerflier84b31ffc34c3
diff --git a/plugins/dockers/textproperties/FontAxesModel.cpp b/plugins/dockers/textproperties/FontAxesModel.cpp
index d8106996b1..cc9b5fe3cc 100644
--- a/plugins/dockers/textproperties/FontAxesModel.cpp
+++ b/plugins/dockers/textproperties/FontAxesModel.cpp
@@ -35,8 +35,7 @@ FontAxesModel::~FontAxesModel()
void FontAxesModel::setAxesData(QList<KoSvgText::FontFamilyAxis> axes)
{
- beginResetModel();
- d->axes.clear();
+ QList<KoSvgText::FontFamilyAxis> newAxes;
for (int i=0; i < axes.size(); i++) {
QString tag = axes.at(i).tag;
if (!(tag == WEIGHT_TAG
@@ -44,10 +43,16 @@ void FontAxesModel::setAxesData(QList<KoSvgText::FontFamilyAxis> axes)
|| tag == ITALIC_TAG
|| tag == SLANT_TAG)
&& !axes.at(i).axisHidden) {
- d->axes.append(axes.at(i));
+ newAxes.append(axes.at(i));
}
}
- endResetModel();
+ if (newAxes != d->axes) {
+ // TODO: Rework this whole thing so we don't update axes unless absolutely necessary.
+ // This wll probably require a filterproxy model where invisible axes are filtered out.
+ beginResetModel();
+ d->axes = newAxes;
+ endResetModel();
+ }
}
void FontAxesModel::setLocales(QList<QLocale> locales)