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++
Add arrow key navigation to completer-like Text Property ComboBoxes.
Wolthera van Hövell tot Westerflier6df0e74016b0
diff --git a/plugins/dockers/textproperties/qml/Language.qml b/plugins/dockers/textproperties/qml/Language.qmlindex 70ef71b27f..d8708ba84f 100644--- a/plugins/dockers/textproperties/qml/Language.qml+++ b/plugins/dockers/textproperties/qml/Language.qml@@ -105,6 +105,9 @@ TextPropertyBase {if (!blockSignals) {localeHandler.searchString = text;if (text !== "") {+ if (!filterPopup.visible) {+ filteredLanguages.currentIndex = 0;+ }filterPopup.open();}}@@ -119,6 +122,17 @@ TextPropertyBase {blockSignals = false;}+ Keys.onDownPressed: {+ if (filterPopup.visible) {+ filteredLanguages.currentIndex += 1;+ }+ }+ Keys.onUpPressed: {+ if (filterPopup.visible) {+ filteredLanguages.currentIndex -= 1;+ }+ }+function finalize() {localeHandler.searchString = "";filterPopup.close();@@ -131,6 +145,7 @@ TextPropertyBase {padding: 0;width: languageTxtEdit.width;height: Math.min(contentItem.implicitHeight, 300);+ palette: languageCmb.palette;contentItem: ListView {id: filteredLanguages;@@ -145,16 +160,22 @@ TextPropertyBase {text: model.display + " ("+model.code+")";width: filterPopup.width;hoverEnabled: true;- highlighted: hovered;+ highlighted: filteredLanguages.currentIndex === model.index;+ onHoveredChanged: {+ if (hovered) {+ filteredLanguages.currentIndex = model.index;+ }+ }background: Rectangle {color: languageDelegate.highlighted? languageDelegate.palette.highlight: "transparent";}palette: filterPopup.palette;- ToolTip.text: text;- ToolTip.visible: hovered;- ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval;+ Kis.ToolTipBase {+ text: languageDelegate.text;+ visible: languageDelegate.hovered+ }onClicked: {localeHandler.language = model.code;@@ -184,6 +205,7 @@ TextPropertyBase {contentItem: RowLayout {CheckBox {+ id: languageCbx;Component.onCompleted: {checked = favoriteDelegate.model.favorite;}@@ -192,9 +214,10 @@ TextPropertyBase {hoverEnabled: true;padding: 0;- ToolTip.text: i18nc("@info:tooltip", "Store this language between sessions.");- ToolTip.visible: hovered;- ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval;+ Kis.ToolTipBase {+ text: i18nc("@info:tooltip", "Store this language between sessions.");+ visible: languageCbx.hovered+ }}Label {text: favoriteDelegate.model.display + " ("+favoriteDelegate.model.code+")";diff --git a/plugins/dockers/textproperties/qml/OpenTypeFeatureDelegate.qml b/plugins/dockers/textproperties/qml/OpenTypeFeatureDelegate.qmlindex 1d4969ed1b..f8a8b0fe29 100644--- a/plugins/dockers/textproperties/qml/OpenTypeFeatureDelegate.qml+++ b/plugins/dockers/textproperties/qml/OpenTypeFeatureDelegate.qml@@ -35,9 +35,10 @@ Control {property bool enableMouseEvents: true;property alias containsMouse: mouseArea.containsMouse;+ property bool highlighted: false;background: Rectangle {- color: containsMouse? palette.highlight: "transparent";+ color: highlighted? palette.highlight: "transparent";}signal featureClicked (QtObject mouse);@@ -54,12 +55,12 @@ Control {text: "`"+root.tag+"`";Layout.preferredHeight: implicitHeight;Layout.maximumWidth: contentWidth;- color: root.containsMouse? palette.highlightedText: palette.text;+ color: root.highlighted? palette.highlightedText: palette.text;}ToolSeparator {Layout.fillHeight: true;- palette.window: root.containsMouse? root.palette.highlight: root.palette.window;+ palette.window: root.highlighted? root.palette.highlight: root.palette.window;}ColumnLayout {@@ -74,7 +75,7 @@ Control {elide: Text.ElideRight;Layout.fillWidth: true;Layout.preferredHeight: implicitHeight- color: root.containsMouse? palette.highlightedText: palette.text;+ color: root.highlighted? palette.highlightedText: palette.text;}Kis.SvgTextLabel {diff --git a/plugins/dockers/textproperties/qml/OpenTypeFeatureSettings.qml b/plugins/dockers/textproperties/qml/OpenTypeFeatureSettings.qmlindex 404b998bc5..7d2f9ea5c2 100644--- a/plugins/dockers/textproperties/qml/OpenTypeFeatureSettings.qml+++ b/plugins/dockers/textproperties/qml/OpenTypeFeatureSettings.qml@@ -221,6 +221,7 @@ TextPropertyBase {fontFeatureModel.addFeature(tag);cmbAvailableFeatures.popup.close();}+ highlighted: cmbAvailableFeatures.highlightedIndex === index;}contentItem: TextField {@@ -244,6 +245,9 @@ TextPropertyBase {onTextChanged: {if (text !== "") {filterModel.setFilterRegularExpression(text);+ if (!completerPopup.visible) {+ completerListView.currentIndex = 0;+ }completerPopup.open();} else {completerPopup.close();@@ -251,6 +255,17 @@ TextPropertyBase {}}+ Keys.onDownPressed: {+ if (completerPopup.visible) {+ completerListView.currentIndex += 1;+ }+ }+ Keys.onUpPressed: {+ if (completerPopup.visible) {+ completerListView.currentIndex -= 1;+ }+ }+onAccepted: {blockSignals = true;let name = filterModel.firstValidTag();@@ -272,8 +287,10 @@ TextPropertyBase {padding: 0;width: featureTxtEdit.width;height: contentItem.implicitHeight;+ palette: cmbAvailableFeatures.palette;property string highlightedTag;contentItem: ListView {+ id: completerListView;model: featureTxtEdit.filterModel;clip: true;implicitHeight: Math.min(contentHeight, 300);@@ -301,6 +318,12 @@ TextPropertyBase {fontFeatureModel.addFeature(tag);featureTxtEdit.finalize();}+ onContainsMouseChanged: {+ if (containsMouse) {+ completerListView.currentIndex = index;+ }+ }+ highlighted: completerListView.currentIndex === index;}}}diff --git a/plugins/dockers/textproperties/qml/TextPropertyBaseList.qml b/plugins/dockers/textproperties/qml/TextPropertyBaseList.qmlindex da46f63bdc..3ff9882262 100644--- a/plugins/dockers/textproperties/qml/TextPropertyBaseList.qml+++ b/plugins/dockers/textproperties/qml/TextPropertyBaseList.qml@@ -362,6 +362,13 @@ ColumnLayout {}}+ Keys.onDownPressed: {+ addPropertyCmb.incrementCurrentIndex();+ }+ Keys.onUpPressed: {+ addPropertyCmb.decrementCurrentIndex();+ }+onAccepted: {blockSignals = true;let name = filteredConfigModel.filteredNames[addPropertyCmb.highlightedIndex]