Gui: Force Expression Completer to show drop-down upon clicking on item (#25011)

As the title says - currently if user clicks "Box" from the autocomplete
dropdown, it adds "Box.", but the property drop-down is never resolved
further, so user has to delete the separator and write it by hand.

When a completion ends with '.' or '#' and is being selected by
clicking, code sets `block=true` and calls `slotTextChanged()` which
prevents the `textChanged2` signal from being emitted. This results in
completer being blocked from updating next level of properties.

So, this patch adds a direct call to `completer->slotUpdate()`, which
triggers completer to parse the expression and show the drop-down.
This commit is contained in:
tetektoza
2025-11-03 11:11:55 +01:00
committed by GitHub
parent 79412d205b
commit 08e4191e5a

View File

@@ -1158,6 +1158,12 @@ void ExpressionTextEdit::slotCompleteText(const QString& completionPrefix)
Base::FlagToggler<bool> flag(block, false);
cursor.insertText(completionPrefix);
completer->updatePrefixEnd(cursor.positionInBlock());
std::string textToComplete = completionPrefix.toUtf8().constData();
if (textToComplete.size()
&& (*textToComplete.crbegin() == '.' || *textToComplete.crbegin() == '#')) {
completer->slotUpdate(cursor.block().text(), cursor.positionInBlock());
}
}
void ExpressionTextEdit::keyPressEvent(QKeyEvent* e)