mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
[ComboTabBar] Fix tabAt when pos is on right/left scroll buttons
This commit is contained in:
parent
2a60572f36
commit
b4f3b5962e
|
@ -197,17 +197,18 @@ QRect ComboTabBar::tabRect(int index) const
|
|||
|
||||
int ComboTabBar::tabAt(const QPoint &pos) const
|
||||
{
|
||||
QWidget* that = const_cast<ComboTabBar*>(this);
|
||||
|
||||
int index = -1;
|
||||
if (m_mainTabBarWidget->rect().contains(m_mainTabBarWidget->mapFromGlobal(QCursor::pos()))) {
|
||||
index = m_mainTabBar->tabAt(m_mainTabBar->mapFrom(that, pos));
|
||||
|
||||
const QPoint globalPos = mapToGlobal(pos);
|
||||
|
||||
if (m_mainTabBarWidget->hasTabBarAt(m_mainTabBarWidget->mapFromGlobal(globalPos))) {
|
||||
index = m_mainTabBar->tabAt(m_mainTabBar->mapFromGlobal(globalPos));
|
||||
if (index != -1) {
|
||||
index += pinnedTabsCount();
|
||||
}
|
||||
}
|
||||
else if (m_pinnedTabBarWidget->rect().contains(m_pinnedTabBarWidget->mapFromGlobal(QCursor::pos()))) {
|
||||
index = m_pinnedTabBar->tabAt(m_pinnedTabBar->mapFrom(that, pos));
|
||||
else if (m_pinnedTabBarWidget->hasTabBarAt(m_pinnedTabBarWidget->mapFromGlobal(globalPos))) {
|
||||
index = m_pinnedTabBar->tabAt(m_pinnedTabBar->mapFromGlobal(globalPos));
|
||||
}
|
||||
|
||||
return index;
|
||||
|
@ -1365,6 +1366,15 @@ void TabBarScrollWidget::setUsesScrollButtons(bool useButtons)
|
|||
}
|
||||
}
|
||||
|
||||
bool TabBarScrollWidget::hasTabBarAt(const QPoint &pos) const
|
||||
{
|
||||
if (m_leftScrollButton->rect().contains(pos) || m_rightScrollButton->rect().contains(pos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return m_scrollArea->rect().contains(pos);
|
||||
}
|
||||
|
||||
void TabBarScrollWidget::setContainersName(const QString &name)
|
||||
{
|
||||
m_leftContainer->setObjectName(name);
|
||||
|
|
|
@ -265,6 +265,8 @@ public:
|
|||
bool usesScrollButtons() const;
|
||||
void setUsesScrollButtons(bool useButtons);
|
||||
|
||||
bool hasTabBarAt(const QPoint &pos) const;
|
||||
|
||||
void setContainersName(const QString &name);
|
||||
void enableBluredBackground(bool enable);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user