extensions/source/propctrlr/browserline.cxx | 12 +++++--- extensions/source/propctrlr/browserline.hxx | 2 - extensions/source/propctrlr/browserlistbox.cxx | 6 +--- extensions/source/propctrlr/browserlistbox.hxx | 1 extensions/uiconfig/spropctrlr/ui/browserpage.ui | 5 ++- vcl/qt5/QtInstanceContainer.cxx | 34 ++++++++++++----------- 6 files changed, 34 insertions(+), 26 deletions(-)
New commits: commit b439b50d687929c2ee2d650801f6c5625ccc1c44 Author: Michael Weghorn <[email protected]> AuthorDate: Tue Jan 20 16:12:11 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Thu Jan 22 11:15:06 2026 +0100 tdf#130857 qt weld: Run QtInstanceContainer::move in main thread As for other methods interacting with native Qt widgets: Make sure the logic is run in the main thread. This fixes an assert seen in a WIP branch experimenting with implementing support for the form properties dialog for native Qt widgets with SAL_VCL_QT_USE_WELDED_WIDGETS=1. Change-Id: I8bc96a077941a500660dba9563f60d099b84ef8a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197680 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins diff --git a/vcl/qt5/QtInstanceContainer.cxx b/vcl/qt5/QtInstanceContainer.cxx index 249d902ab86e..87dd8122037a 100644 --- a/vcl/qt5/QtInstanceContainer.cxx +++ b/vcl/qt5/QtInstanceContainer.cxx @@ -20,23 +20,27 @@ QtInstanceContainer::QtInstanceContainer(QWidget* pWidget) void QtInstanceContainer::move(weld::Widget* pWidget, weld::Container* pNewParent) { - QtInstanceWidget* pQtInstanceWidget = dynamic_cast<QtInstanceWidget*>(pWidget); - assert(pQtInstanceWidget); - QWidget* pQWidget = pQtInstanceWidget->getQWidget(); - assert(pQWidget); - getLayout().removeWidget(pQWidget); + SolarMutexGuard g; - if (!pNewParent) - { - pQWidget->hide(); - pQWidget->deleteLater(); - return; - } + GetQtInstance().RunInMainThread([&] { + QtInstanceWidget* pQtInstanceWidget = dynamic_cast<QtInstanceWidget*>(pWidget); + assert(pQtInstanceWidget); + QWidget* pQWidget = pQtInstanceWidget->getQWidget(); + assert(pQWidget); + getLayout().removeWidget(pQWidget); - QtInstanceContainer* pNewContainer = dynamic_cast<QtInstanceContainer*>(pNewParent); - assert(pNewContainer); - QLayout& rNewLayout = pNewContainer->getLayout(); - rNewLayout.addWidget(pQWidget); + if (!pNewParent) + { + pQWidget->hide(); + pQWidget->deleteLater(); + return; + } + + QtInstanceContainer* pNewContainer = dynamic_cast<QtInstanceContainer*>(pNewParent); + assert(pNewContainer); + QLayout& rNewLayout = pNewContainer->getLayout(); + rNewLayout.addWidget(pQWidget); + }); } css::uno::Reference<css::awt::XWindow> QtInstanceContainer::CreateChildFrame() commit be50bf63f23a6b66161b04866227851fdd57d345 Author: Michael Weghorn <[email protected]> AuthorDate: Tue Jan 20 15:50:01 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Thu Jan 22 11:14:56 2026 +0100 tdf#130857 propctrlr: Use Grid instead of SizeGroup for label sizing Instead of having a separate weld::SizeGroup to ensure that the labels in the "Form Properties" dialog have the same width and therefore the remaining widgets in all lines are aligned at the same x position (next to where the label in that line ends), have the labels in a separte column of the parent grid. This way, the parent grid calculates the width of that new first column to make sure the labels all fit into it. Since the other OBrowserLine widgets are now in the second column, they are automatically aligned at the same x position for all rows as well (at the start position of the second column). This will also help the qt weld implementation, which doesn't support weld::SizeGroup (yet?). (See the assert in QtInstanceBuilder::create_size_group.) No real change in behavior intended. The dialog can e.g. be triggered like this: * start Writer * "Form" -> "Form Navigator" * right-click on "Forms" to open the context menu * activate menu entry "New" -> "Form" and confirm the default name by pressing Enter * right-click on "Form" to open the context menu * activate the "Properties" menu entry Change-Id: Ic74e99a5beb75e6a2c4208073b3997e7a005bf91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197679 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/extensions/source/propctrlr/browserline.cxx b/extensions/source/propctrlr/browserline.cxx index b2103316b583..55778dd2ae13 100644 --- a/extensions/source/propctrlr/browserline.cxx +++ b/extensions/source/propctrlr/browserline.cxx @@ -50,7 +50,7 @@ using ::com::sun::star::graphic::XGraphic; namespace PropertyLineElement = ::com::sun::star::inspection::PropertyLineElement; OBrowserLine::OBrowserLine(OUString aEntryName, weld::Grid& rParent, int nGridRowIndex, - weld::SizeGroup* pLabelGroup, weld::Container* pInitialControlParent) + weld::Container* pInitialControlParent) : m_sEntryName(std::move(aEntryName)) , m_xBuilder(Application::CreateBuilder(&rParent, u"modules/spropctrlr/ui/browserline.ui"_ustr)) , m_xGrid(m_xBuilder->weld_grid(u"BrowserLine"_ustr)) @@ -69,16 +69,20 @@ OBrowserLine::OBrowserLine(OUString aEntryName, weld::Grid& rParent, int nGridRo , m_bIndentTitle(false) , m_bReadOnly(false) { - m_rParent.set_child_top_attach(*m_xGrid, nGridRowIndex); - m_rParent.set_child_left_attach(*m_xGrid, 0); + // move label to first column of parent grid for same label/column width in all rows + m_xGrid->move(m_xFtTitle.get(), &m_rParent); + m_rParent.set_child_top_attach(*m_xFtTitle, nGridRowIndex); + m_rParent.set_child_left_attach(*m_xFtTitle, 0); - pLabelGroup->add_widget(m_xFtTitle.get()); + m_rParent.set_child_top_attach(*m_xGrid, nGridRowIndex); + m_rParent.set_child_left_attach(*m_xGrid, 1); } OBrowserLine::~OBrowserLine() { implHideBrowseButton(true); implHideBrowseButton(false); + m_rParent.move(m_xFtTitle.get(), nullptr); m_rParent.move(m_xGrid.get(), nullptr); } diff --git a/extensions/source/propctrlr/browserline.hxx b/extensions/source/propctrlr/browserline.hxx index 201d380fbc38..0fd8f88f8d71 100644 --- a/extensions/source/propctrlr/browserline.hxx +++ b/extensions/source/propctrlr/browserline.hxx @@ -64,7 +64,7 @@ private: public: OBrowserLine(OUString aEntryName, weld::Grid& rParent, int nGridRowIndex, - weld::SizeGroup* pLabelGroup, weld::Container* pInitialControlParent); + weld::Container* pInitialControlParent); ~OBrowserLine(); void setControl(const css::uno::Reference<css::inspection::XPropertyControl>& rxControl); diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx index b714497f6a39..e66dec6f3c91 100644 --- a/extensions/source/propctrlr/browserlistbox.cxx +++ b/extensions/source/propctrlr/browserlistbox.cxx @@ -296,7 +296,6 @@ void PropertyControlContext_Impl::impl_processEvent_throw(const ::comphelper::An OBrowserListBox::OBrowserListBox(weld::Builder& rBuilder, weld::Container* pContainer) : m_xScrolledWindow(rBuilder.weld_scrolled_window(u"scrolledwindow"_ustr)) , m_xLinesPlayground(rBuilder.weld_grid(u"playground"_ustr)) - , m_xSizeGroup(rBuilder.create_size_group()) , m_xHelpWindow(new InspectorHelpWindow(rBuilder)) , m_pInitialControlParent(pContainer) , m_pLineListener(nullptr) @@ -462,9 +461,8 @@ void OBrowserListBox::InsertEntry(const OLineDescriptor& rPropertyData, sal_uInt } // create a new line - BrowserLinePointer pBrowserLine - = std::make_shared<OBrowserLine>(rPropertyData.sName, *m_xLinesPlayground, nGridRowIndex, - m_xSizeGroup.get(), m_pInitialControlParent); + BrowserLinePointer pBrowserLine = std::make_shared<OBrowserLine>( + rPropertyData.sName, *m_xLinesPlayground, nGridRowIndex, m_pInitialControlParent); ListBoxLine aNewLine(rPropertyData.sName, pBrowserLine, rPropertyData.xPropertyHandler); ListBoxLines::size_type nInsertPos = _nPos; diff --git a/extensions/source/propctrlr/browserlistbox.hxx b/extensions/source/propctrlr/browserlistbox.hxx index 1c4c74a52c4d..2246c964d3e0 100644 --- a/extensions/source/propctrlr/browserlistbox.hxx +++ b/extensions/source/propctrlr/browserlistbox.hxx @@ -65,7 +65,6 @@ class OBrowserListBox final : public IButtonClickListener { std::unique_ptr<weld::ScrolledWindow> m_xScrolledWindow; std::unique_ptr<weld::Grid> m_xLinesPlayground; - std::unique_ptr<weld::SizeGroup> m_xSizeGroup; std::unique_ptr<InspectorHelpWindow> m_xHelpWindow; weld::Container* m_pInitialControlParent; ListBoxLines m_aLines; diff --git a/extensions/uiconfig/spropctrlr/ui/browserpage.ui b/extensions/uiconfig/spropctrlr/ui/browserpage.ui index 9d3055915e0f..3bbb2e219cb6 100644 --- a/extensions/uiconfig/spropctrlr/ui/browserpage.ui +++ b/extensions/uiconfig/spropctrlr/ui/browserpage.ui @@ -28,7 +28,7 @@ <property name="vexpand">True</property> <property name="orientation">vertical</property> <child> - <!-- n-columns=1 n-rows=1 --> + <!-- n-columns=2 n-rows=1 --> <object class="GtkGrid" id="playground"> <property name="visible">True</property> <property name="can-focus">False</property> @@ -44,6 +44,9 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="expand">False</property>
