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++
Use CheckDelegate, fix small bug in LocaleHandler.
Wolthera van Hövell tot Westerflier61aac765ea12
diff --git a/plugins/dockers/textproperties/LocaleHandler.cpp b/plugins/dockers/textproperties/LocaleHandler.cppindex a8e6585b8f..381605a9c6 100644--- a/plugins/dockers/textproperties/LocaleHandler.cpp+++ b/plugins/dockers/textproperties/LocaleHandler.cpp@@ -51,6 +51,7 @@ void LocaleHandler::setBcp47Tag(const QString &newBcp47Tag)return;d->locale = KoWritingSystemUtils::parseBcp47Locale(newBcp47Tag);+d->favorites->addCode(language());emit bcp47TagChanged();emit languageChanged();@@ -85,9 +86,10 @@ void LocaleHandler::setLanguage(const QString &newLanguage)if (langOnly.toString() == newLanguage)return;langOnly = KoWritingSystemUtils::parseBcp47Locale(newLanguage);++ d->favorites->addCode(langOnly.toString());langOnly.scriptTag = d->locale.scriptTag;d->locale = langOnly;- d->favorites->addCode(langOnly.toString());emit languageChanged();emit bcp47TagChanged();}diff --git a/plugins/dockers/textproperties/qml/Language.qml b/plugins/dockers/textproperties/qml/Language.qmlindex 82598ab9e5..0b233fc07b 100644--- a/plugins/dockers/textproperties/qml/Language.qml+++ b/plugins/dockers/textproperties/qml/Language.qml@@ -70,6 +70,8 @@ TextPropertyBase {property bool blockSignals: false;+ selectByMouse: true;+onTextChanged: {if (!blockSignals) {localeHandler.searchString = text;@@ -128,26 +130,24 @@ TextPropertyBase {}- delegate: ItemDelegate {+ delegate: CheckDelegate {id: favoriteDelegate;required property var model;+ required property var index;palette: languageCmb.palette;width: languageCmb.width;- height: contentItem.implicitHeight;hoverEnabled: true;highlighted: hovered;- contentItem: CheckBox {- text: favoriteDelegate.model.display + " ("+favoriteDelegate.model.code+")";- checked: favoriteDelegate.model.favorite;- onCheckedChanged: favoriteDelegate.model.favorite = checked;- palette: favoriteDelegate.palette;- }+ text: model.display + " ("+favoriteDelegate.model.code+")";+ checked: favoriteDelegate.model.favorite;background: Rectangle {color: favoriteDelegate.highlighted? favoriteDelegate.palette.highlight: "transparent";}++ onClicked: languageCmb.currentIndex = index;}onCurrentValueChanged: localeHandler.language = currentValue;@@ -158,7 +158,7 @@ TextPropertyBase {height: 1;}- SqueezedComboBox {+ ComboBox {id: scriptCmb;model: localeHandler.scriptModel();textRole: "name";@@ -167,6 +167,8 @@ TextPropertyBase {enabled: localeHandler.localeValid;+ editable: true;+PaletteControl {id: scriptPalette;colorGroup: scriptCmb.enabled? SystemPalette.Active: SystemPalette.Disabled;