vcl/qt5/QtInstanceTreeView.cxx |   22 ++++++++++++++++++----
 vcl/qt5/QtInstanceWindow.cxx   |    3 +++
 2 files changed, 21 insertions(+), 4 deletions(-)

New commits:
commit 002aedf59e4e8d8d550cd2fb1bb384fdd19c7fb2
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Jul 25 08:12:56 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Jul 25 12:10:02 2025 +0200

    tdf#130857 qt weld: Implement QtInstanceTreeView::{g,s}et_sort_column
    
    Change-Id: I30a840a4e7da53f0f10fea5096bb62f51025488c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188315
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/qt5/QtInstanceTreeView.cxx b/vcl/qt5/QtInstanceTreeView.cxx
index ba501b98ea7c..0ce9f2ae403d 100644
--- a/vcl/qt5/QtInstanceTreeView.cxx
+++ b/vcl/qt5/QtInstanceTreeView.cxx
@@ -845,11 +845,20 @@ TriState QtInstanceTreeView::get_sort_indicator(int) const
 
 int QtInstanceTreeView::get_sort_column() const
 {
-    assert(false && "Not implemented yet");
-    return -1;
+    SolarMutexGuard g;
+
+    int nSortColumn = 0;
+    GetQtInstance().RunInMainThread([&] { nSortColumn = 
m_pModel->sortColumn(); });
+
+    return nSortColumn;
 }
 
