summaryrefslogtreecommitdiff
path: root/vcl/qt5
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-11-10 19:35:00 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2024-11-11 01:49:34 +0100
commitd4edde13e808aee6ed1a4b8ae049a956733ee4b9 (patch)
treee133fbd1f8f1dc4543fa0e5b363b52d9cdc74efd /vcl/qt5
parent5000c5bdfe4778e24759ee0aeb57ecb9fbb3c73a (diff)
tdf#130857 qt weld: Call handlers when tab page changes
Call the corresponding handlers to notify about the previous and current tab page when switching the tab page in QtInstanceNotebook, by remembering the identifier of the current page and using that in a slot connected to the QTabWidget::currentChanged signal. Change-Id: I387c75b3af138cf9b89f169f0a3c223c262c2a92 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176356 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
Diffstat (limited to 'vcl/qt5')
-rw-r--r--vcl/qt5/QtInstanceNotebook.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/vcl/qt5/QtInstanceNotebook.cxx b/vcl/qt5/QtInstanceNotebook.cxx
index bb26817c3196..48344f2cb08a 100644
--- a/vcl/qt5/QtInstanceNotebook.cxx
+++ b/vcl/qt5/QtInstanceNotebook.cxx
@@ -24,6 +24,12 @@ QtInstanceNotebook::QtInstanceNotebook(QTabWidget* pTabWidget)
, m_pTabWidget(pTabWidget)
{
assert(m_pTabWidget);
+
+ if (m_pTabWidget->count())
+ m_sCurrentTabId = get_current_page_ident();
+
+ connect(m_pTabWidget, &QTabWidget::currentChanged, this,
+ &QtInstanceNotebook::currentTabChanged);
}
int QtInstanceNotebook::get_current_page() const
@@ -167,4 +173,17 @@ void QtInstanceNotebook::setTabIdAndLabel(QTabWidget& rTabWidget, int nPage, con
});
}
+void QtInstanceNotebook::currentTabChanged()
+{
+ SolarMutexGuard g;
+
+ if (!m_sCurrentTabId.isEmpty())
+ m_aLeavePageHdl.Call(m_sCurrentTabId);
+
+ m_sCurrentTabId = get_current_page_ident();
+
+ if (!m_sCurrentTabId.isEmpty())
+ m_aLeavePageHdl.Call(m_sCurrentTabId);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */