diff options
-rw-r--r-- | vcl/inc/qt5/QtInstanceTreeView.hxx | 3 | ||||
-rw-r--r-- | vcl/qt5/QtInstanceTreeView.cxx | 24 |
2 files changed, 25 insertions, 2 deletions
diff --git a/vcl/inc/qt5/QtInstanceTreeView.hxx b/vcl/inc/qt5/QtInstanceTreeView.hxx index 594168acc5bf..5cd107dc4862 100644 --- a/vcl/inc/qt5/QtInstanceTreeView.hxx +++ b/vcl/inc/qt5/QtInstanceTreeView.hxx @@ -180,6 +180,9 @@ public: using QtInstanceWidget::set_sensitive; using QtInstanceWidget::get_sensitive; + +private: + static QAbstractItemView::SelectionMode mapSelectionMode(SelectionMode eMode); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/qt5/QtInstanceTreeView.cxx b/vcl/qt5/QtInstanceTreeView.cxx index d462def967f6..7cda3a3694ad 100644 --- a/vcl/qt5/QtInstanceTreeView.cxx +++ b/vcl/qt5/QtInstanceTreeView.cxx @@ -515,9 +515,11 @@ void QtInstanceTreeView::set_column_title(int, const OUString&) assert(false && "Not implemented yet"); } -void QtInstanceTreeView::set_selection_mode(SelectionMode) +void QtInstanceTreeView::set_selection_mode(SelectionMode eMode) { - assert(false && "Not implemented yet"); + SolarMutexGuard g; + GetQtInstance().RunInMainThread( + [&] { m_pTreeView->setSelectionMode(mapSelectionMode(eMode)); }); } int QtInstanceTreeView::count_selected_rows() const @@ -569,4 +571,22 @@ weld::TreeView* QtInstanceTreeView::get_drag_source() const return nullptr; } +QAbstractItemView::SelectionMode QtInstanceTreeView::mapSelectionMode(SelectionMode eMode) +{ + switch (eMode) + { + case SelectionMode::NONE: + return QAbstractItemView::NoSelection; + case SelectionMode::Single: + return QAbstractItemView::SingleSelection; + case SelectionMode::Range: + return QAbstractItemView::ContiguousSelection; + case SelectionMode::Multiple: + return QAbstractItemView::ExtendedSelection; + default: + assert(false && "unhandled selection mode"); + return QAbstractItemView::SingleSelection; + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |