vcl/qt5/QtInstanceTreeView.cxx | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
New commits: commit 59c49d566c1f491df97422dfb8bfc1102442d576 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Apr 25 22:16:11 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Sun Apr 27 07:24:34 2025 +0200 tdf#130857 qt weld: Implement QtInstanceTreeView::{g,s}et_sort_order As for the sort column, sorting by a certain sort order sets that sort order to be used in the future as well. Quoting the QSortFilterProxyModel::sortOrder doc [1]: > Returns the order currently used for sorting > > This returns the most recently used sort order. The default value is Qt::AscendingOrder. > > See also sort(). This will be used e.g. in Writer's "Tools" -> "AutoText" dialog once support for its .ui file (sw/uiconfig/swriter/ui/autotext.ui) will be declared in QtInstanceBuilder::IsUIFileSupported. [1] https://doc.qt.io/qt-6/qsortfilterproxymodel.html#sortOrder Change-Id: I4e569fde909188a1712eff45652772c95105d5d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184671 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/qt5/QtInstanceTreeView.cxx b/vcl/qt5/QtInstanceTreeView.cxx index 074144126855..545c23b24c8d 100644 --- a/vcl/qt5/QtInstanceTreeView.cxx +++ b/vcl/qt5/QtInstanceTreeView.cxx @@ -806,11 +806,24 @@ void QtInstanceTreeView::make_unsorted() bool QtInstanceTreeView::get_sort_order() const { - assert(false && "Not implemented yet"); - return false; + SolarMutexGuard g; + + bool bAscending = true; + GetQtInstance().RunInMainThread( + [&] { bAscending = m_pModel->sortOrder() == Qt::AscendingOrder; }); + + return bAscending; } -void QtInstanceTreeView::set_sort_order(bool) { assert(false && "Not implemented yet"); } +void QtInstanceTreeView::set_sort_order(bool bAscending) +{ + SolarMutexGuard g; + + GetQtInstance().RunInMainThread([&] { + const Qt::SortOrder eOrder = bAscending ? Qt::AscendingOrder : Qt::DescendingOrder; + m_pModel->sort(m_pModel->sortColumn(), eOrder); + }); +} void QtInstanceTreeView::set_sort_indicator(TriState, int) { commit c063d46fdfdae38344ce3531d7491857c99123e0 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Fri Apr 25 22:09:26 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Sun Apr 27 07:24:24 2025 +0200 tdf#130857 qt weld: Add SolarMutexGuard Change-Id: I190e865e2ea24ccc29bb7cbe1197472c16e4d259 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184670 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/qt5/QtInstanceTreeView.cxx b/vcl/qt5/QtInstanceTreeView.cxx index 0ce37cf8d1a7..074144126855 100644 --- a/vcl/qt5/QtInstanceTreeView.cxx +++ b/vcl/qt5/QtInstanceTreeView.cxx @@ -787,6 +787,8 @@ int QtInstanceTreeView::n_children() const void QtInstanceTreeView::make_sorted() { + SolarMutexGuard g; + GetQtInstance().RunInMainThread([&] { m_pTreeView->setSortingEnabled(true); // sort by first "normal" column @@ -797,6 +799,8 @@ void QtInstanceTreeView::make_sorted() void QtInstanceTreeView::make_unsorted() { + SolarMutexGuard g; + GetQtInstance().RunInMainThread([&] { m_pTreeView->setSortingEnabled(false); }); }