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

Remove unecessary function and fix a binding on a loader inside the font resource selector.

Wolthera van Hövell tot Westerflier04021bc333c0
diff --git a/plugins/dockers/textproperties/TagFilterProxyModelQmlWrapper.cpp b/plugins/dockers/textproperties/TagFilterProxyModelQmlWrapper.cpp
index ab99956c51..f59c92f6d4 100644
--- a/plugins/dockers/textproperties/TagFilterProxyModelQmlWrapper.cpp
+++ b/plugins/dockers/textproperties/TagFilterProxyModelQmlWrapper.cpp
@@ -213,15 +213,6 @@ QString TagFilterProxyModelQmlWrapper::localizedNameFromMetadata(
return name;
}
-QVariantMap TagFilterProxyModelQmlWrapper::metadataForIndex(const int &resourceIndex) const
-{
- if (!d->tagFilterProxyModel) return QVariantMap();
- QModelIndex resourceIdx = d->tagFilterProxyModel->index(resourceIndex, 0);
- // NOTE: KisTagFilterProxyModel has this weird thing where it switches between source models depending
- // on whether filtering by tag happens. This somehow causes index() to not always work.
- return d->tagFilterProxyModel->data(resourceIdx, Qt::UserRole + KisResourceModel::MetaData).toMap();
-}
-
#include <KoWritingSystemUtils.h>
QString TagFilterProxyModelQmlWrapper::localizedSampleFromMetadata(const QMap<QString, QVariant> &metadata, const QStringList &locales, const QString &fallBack)
{
diff --git a/plugins/dockers/textproperties/TagFilterProxyModelQmlWrapper.h b/plugins/dockers/textproperties/TagFilterProxyModelQmlWrapper.h
index 62c960766c..483c2b779f 100644
--- a/plugins/dockers/textproperties/TagFilterProxyModelQmlWrapper.h
+++ b/plugins/dockers/textproperties/TagFilterProxyModelQmlWrapper.h
@@ -41,7 +41,15 @@ public:
/// Associated tagmodel
QAbstractItemModel *tagModel() const;
+ /// The current resource type.
QString resourceType() const;
+
+ /**
+ * Setting the current resource type, this expects a
+ * resource type from KisResourceTypes, as this will be
+ * passed onto the initializers of the all internal resource
+ * related models.
+ */
void setResourceType(const QString &type);
/// Select tag at row in tag model.
@@ -53,7 +61,6 @@ public:
QString searchText() const;
void setSearchText(const QString &text);
-
/// Toggle "search in tag".
void setSearchInTag(const bool &newSearchInTag);
@@ -71,7 +78,6 @@ public:
/// Get localized name for index, retrieved from the resource metadata.
Q_INVOKABLE static QString localizedNameFromMetadata(const QMap<QString, QVariant> &metadata, const QStringList &locales, const QString &fallBack = "");
- Q_INVOKABLE QVariantMap metadataForIndex(const int &resourceIndex) const;
/// Get localized sample string based on scripts of locale.
Q_INVOKABLE static QString localizedSampleFromMetadata(const QMap<QString, QVariant> &metadata, const QStringList &locales, const QString &fallBack = "");
@@ -88,7 +94,7 @@ public:
/// Set the resource index in tagfilterproxy.
void setCurrentIndex(const int &index);
- /// Set resource to resource file name.
+ /// Set current resource to resource file name.
Q_INVOKABLE void setResourceToFileName(const QString &filename);
/// File name of the current resource.
diff --git a/plugins/dockers/textproperties/qml/FontResourceDropdown.qml b/plugins/dockers/textproperties/qml/FontResourceDropdown.qml
index be10fbeb53..06848f3681 100644
--- a/plugins/dockers/textproperties/qml/FontResourceDropdown.qml
+++ b/plugins/dockers/textproperties/qml/FontResourceDropdown.qml
@@ -67,18 +67,26 @@ Button {
property alias highlighted: fontDelegateItem.highlighted;
palette: fontDelegateItem.palette;
- property string fontName: fontDelegateItem.fontName;
+ property alias fontName: fontDelegateItem.fontName;
implicitHeight: nameLabel.height*4;
Loader {
anchors.fill: parent;
asynchronous: true;
+
sourceComponent: Component {
KoShapeQtQuickLabel {
id: fontFamilyDelegate;
- property var meta: fontDelegateItem.meta;
+ Binding {
+ target: fontFamilyDelegate
+ property: "meta"
+ when: fontDelegateItem && typeof fontDelegateItem !== 'undefined';
+ value: fontDelegateItem.meta;
+ }
+
+ property var meta: ({});
property bool colorBitmap : typeof meta.color_bitmap === 'boolean'? meta.color_bitmap: false;
property bool colorCLRV0 : typeof meta.color_clrv0 === 'boolean'? meta.color_clrv0: false;
property bool colorCLRV1 : typeof meta.color_clrv1 === 'boolean'? meta.color_clrv1: false;