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>
This commit is contained in:
Ahmad Syarifuddin 2023-06-23 15:15:24 +08:00 committed by GitHub
parent 27edfe63ee
commit 92da2eb8bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -279,7 +279,7 @@ bool CAutoHideSideBar::eventFilter(QObject *watched, QEvent *event)
show();
break;
case QEvent::Hide:
case QEvent::HideToParent:
if (!hasVisibleTabs())
{
hide();
@ -321,7 +321,7 @@ int CAutoHideSideBar::visibleTabCount() const
int count = 0;
for (auto i = 0; i < tabCount(); i++)
{
if (tabAt(i)->isVisible())
if (tabAt(i)->isVisibleTo(parentWidget()))
{
count++;
}
@ -336,7 +336,7 @@ bool CAutoHideSideBar::hasVisibleTabs() const
{
for (auto i = 0; i < tabCount(); i++)
{
if (tabAt(i)->isVisible())
if (tabAt(i)->isVisibleTo(parentWidget()))
{
return true;
}

View File

@ -135,14 +135,14 @@ public:
int tabCount() const;
/**
* Returns the number of visible tabs
* Returns the number of visible tabs to its parent widget.
*/
int visibleTabCount() const;
/**
* Returns true, if the sidebar contains visible tabs.
* Returns true, if the sidebar contains visible tabs to its parent widget.
* The function returns as soon as it finds the first visible tab.
* That means, if you just want to find out if theee are visible tabs
* That means, if you just want to find out if there are visible tabs
* then this function is quicker than visibleTabCount()
*/
bool hasVisibleTabs() const;