mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
ComboTabBar: Ignore buttons that returns invalid element rect in dragOffset
Closes #2546
This commit is contained in:
parent
b21e2634bc
commit
cf5831d1db
@ -1210,17 +1210,19 @@ bool TabBarHelper::event(QEvent* ev)
|
|||||||
// Hack to get dragOffset from QTabBar internals
|
// Hack to get dragOffset from QTabBar internals
|
||||||
int TabBarHelper::dragOffset(QStyleOptionTab *option, int tabIndex) const
|
int TabBarHelper::dragOffset(QStyleOptionTab *option, int tabIndex) const
|
||||||
{
|
{
|
||||||
QStyle::SubElement element = QStyle::SE_TabBarTabLeftButton;
|
QRect rect;
|
||||||
QWidget *button = tabButton(tabIndex, QTabBar::LeftSide);
|
QWidget *button = tabButton(tabIndex, QTabBar::LeftSide);
|
||||||
if (!button) {
|
if (button) {
|
||||||
element = QStyle::SE_TabBarTabRightButton;
|
rect = style()->subElementRect(QStyle::SE_TabBarTabLeftButton, option, this);
|
||||||
button = tabButton(tabIndex, QTabBar::RightSide);
|
|
||||||
}
|
}
|
||||||
if (!button) {
|
if (!rect.isValid()) {
|
||||||
|
button = tabButton(tabIndex, QTabBar::RightSide);
|
||||||
|
rect = style()->subElementRect(QStyle::SE_TabBarTabRightButton, option, this);
|
||||||
|
}
|
||||||
|
if (!button || !rect.isValid()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
const QPoint p = style()->subElementRect(element, option, this).topLeft();
|
return button->pos().x() - rect.topLeft().x();
|
||||||
return button->pos().x() - p.x();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Taken from qtabbar.cpp
|
// Taken from qtabbar.cpp
|
||||||
|
Loading…
Reference in New Issue
Block a user