summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-12-21 00:30:51 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2024-12-21 09:31:55 +0100
commit8c98986b5bd5e2e841a2e1a2f78621f3d4d7b8da (patch)
tree941f8a7b30dd1debcfb8d891f2a377c2dae62c1e
parent78872b270dfca6cfa25e3e08a5539362f60f1174 (diff)
tdf#130857 qt weld: Implement QtInstanceWidget::set_busy_cursor
This is basically the the Qt port of the existing GtkInstanceWidget::set_busy_cursor. Gets called e.g. from RemoteFilesDialog::OpenURL (via the weld::WaitObject ctor/dtor). Change-Id: I0b61ae33ad47190c8f2258745ab483152dde1331 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178974 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r--vcl/inc/qt5/QtInstanceWidget.hxx4
-rw-r--r--vcl/qt5/QtInstanceWidget.cxx18
2 files changed, 20 insertions, 2 deletions
diff --git a/vcl/inc/qt5/QtInstanceWidget.hxx b/vcl/inc/qt5/QtInstanceWidget.hxx
index e60e78abbecb..17cc6d9886c2 100644
--- a/vcl/inc/qt5/QtInstanceWidget.hxx
+++ b/vcl/inc/qt5/QtInstanceWidget.hxx
@@ -25,6 +25,8 @@ class QtInstanceWidget : public QObject, public virtual weld::Widget
QWidget* m_pWidget;
+ int m_nBusyCount = 0;
+
public:
QtInstanceWidget(QWidget* pWidget);
@@ -133,7 +135,7 @@ public:
virtual void thaw() override;
- virtual void set_busy_cursor(bool) override;
+ virtual void set_busy_cursor(bool bBusy) override;
virtual std::unique_ptr<weld::Container> weld_parent() const override;
diff --git a/vcl/qt5/QtInstanceWidget.cxx b/vcl/qt5/QtInstanceWidget.cxx
index f2656b1df54e..8f1d5075a79c 100644
--- a/vcl/qt5/QtInstanceWidget.cxx
+++ b/vcl/qt5/QtInstanceWidget.cxx
@@ -495,7 +495,23 @@ void QtInstanceWidget::freeze(){};
void QtInstanceWidget::thaw(){};
-void QtInstanceWidget::set_busy_cursor(bool) { assert(false && "Not implemented yet"); }
+void QtInstanceWidget::set_busy_cursor(bool bBusy)
+{
+ SolarMutexGuard g;
+
+ GetQtInstance().RunInMainThread([&] {
+ if (bBusy)
+ ++m_nBusyCount;
+ else
+ --m_nBusyCount;
+ assert(m_nBusyCount >= 0);
+
+ if (m_nBusyCount == 1)
+ m_pWidget->setCursor(Qt::BusyCursor);
+ else if (m_nBusyCount == 0)
+ m_pWidget->unsetCursor();
+ });
+}
std::unique_ptr<weld::Container> QtInstanceWidget::weld_parent() const
{