| 781 | } |
| 782 | |
| 783 | void TabControl::updateBarOld() |
| 784 | { |
| 785 | // подстраховка |
| 786 | if (_getWidgetBar()->getWidth() < 1) |
| 787 | return; |
| 788 | |
| 789 | if ((_getWidgetBar()->getWidth() < mWidthBar) && (1 < mItemsInfo.size())) |
| 790 | { |
| 791 | if (!mButtonShow) |
| 792 | { |
| 793 | mButtonShow = true; |
| 794 | |
| 795 | if (nullptr != mButtonLeft) |
| 796 | mButtonLeft->setVisible(true); |
| 797 | if (nullptr != mButtonRight) |
| 798 | mButtonRight->setVisible(true); |
| 799 | if (nullptr != mButtonDecor) |
| 800 | mButtonDecor->setVisible(true); |
| 801 | for (auto& iter : mWidgetsPatch) |
| 802 | iter->setVisible(true); |
| 803 | if (mWidgetBar != nullptr) |
| 804 | mWidgetBar->setSize(mWidgetBar->getWidth() - mOffsetTab, mWidgetBar->getHeight()); |
| 805 | } |
| 806 | } |
| 807 | else |
| 808 | { |
| 809 | if (mButtonShow) |
| 810 | { |
| 811 | mButtonShow = false; |
| 812 | if (nullptr != mButtonLeft) |
| 813 | mButtonLeft->setVisible(false); |
| 814 | if (nullptr != mButtonRight) |
| 815 | mButtonRight->setVisible(false); |
| 816 | if (nullptr != mButtonDecor) |
| 817 | mButtonDecor->setVisible(false); |
| 818 | for (auto& iter : mWidgetsPatch) |
| 819 | iter->setVisible(false); |
| 820 | if (mWidgetBar != nullptr) |
| 821 | mWidgetBar->setSize(mWidgetBar->getWidth() + mOffsetTab, mWidgetBar->getHeight()); |
| 822 | } |
| 823 | } |
| 824 | |
| 825 | // проверяем правильность стартового индекса |
| 826 | if (mStartIndex > 0) |
| 827 | { |
| 828 | // считаем длинну видимых кнопок |
| 829 | int width = 0; |
| 830 | for (size_t pos = mStartIndex; pos < mItemsInfo.size(); pos++) |
| 831 | width += mItemsInfo[pos].width; |
| 832 | |
| 833 | // уменьшаем индекс до тех пор пока кнопка до индекста полностью не влезет в бар |
| 834 | while ((mStartIndex > 0) && ((width + mItemsInfo[mStartIndex - 1].width) <= _getWidgetBar()->getWidth())) |
| 835 | { |
| 836 | mStartIndex--; |
| 837 | width += mItemsInfo[mStartIndex].width; |
| 838 | } |
| 839 | } |
| 840 |
nothing calls this directly
no test coverage detected