tdf#130857 qt weld: Handle special value -1 for cursor pos

Implement special handling for cursor position value
of -1 according to the comment above weld::Entry::set_position
in include/vcl/weld.hxx:

    // nCursorPos can be -1 to set to the end

Change-Id: I078d2123f391cf1fcab6f40d26309e2a2eb2315f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177448
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
This commit is contained in:
Michael Weghorn 2024-11-27 23:26:04 +01:00
parent 83ec1e7230
commit 68203597e1

View file

@ -89,6 +89,9 @@ void QtInstanceEntry::replace_selection(const OUString& rText)
void QtInstanceEntry::set_position(int nCursorPos)
{
SolarMutexGuard g;
if (nCursorPos == -1)
nCursorPos = m_pLineEdit->text().length();
GetQtInstance().RunInMainThread([&] { m_pLineEdit->setCursorPosition(nCursorPos); });
}