-void QtInstanceTreeView::set_sort_column(int) { assert(false && "Not 
implemented yet"); }
+void QtInstanceTreeView::set_sort_column(int nColumn)
+{
+    SolarMutexGuard g;
+
+    GetQtInstance().RunInMainThread([&] { m_pModel->sort(nColumn); });
+}
 
 void QtInstanceTreeView::clear()
 {
commit a838839e4d191c62a9396ee65af9a116a617160f
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Jul 25 07:59:01 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Jul 25 12:09:54 2025 +0200

    tdf#130857 qt weld: Support setting TreeView "expander image"
    
    Support the special index of -1 in the various
    QtInstanceTreeView::set_image variants, which
    is documented in weld.hxx as
    
        // col index -1 sets the expander image
    
    GtkTreeViewColumn supports multiple renderers
    for one column, e.g. to set an image and text
    in addition, which is used e.g. in Writer's
    "Manage Changes" dialog
    (UI file: svx/uiconfig/ui/redlineviewpage.ui,
    insertion of rows in SwRedlineAcceptDlg::InsertChildren)
    for the first column to hold an "expander image", accessed
    by index -1, and text.
    
    QAbstractItemModel (and subclasses) also support containing
    multiple types of data for one column, using the concept
    of roles, see the QAbstractItemModel::setData doc [1].
    
    For now, simply set the "expander image" as the image
    (data for role Qt::DecorationRole) for the first column.
    
    This will be fine as long as only non-image data (like
    text) will be set for that column otherwise. If there's
    any case where multiple images (i.e. GtkCellRendererPixBuf
    in the .ui file) are used inside a single column
    (GtkTreeViewColumn in the .ui file), setting either will
    overwrite the other.
    If that turns out to be a problem in practice, it will
    require another solution then.
    
    Avoiding to use multiple images in one column by splitting that
    column into multiple ones might be one approach, see e.g.
    
        commit 8e7aa89201c7156104ee95f5a3c58e3e44a65be3
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Mon Jul 21 18:56:15 2025 +0200
    
            tdf#130857 Use explicit column for image in formula dlg "Struct" 
page
    
    , but that can't simply be done for the case of the "Manage
    Changes" dialog mentioned above, because it has a column
    title set that should be set for a single column containing
    multiple types of data, not two columns.
    
    [1] https://doc.qt.io/qt-6/qabstractitemmodel.html#setData
    
    Change-Id: Ia4141a221b1da0c475727791da36664f49e31678
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188312
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/vcl/qt5/QtInstanceTreeView.cxx b/vcl/qt5/QtInstanceTreeView.cxx
index f8f016d79f59..ba501b98ea7c 100644
--- a/vcl/qt5/QtInstanceTreeView.cxx
+++ b/vcl/qt5/QtInstanceTreeView.cxx
@@ -1056,7 +1056,12 @@ QModelIndex 
QtInstanceTreeView::firstTextColumnModelIndex(const weld::TreeIter&
 
 void QtInstanceTreeView::setImage(const weld::TreeIter& rIter, const QPixmap& 
rPixmap, int nCol)
 {
-    assert(nCol != -1 && "Special column -1 not handled yet");
+    // set the "expander image" for the Qt::DecorationRole in the first column
+    // It can still contain additional data (like text) for other roles, but 
not
+    // another image. If that turns out to be problematic, another solution 
needs
+    // to be found.
+    if (nCol == -1)
+        nCol = 0;
 
     SolarMutexGuard g;
 
commit 81db4416f5b301a1a82bf60fb658d30348ea344f
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Jul 25 07:28:11 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Jul 25 12:09:48 2025 +0200

    tdf#130857 qt weld: Hold SolarMutex in QtInstanceWindow::eventFilter
    
    This fixes an assert seen in a WIP branch to support the
    "Manage Changes" dialog when the dialog was open in the
    previous run when LO crashed, and then restarting LO.
    
    Also add an assert that this is running in the main thread.
    
    Backtrace:
    
        Thread 1 received signal SIGABRT, Aborted.
        __pthread_kill_implementation (threadid=<optimized out>, 
signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
        warning: 44     ./nptl/pthread_kill.c: No such file or directory
        (rr) bt
        #0  __pthread_kill_implementation (threadid=<optimized out>, 
signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
        #1  0x00007fa78409e9ff in __pthread_kill_internal (threadid=<optimized 
out>, signo=6) at ./nptl/pthread_kill.c:89
        #2  0x00007fa784049cc2 in __GI_raise (sig=sig@entry=6) at 
../sysdeps/posix/raise.c:26
        #3  0x00007fa7840324ac in __GI_abort () at ./stdlib/abort.c:73
        #4  0x00007fa784032420 in __assert_fail_base (fmt=<optimized out>, 
assertion=<optimized out>, file=<optimized out>, line=36, function=<optimized 
out>) at ./assert/assert.c:118
        #5  0x00007fa77b38413c in ImplDbgTestSolarMutex (owned=true) at 
/home/michi/development/git/libreoffice/vcl/source/app/dbggui.cxx:36
        #6  0x00007fa78252be74 in DbgTestSolarMutex (owned=true) at 
/home/michi/development/git/libreoffice/tools/source/debug/debug.cxx:54
        #7  0x00007fa77ac6732b in vcl::WindowOutputDevice::AcquireGraphics 
(this=0x55f164887f80) at 
/home/michi/development/git/libreoffice/vcl/source/window/window.cxx:819
        #8  0x00007fa77ae68d7b in OutputDevice::ImplIsAntiparallel 
(this=0x55f164887f80) at 
/home/michi/development/git/libreoffice/vcl/source/outdev/outdev.cxx:614
        #9  0x00007fa77aba212f in vcl::Window::GetPointerPosPixel 
(this=0x55f167b88570) at 
/home/michi/development/git/libreoffice/vcl/source/window/mouse.cxx:548
        #10 0x00007fa77aba2030 in vcl::Window::ImplTestMousePointerSet 
(this=0x55f167b88570) at 
/home/michi/development/git/libreoffice/vcl/source/window/mouse.cxx:90
        #11 0x00007fa77aba47bb in vcl::Window::EnterWait (this=0x55f167b88570) 
at /home/michi/development/git/libreoffice/vcl/source/window/mouse.cxx:613
        #12 0x00007fa7476b98d7 in SwWait::EnterWaitAndLockDispatcher 
(this=0x7ffe7c5985d8) at 
/home/michi/development/git/libreoffice/sw/source/uibase/app/swwait.cxx:47
        #13 0x00007fa7476b9864 in SwWait::SwWait (this=0x7ffe7c5985d8, 
rDocShell=..., bLockUnlockDispatcher=false) at 
/home/michi/development/git/libreoffice/sw/source/uibase/app/swwait.cxx:34
        #14 0x00007fa7478a051b in SwModelessRedlineAcceptDlg::Activate 
(this=0x55f1689d4140) at 
/home/michi/development/git/libreoffice/sw/source/uibase/misc/redlndlg.cxx:95
        #15 0x00007fa7804e12f5 in SfxDialogController::FocusChangeHdl 
(this=0x55f1689d4140) at 
/home/michi/development/git/libreoffice/sfx2/source/dialog/basedlgs.cxx:114
        #16 0x00007fa7804e129d in SfxDialogController::LinkStubFocusChangeHdl 
(instance=0x55f1689d4140, data=...) at 
/home/michi/development/git/libreoffice/sfx2/source/dialog/basedlgs.cxx:111
        #17 0x00007fa772af7211 in Link<weld::Container&, void>::Call 
(this=0x55f168a187d0, data=...) at include/tools/link.hxx:105
        #18 0x00007fa772af712c in 
weld::Container::signal_container_focus_changed (this=0x55f168a187c8) at 
include/vcl/weld.hxx:396
        #19 0x00007fa772af4b1f in QtInstanceWindow::eventFilter 
(this=0x55f168a18600, pObject=0x55f168483010, pEvent=0x7ffe7c599350) at 
vcl/qt6/../qt5/QtInstanceWindow.cxx:228
        #20 0x00007fa771a52f9d in 
QCoreApplicationPrivate::sendThroughObjectEventFilters 
(receiver=0x55f168483010, event=0x7ffe7c599350) at 
/home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1246
        #21 0x00007fa76f9e60ce in QApplicationPrivate::notify_helper 
(this=0x55f162d3fb40, receiver=0x55f168483010, e=0x7ffe7c599350) at 
/home/michi/development/git/qt5/qtbase/src/widgets/kernel/qapplication.cpp:3301
        #22 0x00007fa76f9e9fd4 in QApplication::notify (this=0x55f162d31a60, 
receiver=0x55f168483010, e=0x7ffe7c599350) at 
/home/michi/development/git/qt5/qtbase/src/widgets/kernel/qapplication.cpp:3253
        #23 0x00007fa771a52a99 in QCoreApplication::notifyInternal2 
(receiver=0x55f168483010, event=0x7ffe7c599350) at 
/home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1109
        #24 0x00007fa771a53799 in QCoreApplication::sendSpontaneousEvent 
(receiver=0x55f168483010, event=0x7ffe7c599350) at 
/home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1563
        #25 0x00007fa76f9e48ee in QApplicationPrivate::setActiveWindow 
(act=0x55f168483010) at 
/home/michi/development/git/qt5/qtbase/src/widgets/kernel/qapplication.cpp:1880
        #26 0x00007fa76f9e5015 in QApplicationPrivate::notifyActiveWindowChange 
(this=0x55f162d3fb40, previous=0x0) at 
/home/michi/development/git/qt5/qtbase/src/widgets/kernel/qapplication.cpp:1950
        #27 0x00007fa7708973c4 in 
QGuiApplicationPrivate::processFocusWindowEvent (e=0x55f1690e6910) at 
/home/michi/development/git/qt5/qtbase/src/gui/kernel/qguiapplication.cpp:2726
        #28 0x00007fa7708935a8 in 
QGuiApplicationPrivate::processWindowSystemEvent (e=0x55f1690e6910) at 
/home/michi/development/git/qt5/qtbase/src/gui/kernel/qguiapplication.cpp:2215
        #29 0x00007fa77097c52d in 
QWindowSystemInterface::sendWindowSystemEvents (flags=...) at 
/home/michi/development/git/qt5/qtbase/src/gui/kernel/qwindowsysteminterface.cpp:1113
        #30 0x00007fa77097c3de in 
QWindowSystemInterface::flushWindowSystemEvents (flags=...) at 
/home/michi/development/git/qt5/qtbase/src/gui/kernel/qwindowsysteminterface.cpp:1082
        #31 0x00007fa76b8b5665 in 
QtWaylandClient::QWaylandDisplay::flushRequests (this=0x55f162d8feb0) at 
/home/michi/development/git/qt5/qtbase/src/plugins/platforms/wayland/qwaylanddisplay.cpp:523
        #32 0x00007fa76b8ba6c4 in 
QtWaylandClient::QWaylandDisplay::qt_static_metacall (_o=0x55f162d8feb0, 
_c=QMetaObject::InvokeMetaMethod, _id=3, _a=0x7ffe7c5999b0)
            at 
qtbase/src/plugins/platforms/wayland/WaylandClient_autogen/include/moc_qwaylanddisplay_p.cpp:90
        #33 0x00007fa771b2d43f in doActivate<false> (sender=0x55f162d326e0, 
signal_index=3, argv=0x7ffe7c5999b0) at 
/home/michi/development/git/qt5/qtbase/src/corelib/kernel/qobject.cpp:4295
        #34 0x00007fa771b234a3 in QMetaObject::activate (sender=0x55f162d326e0, 
m=0x7fa77243f028 <QAbstractEventDispatcher::staticMetaObject>, 
local_signal_index=0, argv=0x0)
            at 
