summaryrefslogtreecommitdiff
path: root/vcl/source/control
diff options
context:
space:
mode:
authorThorsten Behrens <thorsten.behrens@allotropia.de>2024-05-27 01:51:02 +0200
committerThorsten Behrens <thorsten.behrens@allotropia.de>2024-05-30 22:34:53 +0200
commit7629d31f02a9fdbdf71295744c8869dee5cb4c54 (patch)
treecb4408a8a44164e00d43058545fbfc5640481787 /vcl/source/control
parent782eda5992585a2a67f28d4453c7994f01b41ad9 (diff)
tdf#161006 tdf#161049 tdf#161020 tdf#161047 fix VertTabCtrl size calculation
* don't rely on initial dummy pages * so instead override GetOptimalSize() and do the math again * this assumes that all tab pages have been inserted at the time time GetOptimalSize() gets called for the last time Change-Id: I668347744d8ec9b94824f38cfc4b7ca00771a476 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168081 Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Tested-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'vcl/source/control')
-rw-r--r--vcl/source/control/ivctrl.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/vcl/source/control/ivctrl.cxx b/vcl/source/control/ivctrl.cxx
index 14e0ec44938b..c7e76a75eab0 100644
--- a/vcl/source/control/ivctrl.cxx
+++ b/vcl/source/control/ivctrl.cxx
@@ -627,6 +627,24 @@ void VerticalTabControl::SetPageText(std::u16string_view rPageId, const OUString
pData->pEntry->SetText(rText);
}
+Size VerticalTabControl::GetOptimalSize() const
+{
+ // re-calculate size - we might have replaced dummy tab pages with
+ // actual content
+ Size aOptimalPageSize(m_xBox->get_preferred_size());
+
+ for (auto const& item : maPageList)
+ {
+ Size aPagePrefSize(item->xPage->get_preferred_size());
+ if (aPagePrefSize.Width() > aOptimalPageSize.Width())
+ aOptimalPageSize.setWidth( aPagePrefSize.Width() );
+ if (aPagePrefSize.Height() > aOptimalPageSize.Height())
+ aOptimalPageSize.setHeight( aPagePrefSize.Height() );
+ }
+
+ return aOptimalPageSize;
+}
+
void VerticalTabControl::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
{
rJsonWriter.put("id", get_id());