diff options
author | Ali Kianian <ali.kianian@qt.io> | 2022-10-11 17:47:20 +0300 |
---|---|---|
committer | Ali Kianian <ali.kianian@qt.io> | 2022-10-18 06:24:11 +0000 |
commit | 88c756258244648c555cd6bb77c3bb4ab53f01d1 (patch) | |
tree | 11b7893b115d5139e1b28795352fcf51dac0569c | |
parent | a0e87e458b5af22a81a87f6fe5f3e0775ed8b697 (diff) |
QmlDesigner: Fix the position of placeholder in FilterComboBox
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 <henning.gruendl@qt.io>
-rw-r--r-- | share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/FilterComboBox.qml | 21 |
1 files 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 da0850fb14..fd9ddcc445 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/FilterComboBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/FilterComboBox.qml @@ -547,21 +547,28 @@ 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: textMetrics + font: textInput.font + text: textInput.text + } + TextMetrics { + id: tmpSelectionTextMetrics + font: tmpSelectionName.font + text: "Xq" + } } + Rectangle { id: checkIndicator |