/home/michi/development/git/qt5/qtbase/src/corelib/kernel/qobject.cpp:4343
        #35 0x00007fa771a3b8b6 in QAbstractEventDispatcher::aboutToBlock 
(this=0x55f162d326e0) at 
qtbase/src/corelib/Core_autogen/include/moc_qabstracteventdispatcher.cpp:122
        #36 0x00007fa772059673 in QEventDispatcherGlib::processEvents 
(this=0x55f162d326e0, flags=...) at 
/home/michi/development/git/qt5/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:386
        #37 0x00007fa77119ba38 in QPAEventDispatcherGlib::processEvents 
(this=0x55f162d326e0, flags=...) at 
/home/michi/development/git/qt5/qtbase/src/gui/platform/unix/qeventdispatcher_glib.cpp:89
        #38 0x00007fa7729f8212 in QtInstance::ImplYield (this=0x55f162dbc230, 
bWait=true, bHandleAllCurrentEvents=false) at vcl/qt6/../qt5/QtInstance.cxx:500
        #39 0x00007fa7729fb551 in QtInstance::DoYield (this=0x55f162dbc230, 
bWait=true, bHandleAllCurrentEvents=false) at vcl/qt6/../qt5/QtInstance.cxx:511
        #40 0x00007fa77b45b226 in ImplYield (i_bWait=true, i_bAllEvents=false) 
