mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
[TabBar] Fixed crash in tabSizeHint (division by zero).
This commit is contained in:
parent
e9fccbfb75
commit
5828d57277
|
@ -479,8 +479,8 @@ void ComboTabBar::setUpLayout()
|
||||||
{
|
{
|
||||||
int height = qMax(m_mainTabBar->height(), m_pinnedTabBar->height());
|
int height = qMax(m_mainTabBar->height(), m_pinnedTabBar->height());
|
||||||
|
|
||||||
// Workaround for Oxygen theme. For some reason, m_mainTabBar->height() returns bigger
|
// Workaround for Oxygen theme. For some reason, QTabBar::height() returns bigger
|
||||||
// height than it actually is.
|
// height than it actually should.
|
||||||
if (mApp->proxyStyle() && mApp->proxyStyle()->name() == QLatin1String("oxygen")) {
|
if (mApp->proxyStyle() && mApp->proxyStyle()->name() == QLatin1String("oxygen")) {
|
||||||
height -= 4;
|
height -= 4;
|
||||||
}
|
}
|
||||||
|
|
|
@ -255,13 +255,13 @@ QSize TabBar::tabSizeHint(int index, bool fast) const
|
||||||
m_normalTabWidth = MAXIMUM_TAB_WIDTH;
|
m_normalTabWidth = MAXIMUM_TAB_WIDTH;
|
||||||
size.setWidth(m_normalTabWidth);
|
size.setWidth(m_normalTabWidth);
|
||||||
}
|
}
|
||||||
else {
|
else if (normalTabsCount > 0) {
|
||||||
int maxWidthForTab = availableWidth / normalTabsCount;
|
int maxWidthForTab = availableWidth / normalTabsCount;
|
||||||
int realTabWidth = maxWidthForTab;
|
int realTabWidth = maxWidthForTab;
|
||||||
bool adjustingActiveTab = false;
|
bool adjustingActiveTab = false;
|
||||||
|
|
||||||
if (realTabWidth < MINIMUM_ACTIVE_TAB_WIDTH) {
|
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;
|
realTabWidth = MINIMUM_ACTIVE_TAB_WIDTH;
|
||||||
adjustingActiveTab = true;
|
adjustingActiveTab = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user