tdf#130857 qt weld: Implement getting/setting cursor
This is independent of the selection. (For selection, there is weld::TreeView::select and weld::TreeView::get_selected_index instead.) Change-Id: I3698a080cebaf4411740b0e7a95c54743e84d881 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178024 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
parent
57d532057b
commit
634e226c6b
1 changed files with 19 additions and 3 deletions
|
@ -248,11 +248,27 @@ bool QtInstanceTreeView::is_selected(int) const
|
||||||
|
|
||||||
int QtInstanceTreeView::get_cursor_index() const
|
int QtInstanceTreeView::get_cursor_index() const
|
||||||
{
|
{
|
||||||
assert(false && "Not implemented yet");
|
SolarMutexGuard g;
|
||||||
return -1;
|
|
||||||
|
int nIndex = -1;
|
||||||
|
GetQtInstance().RunInMainThread([&] {
|
||||||
|
const QModelIndex aCurrentIndex = m_pSelectionModel->currentIndex();
|
||||||
|
if (aCurrentIndex.isValid())
|
||||||
|
nIndex = aCurrentIndex.row();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
return nIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtInstanceTreeView::set_cursor(int) { assert(false && "Not implemented yet"); }
|
void QtInstanceTreeView::set_cursor(int nPos)
|
||||||
|
{
|
||||||
|
SolarMutexGuard g;
|
||||||
|
|
||||||
|
GetQtInstance().RunInMainThread([&] {
|
||||||
|
m_pSelectionModel->setCurrentIndex(m_pModel->index(nPos, 0), QItemSelectionModel::NoUpdate);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
int QtInstanceTreeView::find_text(const OUString& rText) const
|
int QtInstanceTreeView::find_text(const OUString& rText) const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue