tdf#168560 Sidebar Find: Select text on keyboard focus in find entry box

Like with the find entry box in the F&R dialog there is a bit of glitch
when using gtk VCL when the find text is not selected and is click on it
becomes selected and then not selected.

Change-Id: I879f85b676d737d03c4bb02069f5d80f385d343d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191600
Tested-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
This commit is contained in:
Jim Raykowski
2025-09-29 20:46:16 +02:00
parent e6bcb4ae0d
commit 4f33bb0f67
2 changed files with 8 additions and 0 deletions
@@ -123,6 +123,7 @@ QuickFindPanel::QuickFindPanel(weld::Widget* pParent, const uno::Reference<frame
= m_xBuilder->weld_widget(u"box"_ustr)->get_preferred_size().getWidth() + (6 * 2) + 6;
m_xContainer->set_size_request(m_nMinimumPanelWidth, 1);
m_xSearchFindEntry->connect_focus_in(LINK(this, QuickFindPanel, SearchFindEntryFocusInHandler));
m_xSearchFindEntry->connect_activate(
LINK(this, QuickFindPanel, SearchFindEntryActivateHandler));
m_xSearchFindEntry->connect_changed(LINK(this, QuickFindPanel, SearchFindEntryChangedHandler));
@@ -201,6 +202,12 @@ QuickFindPanel::~QuickFindPanel()
m_xSearchFindsList.reset();
}
IMPL_LINK_NOARG(QuickFindPanel, SearchFindEntryFocusInHandler, weld::Widget&, void)
{
if (m_xSearchFindEntry->get_text().getLength())
m_xSearchFindEntry->select_region(0, m_xSearchFindEntry->get_text().getLength());
}
IMPL_LINK_NOARG(QuickFindPanel, SearchFindEntryChangedHandler, weld::Entry&, void)
{
m_xSearchFindEntry->set_message_type(weld::EntryMessageType::Normal);
@@ -72,6 +72,7 @@ private:
sal_uInt16 m_nLEVShorter = 2;
sal_uInt16 m_nLEVLonger = 2;
DECL_LINK(SearchFindEntryFocusInHandler, weld::Widget&, void);
DECL_LINK(SearchFindEntryActivateHandler, weld::Entry&, bool);
DECL_LINK(SearchFindEntryChangedHandler, weld::Entry&, void);
DECL_LINK(SearchFindsListCustomGetSizeHandler, weld::TreeView::get_size_args, Size);