formula/source/ui/dlg/structpg.cxx | 6 ++-- formula/uiconfig/ui/structpage.ui | 31 ++++++++++++++----------- vcl/inc/qt5/QtInstanceTextView.hxx | 4 +++ vcl/inc/qt5/QtInstanceTreeView.hxx | 2 + vcl/qt5/QtInstanceNotebook.cxx | 6 ++++ vcl/qt5/QtInstanceTextView.cxx | 17 +++++++++++++ vcl/qt5/QtInstanceToolbar.cxx | 26 +++++++++++++++++---- vcl/qt5/QtInstanceTreeView.cxx | 45 +++++++++++++------------------------ 8 files changed, 87 insertions(+), 50 deletions(-)
New commits: commit c2f9e4f16adbe438a09fb3fec8ecd668e5c41012 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Jul 21 19:32:57 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Jul 22 07:21:35 2025 +0200 tdf#130857 qt weld: Handle Notebook without current page In QtInstanceNotebook::get_current_page_ident, handle the case where there is no current page (i.e. the current index is -1) by returning an empty string, instead of passing that invalid index to QtInstanceNotebook::get_page_index which would trigger an assert. This was seen in a WIP branch for the reportbuilder Conditional Formatting and Function Wizard dialogs, because the FormulaDlg_Impl dtor (s. frame 75 below) explicitly removes all of its pages, so none remains to be the current one. Backtrace: 1 __pthread_kill_implementation pthread_kill.c 44 0x7ffff789e95c 2 __pthread_kill_internal pthread_kill.c 89 0x7ffff789e9ff 3 __GI_raise raise.c 26 0x7ffff7849cc2 4 __GI_abort abort.c 73 0x7ffff78324ac 5 __assert_fail_base assert.c 118 0x7ffff7832420 6 QtInstanceNotebook::get_page_ident(int) const::$_0::operator()() const QtInstanceNotebook.cxx 69 0x7fffe6297f62 7 std::__invoke_impl<void, QtInstanceNotebook::get_page_ident(int) const::$_0&>(std::__invoke_other, QtInstanceNotebook::get_page_ident(int) const::$_0&) invoke.h 61 0x7fffe6297ef5 8 std::__invoke_r<void, QtInstanceNotebook::get_page_ident(int) const::$_0&>(QtInstanceNotebook::get_page_ident(int) const::$_0&) invoke.h 111 0x7fffe6297eb5 9 std::_Function_handler<void(), QtInstanceNotebook::get_page_ident(int) const::$_0>::_M_invoke std_function.h 290 0x7fffe6297d9d 10 std::function<void()>::operator() std_function.h 591 0x7fffe61ffc7e 11 QtInstance::RunInMainThread QtInstance.cxx 204 0x7fffe61f749f 12 QtInstanceNotebook::get_page_ident QtInstanceNotebook.cxx 67 0x7fffe6295f5c 13 QtInstanceNotebook::get_current_page_ident() const::$_0::operator()() const QtInstanceNotebook.cxx 82 0x7fffe62983dc 14 std::__invoke_impl<void, QtInstanceNotebook::get_current_page_ident() const::$_0&>(std::__invoke_other, QtInstanceNotebook::get_current_page_ident() const::$_0&) invoke.h 61 0x7fffe6298385 15 std::__invoke_r<void, QtInstanceNotebook::get_current_page_ident() const::$_0&>(QtInstanceNotebook::get_current_page_ident() const::$_0&) invoke.h 111 0x7fffe6298335 16 std::_Function_handler<void(), QtInstanceNotebook::get_current_page_ident() const::$_0>::_M_invoke std_function.h 290 0x7fffe629824d 17 std::function<void()>::operator() std_function.h 591 0x7fffe61ffc7e 18 QtInstance::RunInMainThread QtInstance.cxx 204 0x7fffe61f749f 19 QtInstanceNotebook::get_current_page_ident QtInstanceNotebook.cxx 82 0x7fffe6296190 20 QtInstanceNotebook::currentTabChanged QtInstanceNotebook.cxx 187 0x7fffe6295430 21 QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, QtPrivate::List<>, void, void (QtInstanceNotebook:: *)()>::call(void (QtInstanceNotebook:: *)(), QtInstanceNotebook *, void * *)::{lambda()#1}::operator()() const qobjectdefs_impl.h 127 0x7fffe629b9a1 22 QtPrivate::FunctorCallBase::call_internal<void, QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, QtPrivate::List<>, void, void (QtInstanceNotebook:: *)()>::call(void (QtInstanceNotebook:: *)(), QtInstanceNotebook *, void * *)::{lambda()#1}>(void * *, QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, QtPrivate::List<>, void, void (QtInstanceNotebook:: *)()>::call(void (QtInstanceNotebook:: *)(), QtInstanceNotebook *, void * *)::{lambda()#1}&&) qobjectdefs_impl.h 65 0x7fffe629b8d9 23 QtPrivate::FunctorCall<std::integer_sequence<unsigned long>, QtPrivate::List<>, void, void (QtInstanceNotebook:: *)()>::call(void (QtInstanceNotebook:: *)(), QtInstanceNotebook *, void * *) qobjectdefs_impl.h 126 0x7fffe629b80b 24 QtPrivate::FunctionPointer<void (QtInstanceNotebook:: *)()>::call<QtPrivate::List<>, void>(void (QtInstanceNotebook:: *)(), QtInstanceNotebook *, void * *) qobjectdefs_impl.h 174 0x7fffe629b78d 25 QtPrivate::QCallableObject<void (QtInstanceNotebook:: *)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void * *, bool *) qobjectdefs_impl.h 545 0x7fffe629b6b6 26 QtPrivate::QSlotObjectBase::call qobjectdefs_impl.h 461 0x7fffe5107b22 27 doActivate<false> qobject.cpp 4343 0x7fffe532d25f 28 QMetaObject::activate qobject.cpp 4403 0x7fffe5323343 29 QMetaObject::activate<void, int> qobjectdefs.h 319 0x7fffe31db40b 30 QTabWidget::currentChanged moc_qtabwidget.cpp 263 0x7fffe36302f8 31 QTabWidgetPrivate::showTab qtabwidget.cpp 760 0x7fffe36300cb 32 QtPrivate::FunctorCall<std::integer_sequence<unsigned long, 0ul>, QtPrivate::List<int>, void, void (QTabWidgetPrivate:: *)(int)>::call(void (QTabWidgetPrivate:: *)(int), QTabWidgetPrivate *, void * *)::{lambda()#1}::operator()() const qobjectdefs_impl.h 127 0x7fffe363360a 33 QtPrivate::FunctorCallBase::call_internal<void, QtPrivate::FunctorCall<std::integer_sequence<unsigned long, 0ul>, QtPrivate::List<int>, void, void (QTabWidgetPrivate:: *)(int)>::call(void (QTabWidgetPrivate:: *)(int), QTabWidgetPrivate *, void * *)::{lambda()#1}>(void * *, QtPrivate::FunctorCall<std::integer_sequence<unsigned long, 0ul>, QtPrivate::List<int>, void, void (QTabWidgetPrivate:: *)(int)>::call(void (QTabWidgetPrivate:: *)(int), QTabWidgetPrivate *, void * *)::{lambda()#1}&&) qobjectdefs_impl.h 65 0x7fffe363347d 34 QtPrivate::FunctorCall<std::integer_sequence<unsigned long, 0ul>, QtPrivate::List<int>, void, void (QTabWidgetPrivate:: *)(int)>::call qobjectdefs_impl.h 126 0x7fffe3633407 35 QtPrivate::FunctionPointer<void (QTabWidgetPrivate:: *)(int)>::call<QtPrivate::List<int>, void> qobjectdefs_impl.h 174 0x7fffe3633371 36 QtPrivate::QPrivateSlotObject<void (QTabWidgetPrivate:: *)(int), QtPrivate::List<int>, void>::impl qobject_p.h 272 0x7fffe36332a0 37 QtPrivate::QSlotObjectBase::call qobjectdefs_impl.h 461 0x7fffe5107b22 38 doActivate<false> qobject.cpp 4343 0x7fffe532d25f 39 QMetaObject::activate qobject.cpp 4403 0x7fffe5323343 40 QMetaObject::activate<void, int> qobjectdefs.h 319 0x7fffe31db40b 41 QTabBar::currentChanged moc_qtabbar.cpp 269 0x7fffe35f6d78 42 QTabBar::removeTab qtabbar.cpp 1077 0x7fffe35f6a1e 43 QTabWidgetPrivate::removeTab qtabwidget.cpp 766 0x7fffe362e86a 44 QtPrivate::FunctorCall<std::integer_sequence<unsigned long, 0ul>, QtPrivate::List<int>, void, void (QTabWidgetPrivate:: *)(int)>::call(void (QTabWidgetPrivate:: *)(int), QTabWidgetPrivate *, void * *)::{lambda()#1}::operator()() const qobjectdefs_impl.h 127 0x7fffe363360a 45 QtPrivate::FunctorCallBase::call_internal<void, QtPrivate::FunctorCall<std::integer_sequence<unsigned long, 0ul>, QtPrivate::List<int>, void, void (QTabWidgetPrivate:: *)(int)>::call(void (QTabWidgetPrivate:: *)(int), QTabWidgetPrivate *, void * *)::{lambda()#1}>(void * *, QtPrivate::FunctorCall<std::integer_sequence<unsigned long, 0ul>, QtPrivate::List<int>, void, void (QTabWidgetPrivate:: *)(int)>::call(void (QTabWidgetPrivate:: *)(int), QTabWidgetPrivate *, void * *)::{lambda()#1}&&) qobjectdefs_impl.h 65 0x7fffe363347d 46 QtPrivate::FunctorCall<std::integer_sequence<unsigned long, 0ul>, QtPrivate::List<int>, void, void (QTabWidgetPrivate:: *)(int)>::call qobjectdefs_impl.h 126 0x7fffe3633407 47 QtPrivate::FunctionPointer<void (QTabWidgetPrivate:: *)(int)>::call<QtPrivate::List<int>, void> qobjectdefs_impl.h 174 0x7fffe3633371 48 QtPrivate::QPrivateSlotObject<void (QTabWidgetPrivate:: *)(int), QtPrivate::List<int>, void>::impl qobject_p.h 272 0x7fffe36332a0 49 QtPrivate::QSlotObjectBase::call qobjectdefs_impl.h 461 0x7fffe5107b22 50 doActivate<false> qobject.cpp 4343 0x7fffe532d25f 51 QMetaObject::activate qobject.cpp 4403 0x7fffe5323343 52 QMetaObject::activate<void, int> qobjectdefs.h 319 0x7fffe31db40b 53 QStackedWidget::widgetRemoved moc_qstackedwidget.cpp 194 0x7fffe35ea6cd 54 QtPrivate::FunctorCall<std::integer_sequence<unsigned long, 0ul>, QtPrivate::List<int>, void, void (QStackedWidget:: *)(int)>::call(void (QStackedWidget:: *)(int), QStackedWidget *, void * *)::{lambda()#1}::operator()() const qobjectdefs_impl.h 127 0x7fffe35eb84a 55 QtPrivate::FunctorCallBase::call_internal<void, QtPrivate::FunctorCall<std::integer_sequence<unsigned long, 0ul>, QtPrivate::List<int>, void, void (QStackedWidget:: *)(int)>::call(void (QStackedWidget:: *)(int), QStackedWidget *, void * *)::{lambda()#1}>(void * *, QtPrivate::FunctorCall<std::integer_sequence<unsigned long, 0ul>, QtPrivate::List<int>, void, void (QStackedWidget:: *)(int)>::call(void (QStackedWidget:: *)(int), QStackedWidget *, void * *)::{lambda()#1}&&) qobjectdefs_impl.h 65 0x7fffe35eb75d 56 QtPrivate::FunctorCall<std::integer_sequence<unsigned long, 0ul>, QtPrivate::List<int>, void, void (QStackedWidget:: *)(int)>::call qobjectdefs_impl.h 126 0x7fffe35eb677 57 QtPrivate::FunctionPointer<void (QStackedWidget:: *)(int)>::call<QtPrivate::List<int>, void> qobjectdefs_impl.h 174 0x7fffe35eb5e1 58 QtPrivate::QCallableObject<void (QStackedWidget:: *)(int), QtPrivate::List<int>, void>::impl qobjectdefs_impl.h 545 0x7fffe35eb50b 59 QtPrivate::QSlotObjectBase::call qobjectdefs_impl.h 461 0x7fffe5107b22 60 doActivate<false> qobject.cpp 4343 0x7fffe532d25f 61 QMetaObject::activate qobject.cpp 4403 0x7fffe5323343 62 QMetaObject::activate<void, int> qobjectdefs.h 319 0x7fffe31db40b 63 QStackedLayout::widgetRemoved moc_qstackedlayout.cpp 185 0x7fffe327a8c8 64 QStackedLayout::takeAt qstackedlayout.cpp 260 0x7fffe327a7df 65 QLayout::removeWidget qlayout.cpp 1461 0x7fffe326994c 66 QStackedWidget::removeWidget qstackedwidget.cpp 176 0x7fffe35ea8fd 67 QTabWidget::removeTab qtabwidget.cpp 631 0x7fffe362fef2 68 QtInstanceNotebook::remove_page(rtl::OUString const&)::$_0::operator()() const QtInstanceNotebook.cxx 100 0x7fffe6298ae3 69 std::__invoke_impl<void, QtInstanceNotebook::remove_page(rtl::OUString const&)::$_0&>(std::__invoke_other, QtInstanceNotebook::remove_page(rtl::OUString const&)::$_0&) invoke.h 61 0x7fffe6298aa5 70 std::__invoke_r<void, QtInstanceNotebook::remove_page(rtl::OUString const&)::$_0&>(QtInstanceNotebook::remove_page(rtl::OUString const&)::$_0&) invoke.h 111 0x7fffe6298a55 71 std::_Function_handler<void(), QtInstanceNotebook::remove_page(rtl::OUString const&)::$_0>::_M_invoke std_function.h 290 0x7fffe629896d 72 std::function<void()>::operator() std_function.h 591 0x7fffe61ffc7e 73 QtInstance::RunInMainThread QtInstance.cxx 204 0x7fffe61f749f 74 QtInstanceNotebook::remove_page QtInstanceNotebook.cxx 100 0x7fffe629658a 75 formula::FormulaDlg_Impl::~FormulaDlg_Impl formula.cxx 331 0x7fff6ef49f78 76 o3tl::default_delete<formula::FormulaDlg_Impl>::operator() deleter.hxx 46 0x7fff6ef630e7 77 std::unique_ptr<formula::FormulaDlg_Impl, o3tl::default_delete<formula::FormulaDlg_Impl>>::~unique_ptr unique_ptr.h 399 0x7fff6ef5934f 78 formula::FormulaModalDialog::~FormulaModalDialog formula.cxx 1801 0x7fff6ef53b0a 79 rptui::FormulaDialog::~FormulaDialog Formula.cxx 101 0x7fff2c567b4a 80 rptui::openDialogFormula_nothrow UITools.cxx 1025 0x7fff2c60df9c 81 rptui::ConditionField::OnFormula Condition.cxx 63 0x7fff2c558376 82 rptui::ConditionField::LinkStubOnFormula Condition.cxx 52 0x7fff2c5581fd 83 Link<weld::Button&, void>::Call link.hxx 105 0x7fffe6245161 84 weld::Button::signal_clicked weld.hxx 1568 0x7fffe6244f3c ... Change-Id: Iac96cc00ee3eee3828c24a3c096101861452884f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188127 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/qt5/QtInstanceNotebook.cxx b/vcl/qt5/QtInstanceNotebook.cxx index 8ff95b59f8bf..70818fce7ad6 100644 --- a/vcl/qt5/QtInstanceNotebook.cxx +++ b/vcl/qt5/QtInstanceNotebook.cxx @@ -79,7 +79,11 @@ OUString QtInstanceNotebook::get_current_page_ident() const SolarMutexGuard g; OUString sIdent; - GetQtInstance().RunInMainThread([&] { sIdent = get_page_ident(m_pTabWidget->currentIndex()); }); + GetQtInstance().RunInMainThread([&] { + const int nIndex = m_pTabWidget->currentIndex(); + if (nIndex >= 0) + sIdent = get_page_ident(nIndex); + }); return sIdent; } commit 8e7aa89201c7156104ee95f5a3c58e3e44a65be3 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Jul 21 18:56:15 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Jul 22 07:21:29 2025 +0200 tdf#130857 Use explicit column for image in formula dlg "Struct" page Use a separate column (at index 0) for the image shown for entries in the treeview in the "Structure" page of the formula dialog instead of using the index of -1 which is documented to set the "expander image" when passed to weld::TreeView::set_image. There is however a separate icon used to actually expand/collapse the entry, and both, the GtkInstanceTreeView and the SalInstanceTreeView implementation internally use a separate extra column index for that image internally instead. Stop relying on that special logic for this tree view and use a "normal" column instead, and using only a single GtkCellRenderer per column. This will also simplify supporting this for the Qt implementation in QtInstanceTreeView, which doesn't support the special "expander column" at index -1 at this point in time. No change in behavior expected or seen in a quick test of that dialog in Calc: * "Insert" -> "Function" * switch to the "Structure" tab Change-Id: I80e191305930f5a7869a7d39033d23480d7cfb18 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188126 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/formula/source/ui/dlg/structpg.cxx b/formula/source/ui/dlg/structpg.cxx index 37d11be7b257..7683a9cb8229 100644 --- a/formula/source/ui/dlg/structpg.cxx +++ b/formula/source/ui/dlg/structpg.cxx @@ -71,19 +71,19 @@ bool StructPage::InsertEntry(const OUString& rText, const weld::TreeIter* pParen case StructType::Folder: m_xTlbStruct->insert(pParent, nPos, &rText, &sId, nullptr, nullptr, false, &rRet); - m_xTlbStruct->set_image(rRet, BMP_STR_OPEN); + m_xTlbStruct->set_image(rRet, BMP_STR_OPEN, 0); bEntry = true; break; case StructType::End: m_xTlbStruct->insert(pParent, nPos, &rText, &sId, nullptr, nullptr, false, &rRet); - m_xTlbStruct->set_image(rRet, maImgEnd); + m_xTlbStruct->set_image(rRet, maImgEnd, 0); bEntry = true; break; case StructType::Error: m_xTlbStruct->insert(pParent, nPos, &rText, &sId, nullptr, nullptr, false, &rRet); - m_xTlbStruct->set_image(rRet, maImgError); + m_xTlbStruct->set_image(rRet, maImgError, 0); bEntry = true; break; } diff --git a/formula/uiconfig/ui/structpage.ui b/formula/uiconfig/ui/structpage.ui index 6f471b3b09a9..f0bffc5c99be 100644 --- a/formula/uiconfig/ui/structpage.ui +++ b/formula/uiconfig/ui/structpage.ui @@ -56,7 +56,7 @@ <object class="GtkTreeSelection" id="treeview-selection1"/> </child> <child> - <object class="GtkTreeViewColumn" id="treeviewcolumn2"> + <object class="GtkTreeViewColumn" id="treeviewcolumn1"> <property name="spacing">6</property> <child> <object class="GtkCellRendererPixbuf" id="cellrenderertext4"/> @@ -64,6 +64,11 @@ <attribute name="pixbuf">0</attribute> </attributes> </child> + </object> + </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn2"> + <property name="spacing">6</property> <child> <object class="GtkCellRendererText" id="cellrenderertext2"/> <attributes> commit 5d3238eaae5b3786efbdfc7776d0de480f50597c Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Jul 21 18:44:38 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Jul 22 07:21:23 2025 +0200 formula: Resave structpage.ui with glade 3.40 This is used e.g. in Calc: * "Insert" -> "Function" * switch to the "Structure" tab Change-Id: I965b954386475a37c4f7f9b671b4251f12aea790 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188125 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/formula/uiconfig/ui/structpage.ui b/formula/uiconfig/ui/structpage.ui index 6faff9151657..6f471b3b09a9 100644 --- a/formula/uiconfig/ui/structpage.ui +++ b/formula/uiconfig/ui/structpage.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.36.0 --> +<!-- Generated with glade 3.40.0 --> <interface domain="for"> <requires lib="gtk+" version="3.20"/> <object class="GtkTreeStore" id="liststore1"> @@ -14,20 +14,20 @@ </object> <object class="GtkBox" id="StructPage"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="border_width">6</property> + <property name="border-width">6</property> <property name="orientation">vertical</property> <property name="spacing">6</property> <child> <object class="GtkLabel" id="label1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="halign">start</property> <property name="label" translatable="yes" context="structpage|label1">Content:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">struct</property> + <property name="use-underline">True</property> + <property name="mnemonic-widget">struct</property> </object> <packing> <property name="expand">False</property> @@ -38,20 +38,20 @@ <child> <object class="GtkScrolledWindow"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="shadow_type">in</property> + <property name="shadow-type">in</property> <child> <object class="GtkTreeView" id="struct"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="model">liststore1</property> - <property name="headers_visible">False</property> - <property name="headers_clickable">False</property> - <property name="search_column">0</property> + <property name="headers-visible">False</property> + <property name="headers-clickable">False</property> + <property name="search-column">0</property> <child internal-child="selection"> <object class="GtkTreeSelection" id="treeview-selection1"/> </child> commit bd10afdc1a0f468d27480943177581f9b0f969a1 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Jul 21 17:24:40 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Jul 22 07:21:17 2025 +0200 tdf#130857 qt weld: Deduplicate QtInstanceTreeView::set_image impls Introduce a helper method and call it from the 3 variants previously implementing basically the same logic, just retrieving the QPixmap a bit differently. Change-Id: Ifadbd0833f9b95e8835126bf159d29b51c864f85 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188122 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/vcl/inc/qt5/QtInstanceTreeView.hxx b/vcl/inc/qt5/QtInstanceTreeView.hxx index a4d95c6fb8b1..f30343885e59 100644 --- a/vcl/inc/qt5/QtInstanceTreeView.hxx +++ b/vcl/inc/qt5/QtInstanceTreeView.hxx @@ -213,6 +213,8 @@ private: QModelIndex firstTextColumnModelIndex(const weld::TreeIter& rIter) const; static QAbstractItemView::SelectionMode mapSelectionMode(SelectionMode eMode); + void setImage(const weld::TreeIter& rIter, const QPixmap& rPixmap, int nCol); + private Q_SLOTS: void handleActivated(); void handleDataChanged(const QModelIndex& rTopLeft, const QModelIndex& rBottomRight, diff --git a/vcl/qt5/QtInstanceTreeView.cxx b/vcl/qt5/QtInstanceTreeView.cxx index f97489c4b7ba..134095438fc7 100644 --- a/vcl/qt5/QtInstanceTreeView.cxx +++ b/vcl/qt5/QtInstanceTreeView.cxx @@ -636,45 +636,22 @@ OUString QtInstanceTreeView::get_id(const weld::TreeIter& rIter) const void QtInstanceTreeView::set_image(const weld::TreeIter& rIter, const OUString& rImage, int nCol) { - assert(nCol != -1 && "Special column -1 not handled yet"); - - SolarMutexGuard g; + if (rImage.isEmpty()) + return; - GetQtInstance().RunInMainThread([&] { - if (rImage.isEmpty()) - return; - QModelIndex aIndex = modelIndex(rIter, nCol); - QIcon aIcon = loadQPixmapIcon(rImage); - m_pModel->setData(aIndex, aIcon, Qt::DecorationRole); - }); + setImage(rIter, loadQPixmapIcon(rImage), nCol); } void QtInstanceTreeView::set_image(const weld::TreeIter& rIter, VirtualDevice& rImage, int nCol) { - assert(nCol != -1 && "Special column -1 not handled yet"); - - SolarMutexGuard g; - - GetQtInstance().RunInMainThread([&] { - QModelIndex aIndex = modelIndex(rIter, nCol); - QIcon aIcon = toQPixmap(rImage); - m_pModel->setData(aIndex, aIcon, Qt::DecorationRole); - }); + setImage(rIter, toQPixmap(rImage), nCol); } void QtInstanceTreeView::set_image(const weld::TreeIter& rIter, const css::uno::Reference<css::graphic::XGraphic>& rImage, int nCol) { - assert(nCol != -1 && "Special column -1 not handled yet"); - - SolarMutexGuard g; - - GetQtInstance().RunInMainThread([&] { - QModelIndex aIndex = modelIndex(rIter, nCol); - QIcon aIcon = toQPixmap(rImage); - m_pModel->setData(aIndex, aIcon, Qt::DecorationRole); - }); + setImage(rIter, toQPixmap(rImage), nCol); } void QtInstanceTreeView::set_font_color(const weld::TreeIter&, const Color&) @@ -1066,6 +1043,18 @@ QModelIndex QtInstanceTreeView::firstTextColumnModelIndex(const weld::TreeIter& return QModelIndex(); } +void QtInstanceTreeView::setImage(const weld::TreeIter& rIter, const QPixmap& rPixmap, int nCol) +{ + assert(nCol != -1 && "Special column -1 not handled yet"); + + SolarMutexGuard g; + + GetQtInstance().RunInMainThread([&] { + QModelIndex aIndex = modelIndex(rIter, nCol); + m_pModel->setData(aIndex, rPixmap, Qt::DecorationRole); + }); +} + void QtInstanceTreeView::handleActivated() { SolarMutexGuard g; commit 17c2f39c0ae17ada0c38481889ddd46b54a4f2bf Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Jul 21 16:50:28 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Jul 22 07:21:12 2025 +0200 tdf#130857 qt weld: Notify about TextView cursor/text changes Change-Id: Ib8ed3b984f09fd08ecfff40baf7200d3b4a2fef6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188121 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/vcl/inc/qt5/QtInstanceTextView.hxx b/vcl/inc/qt5/QtInstanceTextView.hxx index 4fb8ca94c6c9..71279c82d37c 100644 --- a/vcl/inc/qt5/QtInstanceTextView.hxx +++ b/vcl/inc/qt5/QtInstanceTextView.hxx @@ -49,6 +49,10 @@ public: virtual int vadjustment_get_lower() const override; virtual int vadjustment_get_page_size() const override; virtual void vadjustment_set_value(int nValue) override; + +private Q_SLOTS: + void handleCursorPositionChanged(); + void handleTextChanged(); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/qt5/QtInstanceTextView.cxx b/vcl/qt5/QtInstanceTextView.cxx index 2c79383c6890..fab6f2809561 100644 --- a/vcl/qt5/QtInstanceTextView.cxx +++ b/vcl/qt5/QtInstanceTextView.cxx @@ -19,6 +19,11 @@ QtInstanceTextView::QtInstanceTextView(QPlainTextEdit* pTextEdit) , m_pTextEdit(pTextEdit) { assert(m_pTextEdit); + + connect(m_pTextEdit, &QPlainTextEdit::cursorPositionChanged, this, + &QtInstanceTextView::handleCursorPositionChanged); + connect(m_pTextEdit, &QPlainTextEdit::textChanged, this, + &QtInstanceTextView::handleTextChanged); } void QtInstanceTextView::set_text(const OUString& rText) @@ -140,4 +145,16 @@ int QtInstanceTextView::vadjustment_get_page_size() const void QtInstanceTextView::vadjustment_set_value(int) { assert(false && "Not implemented yet"); } +void QtInstanceTextView::handleCursorPositionChanged() +{ + SolarMutexGuard aGuard; + signal_cursor_position(); +} + +void QtInstanceTextView::handleTextChanged() +{ + SolarMutexGuard aGuard; + signal_changed(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ commit da1c73fb99cf41a48908cc2e08fe0057af388b1d Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Jul 21 13:53:00 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Jul 22 07:21:06 2025 +0200 tdf#130857 qt weld: Implement QtInstanceToolbar::{g,s}et_item_active This is relevant for "GtkToggleToolButton" objects in .ui files for which support was added in previous commit Change-Id: I2abb920b379e3e0a5b2ee82de26dd4595dfda2e2 Author: Michael Weghorn <m.wegh...@posteo.de> Date: Mon Jul 21 13:19:16 2025 +0200 tdf#130857 qt weld: Support "GtkToggleToolButton" This is used e.g. by the (not yet supported) "Conditional Formatting" reportdesign dialog that can be triggered as follows: * open a database in Base or create a new one * select "Reports" * select "Create Report in Design View" * click the "Text Box" item in the toolbar, click + drag mouse to insert * "Format" -> "Conditional Formatting" Change-Id: If976f38de791e3cac229936eb2fa221af44cb0f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188120 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/vcl/qt5/QtInstanceToolbar.cxx b/vcl/qt5/QtInstanceToolbar.cxx index 825f1648ea05..cac9734c942f 100644 --- a/vcl/qt5/QtInstanceToolbar.cxx +++ b/vcl/qt5/QtInstanceToolbar.cxx @@ -39,15 +39,31 @@ bool QtInstanceToolbar::get_item_sensitive(const OUString&) const assert(false && "Not implemented yet"); return false; } -void QtInstanceToolbar::set_item_active(const OUString&, bool) +void QtInstanceToolbar::set_item_active(const OUString& rIdent, bool bActive) { - assert(false && "Not implemented yet"); + SolarMutexGuard g; + + GetQtInstance().RunInMainThread([&] { + QToolButton* pToolButton = m_pToolBar->findChild<QToolButton*>(toQString(rIdent)); + assert(pToolButton && "No tool button with the given ID found"); + assert(pToolButton->isCheckable() && "Tool button is not checkable"); + pToolButton->setChecked(bActive); + }); } -bool QtInstanceToolbar::get_item_active(const OUString&) const +bool QtInstanceToolbar::get_item_active(const OUString& rIdent) const { - assert(false && "Not implemented yet"); - return false; + SolarMutexGuard g; + + bool bActive = false; + GetQtInstance().RunInMainThread([&] { + QToolButton* pToolButton = m_pToolBar->findChild<QToolButton*>(toQString(rIdent)); + assert(pToolButton && "No tool button with the given ID found"); + assert(pToolButton->isCheckable() && "Tool button is not checkable"); + bActive = pToolButton->isChecked(); + }); + + return bActive; } void QtInstanceToolbar::set_menu_item_active(const OUString&, bool)