So far, only weld::Entry had API to get/set the current
cursor position, but weld::TextView didn't.
It however has API to be notified about cursor position
changes, via the base class weld::TextWidget::connect_cursor_position.
Also implement the API to get/set the cursor position,
by moving it from weld::Entry to the shared weld::TextWidget
base class, and implementing it for the toolkit-specific
weld::TextView subclasses.
This is one step to further align the weld::Entry
and weld::TextView APIs.
Add new implementations for the GTK and Qt variants,
using the underlying native widgets.
The vcl/SalInstanceTextView implementation can reuse
the existing SalInstanceEntry implementation, so move
that one to the shared SalInstanceTextWidget base class.
Quickly for all 3 implementations with the
"Insert" -> "OLE Object" -> "QR and Bardcode..."
dialog and this additional local change in place:
diff --git a/cui/source/dialogs/QrCodeGenDialog.cxx b/cui/source/dialogs/QrCodeGenDialog.cxx
index 6454e407bbf5..d2457df63bec 100644
--- a/cui/source/dialogs/QrCodeGenDialog.cxx
+++ b/cui/source/dialogs/QrCodeGenDialog.cxx
@@ -197,6 +197,8 @@ QrCodeGenDialog::QrCodeGenDialog(weld::Widget* pParent, Reference<XModel> xModel
if (xSelection.is())
m_xEdittext->set_text(xSelection->getString());
}
+ m_xEdittext->set_text("Something random");
+ m_xEdittext->set_position(4);
return;
}
(Cursor was positioned after the 4th character, i.e.
after "Some" for all implementations
as expected.)
Change-Id: Ia099ca560ee477bf78edb57f96e410784a2a944c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197513
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins