1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

[TabBar] Fixed crash in tabSizeHint (division by zero).

This commit is contained in:
nowrep 2013-12-26 19:52:07 +01:00
parent e9fccbfb75
commit 5828d57277
2 changed files with 4 additions and 4 deletions

View File

@ -479,8 +479,8 @@ void ComboTabBar::setUpLayout()
{
int height = qMax(m_mainTabBar->height(), m_pinnedTabBar->height());
// Workaround for Oxygen theme. For some reason, m_mainTabBar->height() returns bigger
// height than it actually is.
// Workaround for Oxygen theme. For some reason, QTabBar::height() returns bigger
// height than it actually should.
if (mApp->proxyStyle() && mApp->proxyStyle()->name() == QLatin1String("oxygen")) {
height -= 4;
}

View File

@ -255,13 +255,13 @@ QSize TabBar::tabSizeHint(int index, bool fast) const
m_normalTabWidth = MAXIMUM_TAB_WIDTH;
size.setWidth(m_normalTabWidth);
}
else {
else if (normalTabsCount > 0) {
int maxWidthForTab = availableWidth / normalTabsCount;
int realTabWidth = maxWidthForTab;
bool adjustingActiveTab = false;
if (realTabWidth < MINIMUM_ACTIVE_TAB_WIDTH) {
maxWidthForTab = (availableWidth - MINIMUM_ACTIVE_TAB_WIDTH) / (normalTabsCount - 1);
maxWidthForTab = normalTabsCount > 1 ? (availableWidth - MINIMUM_ACTIVE_TAB_WIDTH) / (normalTabsCount - 1) : 0;
realTabWidth = MINIMUM_ACTIVE_TAB_WIDTH;
adjustingActiveTab = true;
}