Code/Framework/AzQtComponents/AzQtComponents/Components/DockTabBar.cpp
void DockTabBar::tabLayoutChange()
    {
        TabBar::tabLayoutChange();

        // Only the active tab's close button should be shown
        const ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, this);
        const int numTabs = count();
        const int activeTabIndex = currentIndex();
        for (int i = 0; i < numTabs; ++i)
        {
            if (auto button = tabButton(i, closeSide))
            {
                button->setVisible(i == activeTabIndex);
            }
        }

        // If the tab indicators are showing, then we need to show our underlay
        if (m_leftButton->isVisible())
        {
            // The underlay will take up the combined space behind the left and
            // right indicator buttons
            QRect total = m_leftButton->geometry();
            total = total.united(m_rightButton->geometry());
            m_tabIndicatorUnderlay->setGeometry(total);

            // The indicator buttons get raised when shown, so we need to stack
            // our underlay under the left button, which will place it under
            // both indicator buttons, and then show it
            m_tabIndicatorUnderlay->stackUnder(m_leftButton);
            m_tabIndicatorUnderlay->show();
        }
        else
        {
            m_tabIndicatorUnderlay->hide();
        }
    }
/**
     * Any time the tab layout changes (e.g. tabs are added/removed/resized or active tab changed),
     * we need to check if we need to add our tab indicator underlay, and
     * update which tab close button is visible
     */
Any time the tab layout changes ,
we need to check if we need to add our tab indicator underlay, and
update which tab close button is visible
Any time the tab layout changes we need to check if we need to add our tab indicator underlay and update which tab close button is visible
void DockTabBar::tabLayoutChange()
    {
        TabBar::tabLayoutChange();
        const ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, nullptr, this);
        const int numTabs = count();
        const int activeTabIndex = currentIndex();
        for (int i = 0; i < numTabs; ++i)
        {
            if (auto button = tabButton(i, closeSide))
            {
                button->setVisible(i == activeTabIndex);
            }
        }
        if (m_leftButton->isVisible())
        {
            QRect total = m_leftButton->geometry();
            total = total.united(m_rightButton->geometry());
            m_tabIndicatorUnderlay->setGeometry(total);
            m_tabIndicatorUnderlay->stackUnder(m_leftButton);
            m_tabIndicatorUnderlay->show();
        }
        else
        {
            m_tabIndicatorUnderlay->hide();
        }
    }
void DockTabBar :: tabLayoutChange ( ) { TabBar :: tabLayoutChange ( ) ; const ButtonPosition closeSide = ( ButtonPosition ) style ( ) -> styleHint ( QStyle :: SH_TabBar_CloseButtonPosition , nullptr , this ) ; const int numTabs = count ( ) ; const int activeTabIndex = currentIndex ( ) ; for ( int i = 0 ; i < numTabs ; ++ i ) { if ( auto button = tabButton ( i , closeSide ) ) { button -> setVisible ( i == activeTabIndex ) ; } } if ( m_leftButton -> isVisible ( ) ) { QRect total = m_leftButton -> geometry ( ) ; total = total . united ( m_rightButton -> geometry ( ) ) ; m_tabIndicatorUnderlay -> setGeometry ( total ) ; m_tabIndicatorUnderlay -> stackUnder ( m_leftButton ) ; m_tabIndicatorUnderlay -> show ( ) ; } else { m_tabIndicatorUnderlay -> hide ( ) ; } }
Any time the tab layout changes (e.g.
Any time the tab layout changes ( e . g .
// Only the active tab's close button should be shown // If the tab indicators are showing, then we need to show our underlay // The underlay will take up the combined space behind the left and // right indicator buttons // The indicator buttons get raised when shown, so we need to stack // our underlay under the left button, which will place it under // both indicator buttons, and then show it