vcl/osx/salnativewidgets.cxx | 5 ++++- vcl/source/control/tabctrl.cxx | 27 ++++++++++++++------------- 2 files changed, 18 insertions(+), 14 deletions(-)
New commits: commit bad8cf4bc2ca63e8c80571dc470ac75058efd1e4 Author: Caolán McNamara <[email protected]> AuthorDate: Sat Nov 29 19:36:57 2025 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Sun Nov 30 11:07:41 2025 +0100 Resolves: tdf#162562 only shrink to tab area for ControlPart::TabPaneWithHeader as (seems to be) the intent in the original: commit 430b406e5e8249983fc030aa0f867372f5da74d2 Date: Thu Jun 20 13:00:58 2019 +0000 tdf#105884 Qt5 implement TabControl theming and undo the part of the change of: commit ca482cf39f25941040596e50d0e1ab7fa25dc1dd Date: Thu Oct 27 16:14:50 2022 +0100 calculate the header bounds even for !bPaneWithHeader case so we can pass in the required area for the macOS case to always do it, and instead add ControlPart::TabPaneWithHeader to the macOS backend so we get that shrink-to-tab-area effect on macOS as that commit wanted. So that other platforms render as they did before the 2nd commit. Change-Id: I92b836e850fcda946425f59bc8c1cbbd6fe0f167 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194824 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins diff --git a/vcl/osx/salnativewidgets.cxx b/vcl/osx/salnativewidgets.cxx index 0b40426dcfe4..e75462a17910 100644 --- a/vcl/osx/salnativewidgets.cxx +++ b/vcl/osx/salnativewidgets.cxx @@ -174,8 +174,11 @@ bool AquaSalGraphics::isNativeControlSupported(ControlType nType, ControlPart nP || nPart == ControlPart::SubEdit) return true; break; - case ControlType::TabItem: case ControlType::TabPane: + if (nPart == ControlPart::TabPaneWithHeader) + return true; + [[fallthrough]]; + case ControlType::TabItem: case ControlType::TabBody: if (nPart == ControlPart::Entire || nPart == ControlPart::TabsDrawRtl || nPart == ControlPart::HasBackgroundTexture) return true; diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index 23eec16f36a5..741bc53dedca 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -1129,24 +1129,25 @@ void TabControl::Paint( vcl::RenderContext& rRenderContext, const tools::Rectang const bool bPaneWithHeader = mbShowTabs && rRenderContext.IsNativeControlSupported(ControlType::TabPane, ControlPart::TabPaneWithHeader); tools::Rectangle aHeaderRect(aRect.Left(), 0, aRect.Right(), aRect.Top()); - if (!mpTabCtrlData->maItemList.empty()) + if (bPaneWithHeader) { - tools::Long nLeft = LONG_MAX; - tools::Long nRight = 0; - for (const auto &item : mpTabCtrlData->maItemList) + aRect.SetTop(0); + if (!mpTabCtrlData->maItemList.empty()) { - if (!item.m_bVisible) - continue; - nRight = std::max(nRight, item.maRect.Right()); - nLeft = std::min(nLeft, item.maRect.Left()); + tools::Long nLeft = LONG_MAX; + tools::Long nRight = 0; + for (const auto &item : mpTabCtrlData->maItemList) + { + if (!item.m_bVisible) + continue; + nRight = std::max(nRight, item.maRect.Right()); + nLeft = std::min(nLeft, item.maRect.Left()); + } + aHeaderRect.SetLeft(nLeft); + aHeaderRect.SetRight(nRight); } - aHeaderRect.SetLeft(nLeft); - aHeaderRect.SetRight(nRight); } - if (bPaneWithHeader) - aRect.SetTop(0); - const TabPaneValue aTabPaneValue(aHeaderRect, pCurItem ? pCurItem->maRect : tools::Rectangle()); ControlState nState = ControlState::ENABLED;
