From 88c756258244648c555cd6bb77c3bb4ab53f01d1 Mon Sep 17 00:00:00 2001 From: Ali Kianian Date: Tue, 11 Oct 2022 17:47:20 +0300 Subject: [PATCH] QmlDesigner: Fix the position of placeholder in FilterComboBox MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The AutoCompleteString view had a bad position. The text property of the TextMetrics was wrong, which caused the placeholder to have bad position since the position was calculated with wrong text. In addition, I prevented showing the placeholder when the root comboBox is not opened, because otherwise it may show text when no item is selected. The main task was QDS-7662, which is now divided. Task-number: QDS-7912 Change-Id: Ib937d923191ec3c544dae3259774cd2bb5b7adb0 Reviewed-by: Henning Gründl --- .../imports/StudioControls/FilterComboBox.qml | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/FilterComboBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/FilterComboBox.qml index da0850fb14a..fd9ddcc445a 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/FilterComboBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/FilterComboBox.qml @@ -547,20 +547,27 @@ Item { ] Text { - visible: root.autocompleteString !== "" + id: tmpSelectionName + visible: root.autocompleteString !== "" && root.open text: root.autocompleteString x: textInput.leftPadding + textMetrics.advanceWidth - y: (textInput.height - Math.ceil(textMetrics.height)) / 2 + y: (textInput.height - Math.ceil(tmpSelectionTextMetrics.height)) / 2 color: "gray" // TODO proper color value font: textInput.font renderType: textInput.renderType + + TextMetrics { + id: textMetrics + font: textInput.font + text: textInput.text + } + TextMetrics { + id: tmpSelectionTextMetrics + font: tmpSelectionName.font + text: "Xq" + } } - TextMetrics { - id: textMetrics - font: textInput.font - text: textInput.text - } Rectangle { id: checkIndicator