include/vcl/weld.hxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
New commits: commit 8149e903db501511193761eebca1640407ad52dc Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Mon Jun 5 13:52:10 2023 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Mon Jun 5 15:31:48 2023 +0200 Introduce weld::ComboBox::insert/append taking a single ComboBoxEntry Change-Id: Ia777daa8ced1df43dd49280ee30269de2b191237 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152609 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index e9068f446d6d..69e95ce7ad01 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -748,10 +748,16 @@ public: = 0; virtual void insert_vector(const std::vector<weld::ComboBoxEntry>& rItems, bool bKeepExisting) = 0; + void insert(int pos, const weld::ComboBoxEntry& rItem) + { + insert(pos, rItem.sString, rItem.sId.isEmpty() ? nullptr : &rItem.sId, + rItem.sImage.isEmpty() ? nullptr : &rItem.sImage, nullptr); + } void insert_text(int pos, const OUString& rStr) { insert(pos, rStr, nullptr, nullptr, nullptr); } + void append(const weld::ComboBoxEntry& rItem) { insert(-1, rItem); } void append_text(const OUString& rStr) { insert(-1, rStr, nullptr, nullptr, nullptr); } void append(const OUString& rId, const OUString& rStr) { @@ -1919,10 +1925,7 @@ public: if (!bKeepExisting) m_xTreeView->clear(); for (const auto& rItem : rItems) - { - m_xTreeView->insert(-1, rItem.sString, rItem.sId.isEmpty() ? nullptr : &rItem.sId, - rItem.sImage.isEmpty() ? nullptr : &rItem.sImage, nullptr); - } + append(rItem); m_xTreeView->thaw(); }