Skip to content

Commit 92da2eb

Browse files
SyarifFakhriSyarif Fakhri
andauthored
Bug fix sidebar state during restore (#526)
* fix side bar state being incorrect during restore * isVisible is invalid during restore state * Make visibleTabCount function consistent with hasVisibleTabs. Add a bit of documentation. --------- Co-authored-by: Syarif Fakhri <fakhri.s@duerr-ndt.com>
1 parent 27edfe6 commit 92da2eb

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/AutoHideSideBar.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ bool CAutoHideSideBar::eventFilter(QObject *watched, QEvent *event)
279279
show();
280280
break;
281281

282-
case QEvent::Hide:
282+
case QEvent::HideToParent:
283283
if (!hasVisibleTabs())
284284
{
285285
hide();
@@ -321,7 +321,7 @@ int CAutoHideSideBar::visibleTabCount() const
321321
int count = 0;
322322
for (auto i = 0; i < tabCount(); i++)
323323
{
324-
if (tabAt(i)->isVisible())
324+
if (tabAt(i)->isVisibleTo(parentWidget()))
325325
{
326326
count++;
327327
}
@@ -336,7 +336,7 @@ bool CAutoHideSideBar::hasVisibleTabs() const
336336
{
337337
for (auto i = 0; i < tabCount(); i++)
338338
{
339-
if (tabAt(i)->isVisible())
339+
if (tabAt(i)->isVisibleTo(parentWidget()))
340340
{
341341
return true;
342342
}

src/AutoHideSideBar.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,14 @@ class ADS_EXPORT CAutoHideSideBar : public QScrollArea
135135
int tabCount() const;
136136

137137
/**
138-
* Returns the number of visible tabs
138+
* Returns the number of visible tabs to its parent widget.
139139
*/
140140
int visibleTabCount() const;
141141

142142
/**
143-
* Returns true, if the sidebar contains visible tabs.
143+
* Returns true, if the sidebar contains visible tabs to its parent widget.
144144
* The function returns as soon as it finds the first visible tab.
145-
* That means, if you just want to find out if theee are visible tabs
145+
* That means, if you just want to find out if there are visible tabs
146146
* then this function is quicker than visibleTabCount()
147147
*/
148148
bool hasVisibleTabs() const;

0 commit comments

Comments
 (0)