From 85f65b3f1ae32e3982c6d94247d210b188801737 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Fri, 23 Jun 2023 10:21:08 +0200 Subject: [PATCH] Avoid multiple function calls of parentWidget() function in CAutoHideSideBar::visibleTabCount() and CAutoHideSideBar::hasVisibleTabs() --- src/AutoHideSideBar.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/AutoHideSideBar.cpp b/src/AutoHideSideBar.cpp index cae494d..f0aa03d 100644 --- a/src/AutoHideSideBar.cpp +++ b/src/AutoHideSideBar.cpp @@ -319,9 +319,10 @@ int CAutoHideSideBar::tabCount() const int CAutoHideSideBar::visibleTabCount() const { int count = 0; + auto ParentWidget = parentWidget(); for (auto i = 0; i < tabCount(); i++) { - if (tabAt(i)->isVisibleTo(parentWidget())) + if (tabAt(i)->isVisibleTo(ParentWidget)) { count++; } @@ -334,9 +335,10 @@ int CAutoHideSideBar::visibleTabCount() const //============================================================================ bool CAutoHideSideBar::hasVisibleTabs() const { + auto ParentWidget = parentWidget(); for (auto i = 0; i < tabCount(); i++) { - if (tabAt(i)->isVisibleTo(parentWidget())) + if (tabAt(i)->isVisibleTo(ParentWidget)) { return true; }