cui/source/inc/numfmt.hxx | 4 ++-- cui/source/tabpages/numfmt.cxx | 11 ++++------- vcl/inc/qt5/QtTreeViewModel.hxx | 7 ++++--- vcl/qt5/QtInstanceBuilder.cxx | 3 +++ vcl/qt5/QtInstanceTreeView.cxx | 18 ++++++++++++++---- vcl/qt5/QtTreeViewModel.cxx | 11 +++++++++-- 6 files changed, 36 insertions(+), 18 deletions(-)
New commits: commit ff9949f20e284d0decbb292a3914c11ddd1a4554 Author: Michael Weghorn <[email protected]> AuthorDate: Thu Jan 22 23:24:46 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Jan 23 10:41:15 2026 +0100 tdf#130857 qt weld: Implement QtInstanceTreeView::start_editing As seen in the vcl implementation (SalInstanceTreeView::start_editing), start editing for the first editable column. Switch QtTreeViewModel::m_aEditableColumns from std::unordered set to std::vector and ensure it is sorted, to allow to simply use the first vector element when the index of the first editable column is needed. Implementing QtInstanceTreeView::start_editing is one step towards supporting Writer's "Insert" -> "Bookmark" dialog with native Qt widgets. Change-Id: I81c2e060693bb428d3cf8a796d0f20fe4fa3177b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197882 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/vcl/inc/qt5/QtTreeViewModel.hxx b/vcl/inc/qt5/QtTreeViewModel.hxx index f485cd174187..6f4590a7f0e9 100644 --- a/vcl/inc/qt5/QtTreeViewModel.hxx +++ b/vcl/inc/qt5/QtTreeViewModel.hxx @@ -14,14 +14,14 @@ #include <QtCore/QSortFilterProxyModel> #include <QtWidgets/QWidget> -#include <unordered_set> +#include <vector> /** Item model for QtInstanceTreeView. */ class QtTreeViewModel : public QSortFilterProxyModel { Q_OBJECT - std::unordered_set<int> m_aEditableColumns; + std::vector<int> m_aEditableColumns; public: QtTreeViewModel(QWidget* pParent); @@ -30,7 +30,8 @@ public: virtual bool hasChildren(const QModelIndex& rIndex = QModelIndex()) const override; - void setEditableColumns(const std::unordered_set<int>& rEditableColumns); + std::vector<int> editableColumns() const; + void setEditableColumns(const std::vector<int>& rEditableColumns); bool getChildrenOnDemand(const QModelIndex& rIndex) const; void setChildrenOnDemand(const QModelIndex& rIndex, bool bOnDemandChildren); diff --git a/vcl/qt5/QtInstanceTreeView.cxx b/vcl/qt5/QtInstanceTreeView.cxx index 651c74d783ba..5f5e5238cfc4 100644 --- a/vcl/qt5/QtInstanceTreeView.cxx +++ b/vcl/qt5/QtInstanceTreeView.cxx @@ -550,9 +550,19 @@ bool QtInstanceTreeView::get_children_on_demand(const weld::TreeIter& rIter) con void QtInstanceTreeView::set_show_expanders(bool) { assert(false && "Not implemented yet"); } -void QtInstanceTreeView::start_editing(const weld::TreeIter&) +void QtInstanceTreeView::start_editing(const weld::TreeIter& rEntry) { - assert(false && "Not implemented yet"); + SolarMutexGuard g; + + GetQtInstance().RunInMainThread([&] { + // edit item in first editable column + const std::vector<int> aEditableColumns = m_pModel->editableColumns(); + assert(!aEditableColumns.empty() && "No editable column"); + const int nColumnIndex = aEditableColumns.front(); + const QModelIndex aIndex = modelIndex(rEntry, nColumnIndex); + m_pTreeView->setCurrentIndex(aIndex); + m_pTreeView->edit(aIndex); + }); } void QtInstanceTreeView::end_editing() { assert(false && "Not implemented yet"); } @@ -674,11 +684,11 @@ void QtInstanceTreeView::set_column_fixed_widths(const std::vector<int>& rWidths void QtInstanceTreeView::set_column_editables(const std::vector<bool>& rEditables) { - std::unordered_set<int> aEditableColumns; + std::vector<int> aEditableColumns; for (size_t i = 0; i < rEditables.size(); i++) { if (rEditables.at(i)) - aEditableColumns.insert(i); + aEditableColumns.push_back(i); } m_pModel->setEditableColumns(aEditableColumns); diff --git a/vcl/qt5/QtTreeViewModel.cxx b/vcl/qt5/QtTreeViewModel.cxx index 4c41a175d3f5..647fe8dc1f81 100644 --- a/vcl/qt5/QtTreeViewModel.cxx +++ b/vcl/qt5/QtTreeViewModel.cxx @@ -25,7 +25,7 @@ Qt::ItemFlags QtTreeViewModel::flags(const QModelIndex& rIndex) const { Qt::ItemFlags eFlags = QSortFilterProxyModel::flags(rIndex); - if (!m_aEditableColumns.contains(rIndex.column())) + if (std::ranges::find(m_aEditableColumns, rIndex.column()) == m_aEditableColumns.end()) eFlags &= ~Qt::ItemIsEditable; return eFlags; @@ -39,8 +39,15 @@ bool QtTreeViewModel::hasChildren(const QModelIndex& rIndex) const return QSortFilterProxyModel::hasChildren(rIndex); } -void QtTreeViewModel::setEditableColumns(const std::unordered_set<int>& rEditableColumns) +std::vector<int> QtTreeViewModel::editableColumns() const { + assert(std::ranges::is_sorted(m_aEditableColumns)); + return m_aEditableColumns; +} + +void QtTreeViewModel::setEditableColumns(const std::vector<int>& rEditableColumns) +{ + assert(std::ranges::is_sorted(rEditableColumns)); m_aEditableColumns = rEditableColumns; } commit 43b38aadcaad0ccd3315ef8b1ff0dace39c60b6a Author: Michael Weghorn <[email protected]> AuthorDate: Thu Jan 22 22:43:11 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Jan 23 10:41:08 2026 +0100 tdf#130857 qt weld: Support Base "Field Format" dialog This means that native Qt widgets are used for that dialog now when using the qt5 or qt6 VCL plugin and starting LO with environment variable SAL_VCL_QT_USE_WELDED_WIDGETS=1 set. The dialog can be triggered like this: * start Base, create any new database * with "Tables" selected in the sidebar on the left, choose "Create Table in Design View..." * enter any field name and field type * at the bottom of the window, press the "Format field" button next to "Format example" Change-Id: Id26f050e287d9dffd7fd0598080c0a4100794486 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197880 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx index 7a1fd50e17c1..3b2604461d9a 100644 --- a/vcl/qt5/QtInstanceBuilder.cxx +++ b/vcl/qt5/QtInstanceBuilder.cxx @@ -121,6 +121,7 @@ bool QtInstanceBuilder::IsUIFileSupported(const OUString& rUIFile, const weld::W u"cui/ui/widgettestdialog.ui"_ustr, u"cui/ui/zoomdialog.ui"_ustr, u"dbaccess/ui/designsavemodifieddialog.ui"_ustr, + u"dbaccess/ui/fielddialog.ui"_ustr, u"dbaccess/ui/savedialog.ui"_ustr, u"dbaccess/ui/tabledesignsavemodifieddialog.ui"_ustr, u"desktop/ui/installforalldialog.ui"_ustr, @@ -267,11 +268,13 @@ bool QtInstanceBuilder::IsUIFileSupported(const OUString& rUIFile, const weld::W static std::unordered_set<OUString> aSupportedWithQtParent = { u"cui/ui/additionsfragment.ui"_ustr, u"cui/ui/appearance.ui"_ustr, + u"cui/ui/cellalignment.ui"_ustr, u"cui/ui/graphictestentry.ui"_ustr, u"cui/ui/lineendstabpage.ui"_ustr, u"cui/ui/linetabpage.ui"_ustr, u"cui/ui/linestyletabpage.ui"_ustr, u"cui/ui/macroassignpage.ui"_ustr, + u"cui/ui/numberingformatpage.ui"_ustr, u"cui/ui/optlingupage.ui"_ustr, u"cui/ui/possizetabpage.ui"_ustr, u"cui/ui/rotationtabpage.ui"_ustr, commit 86d77e6fb05cd6e059f25c4cad33c11f78c8b165 Author: Michael Weghorn <[email protected]> AuthorDate: Thu Jan 22 22:35:51 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Jan 23 10:41:01 2026 +0100 tdf#130857 cui: Enable/Disable whole frame instead of label + content (II) Don't set the frame's internal label child and the widgets it contains to enabled/disabled separately, but do so for the whole frame. Do this for both, the "Category" and the "Format" frames in the numbering format tab page. This also prepares for supporting this tab page with native Qt widgets, where no separate widget exist for the frames' internal label children. 2 ways to trigger dialogs using the tab page: 1) * start Writer * "Insert" -> "Chart" * double-click on the y axis of the chart to open the "Y Axis" dialog * switch to the "Numbers" tab page 2) * start Base, create any new database * with "Tables" selected in the sidebar on the left, choose "Create Table in Design View..." * enter any field name and field type * at the bottom of the window, press the "Format field" button next to "Format example" Change-Id: I4886b57238df1f177d8794c0797a92c5c80cddbc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197879 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/cui/source/inc/numfmt.hxx b/cui/source/inc/numfmt.hxx index bb7db5326308..340cdfb0aee0 100644 --- a/cui/source/inc/numfmt.hxx +++ b/cui/source/inc/numfmt.hxx @@ -91,9 +91,9 @@ private: OUString sAutomaticCurrencyEntry; SvxNumberPreview m_aWndPreview; - std::unique_ptr<weld::Label> m_xFtCategory; + std::unique_ptr<weld::Frame> m_xCategoryFrame; std::unique_ptr<weld::TreeView> m_xLbCategory; - std::unique_ptr<weld::Label> m_xFtFormat; + std::unique_ptr<weld::Frame> m_xFormatFrame; std::unique_ptr<weld::ComboBox> m_xLbCurrency; std::unique_ptr<weld::TreeView> m_xLbFormat; std::unique_ptr<weld::Frame> m_xFrameLocale; diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index 831a50dc6d92..c58e5ed07cf9 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -196,9 +196,9 @@ SvxNumberFormatTabPage::SvxNumberFormatTabPage(weld::Container* pPage, weld::Dia , m_nLbFormatSelPosEdComment(SELPOS_NONE) , bLegacyAutomaticCurrency(false) , sAutomaticLangEntry(CuiResId(RID_CUISTR_AUTO_ENTRY)) - , m_xFtCategory(m_xBuilder->weld_label(u"categoryft"_ustr)) + , m_xCategoryFrame(m_xBuilder->weld_frame(u"categoryframe"_ustr)) , m_xLbCategory(m_xBuilder->weld_tree_view(u"categorylb"_ustr)) - , m_xFtFormat(m_xBuilder->weld_label(u"formatft"_ustr)) + , m_xFormatFrame(m_xBuilder->weld_frame(u"formatframe"_ustr)) , m_xLbCurrency(m_xBuilder->weld_combo_box(u"currencylb"_ustr)) , m_xLbFormat(m_xBuilder->weld_tree_view(u"formatlb"_ustr)) , m_xFrameLocale(m_xBuilder->weld_frame(u"localeframe"_ustr)) @@ -578,11 +578,8 @@ void SvxNumberFormatTabPage::EnableBySourceFormat_Impl() bool bEnable = !m_xCbSourceFormat->get_active(); if ( !bEnable ) m_xCbSourceFormat->grab_focus(); - m_xFtCategory->set_sensitive( bEnable ); - m_xLbCategory->set_sensitive( bEnable ); - m_xFtFormat->set_sensitive( bEnable ); - m_xLbCurrency->set_sensitive( bEnable ); - m_xLbFormat->set_sensitive( bEnable ); + m_xCategoryFrame->set_sensitive(bEnable); + m_xFormatFrame->set_sensitive(bEnable); m_xFrameLocale->set_sensitive(bEnable); m_xOptionsFrame->set_sensitive(bEnable); m_xFtDecimals->set_sensitive( bEnable );
