diff options
author | Jim Raykowski <raykowj@gmail.com> | 2020-03-22 20:54:24 -0800 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-03-23 15:22:51 +0100 |
commit | 6e83e7778d26f35d79ce573b6ee3ab149f7b6179 (patch) | |
tree | f2e74a0d0a91e7fd323c6bdc5324c8dea210b45a /vcl | |
parent | 49ca2c32514760bdfa417f81c5ef902fe38bcaad (diff) |
GtkInstanceTreeView: Expand to path before setting cursor
Expands the parent of a child, if needed, so the child can be selected.
Change-Id: If4b7322a7024065e5e96ed2ed43289c5ae7c5f5d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90899
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 02055e04b15b..46fa3b9cf03a 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -10144,6 +10144,14 @@ public: disable_notify_events(); const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter); GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore); + GtkTreeIter Iter; + if (gtk_tree_model_iter_parent(pModel, &Iter, const_cast<GtkTreeIter*>(&rGtkIter.iter))) + { + GtkTreePath* path = gtk_tree_model_get_path(pModel, &Iter); + if (!gtk_tree_view_row_expanded(m_pTreeView, path)) + gtk_tree_view_expand_to_path(m_pTreeView, path); + gtk_tree_path_free(path); + } GtkTreePath* path = gtk_tree_model_get_path(pModel, const_cast<GtkTreeIter*>(&rGtkIter.iter)); gtk_tree_view_scroll_to_cell(m_pTreeView, path, nullptr, false, 0, 0); gtk_tree_view_set_cursor(m_pTreeView, path, nullptr, false); |