at /home/michi/development/git/libreoffice/vcl/source/app/svapp.cxx:385
        #41 0x00007fa77b45ab3f in Application::Yield () at 
/home/michi/development/git/libreoffice/vcl/source/app/svapp.cxx:488
        #42 0x00007fa77b45a920 in Application::Execute () at 
/home/michi/development/git/libreoffice/vcl/source/app/svapp.cxx:360
        #43 0x00007fa784328e65 in desktop::Desktop::Main (this=0x7ffe7c59b5c0) 
at /home/michi/development/git/libreoffice/desktop/source/app/app.cxx:1678
        #44 0x00007fa77b487146 in ImplSVMain () at 
/home/michi/development/git/libreoffice/vcl/source/app/svmain.cxx:230
        #45 0x00007fa77b488c39 in SVMain () at 
/home/michi/development/git/libreoffice/vcl/source/app/svmain.cxx:248
        #46 0x00007fa7843a2b0a in soffice_main () at 
/home/michi/development/git/libreoffice/desktop/source/app/sofficemain.cxx:122
        #47 0x000055f1441869fd in sal_main () at 
/home/michi/development/git/libreoffice/desktop/source/app/main.c:51
        #48 0x000055f1441869d7 in main (argc=2, argv=0x7ffe7c59b7c8) at 
/home/michi/development/git/libreoffice/desktop/source/app/main.c:49
    
    Change-Id: Ia3f78c245022c6aa989292737730079b403a7493
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188310
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/qt5/QtInstanceWindow.cxx b/vcl/qt5/QtInstanceWindow.cxx
index a153de382aea..e03626882e9a 100644
--- a/vcl/qt5/QtInstanceWindow.cxx
+++ b/vcl/qt5/QtInstanceWindow.cxx
@@ -218,6 +218,9 @@ const vcl::ILibreOfficeKitNotifier* 
QtInstanceWindow::GetLOKNotifier() { return
 
 bool QtInstanceWindow::eventFilter(QObject* pObject, QEvent* pEvent)
 {
+    SolarMutexGuard g;
+    assert(GetQtInstance().IsMainThread());
+
     if (pObject != getQWidget())
         return false;
 

Reply via email to