diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-09-18 10:09:54 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-09-18 13:48:35 +0200 |
commit | 897bd0517d835ba00458279311e5d8ff11079dd7 (patch) | |
tree | d7a60f82f5f52533be1282e23d3e9bd98c95044c /vcl/unx | |
parent | 25302321097afbde034196f1b6b00892fafbee1b (diff) |
Related: tdf#136559 set multiple columns in model at the same time
reduces time from 40s to 13s
Change-Id: I01d6a4fcaa5a868f9b9f9292f4a7e99e216ea23b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102988
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 660e07374fb4..471b353bd64b 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -9444,6 +9444,30 @@ private: return bRet; } + void set_toggle(const GtkTreeIter& iter, TriState eState, int col) + { + if (col == -1) + col = m_nExpanderToggleCol; + else + col = to_internal_model(col); + + if (eState == TRISTATE_INDET) + { + gtk_tree_store_set(m_pTreeStore, const_cast<GtkTreeIter*>(&iter), + m_aToggleVisMap[col], true, // checkbuttons are invisible until toggled on or off + m_aToggleTriStateMap[col], true, // tristate on + -1); + } + else + { + gtk_tree_store_set(m_pTreeStore, const_cast<GtkTreeIter*>(&iter), + m_aToggleVisMap[col], true, // checkbuttons are invisible until toggled on or off + m_aToggleTriStateMap[col], false, // tristate off + col, eState == TRISTATE_TRUE, // set toggle state + -1); + } + } + void set(const GtkTreeIter& iter, int col, const OUString& rText) { OString aStr(OUStringToOString(rText, RTL_TEXTENCODING_UTF8)); @@ -10651,42 +10675,18 @@ public: return get_bool(rGtkIter.iter, col) ? TRISTATE_TRUE : TRISTATE_FALSE; } - virtual void set_toggle(int pos, TriState eState, int col) override - { - if (col == -1) - col = m_nExpanderToggleCol; - else - col = to_internal_model(col); - - // checkbuttons are invisible until toggled on or off - set(pos, m_aToggleVisMap[col], true); - if (eState == TRISTATE_INDET) - set(pos, m_aToggleTriStateMap[col], true); - else - { - set(pos, m_aToggleTriStateMap[col], false); - set(pos, col, eState == TRISTATE_TRUE); - } - } - virtual void set_toggle(const weld::TreeIter& rIter, TriState eState, int col) override { const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter); + set_toggle(rGtkIter.iter, eState, col); + } - if (col == -1) - col = m_nExpanderToggleCol; - else - col = to_internal_model(col); - - // checkbuttons are invisible until toggled on or off - set(rGtkIter.iter, m_aToggleVisMap[col], true); - if (eState == TRISTATE_INDET) - set(rGtkIter.iter, m_aToggleTriStateMap[col], true); - else - { - set(rGtkIter.iter, m_aToggleTriStateMap[col], false); - set(rGtkIter.iter, col, eState == TRISTATE_TRUE); - } + virtual void set_toggle(int pos, TriState eState, int col) override + { + GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore); + GtkTreeIter iter; + if (gtk_tree_model_iter_nth_child(pModel, &iter, nullptr, pos)) + set_toggle(iter, eState, col); } virtual void enable_toggle_buttons(weld::ColumnToggleType eType) override |