1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

ComboTabBar:: Call ensureVisible only after resize event is processed

Also change delay to call ensureVisible after current tab is changed
to 100ms
This commit is contained in:
David Rosca 2016-08-15 14:47:30 +02:00
parent 42eadaeb2f
commit 4c7735139e
2 changed files with 4 additions and 3 deletions

View File

@ -578,6 +578,8 @@ int ComboTabBar::pinTabBarWidth() const
bool ComboTabBar::event(QEvent *event) bool ComboTabBar::event(QEvent *event)
{ {
const bool res = QWidget::event(event);
switch (event->type()) { switch (event->type()) {
case QEvent::ToolTip: case QEvent::ToolTip:
if (!isDragInProgress() && !isScrollInProgress()) { if (!isDragInProgress() && !isScrollInProgress()) {
@ -606,7 +608,7 @@ bool ComboTabBar::event(QEvent *event)
break; break;
} }
return QWidget::event(event); return res;
} }
void ComboTabBar::wheelEvent(QWheelEvent* event) void ComboTabBar::wheelEvent(QWheelEvent* event)
@ -1394,7 +1396,6 @@ void TabBarScrollWidget::ensureVisible(int index, int xmargin)
if (index < 0 || index >= m_tabBar->count()) { if (index < 0 || index >= m_tabBar->count()) {
return; return;
} }
xmargin = qMin(xmargin, m_scrollArea->viewport()->width() / 2); xmargin = qMin(xmargin, m_scrollArea->viewport()->width() / 2);
// Qt Bug? the following lines were taken from QScrollArea::ensureVisible() and // Qt Bug? the following lines were taken from QScrollArea::ensureVisible() and

View File

@ -433,7 +433,7 @@ void TabBar::currentTabChanged(int index)
showCloseButton(index); showCloseButton(index);
hideCloseButton(m_tabWidget->lastTabIndex()); hideCloseButton(m_tabWidget->lastTabIndex());
QTimer::singleShot(0, this, [=]() { QTimer::singleShot(100, this, [=]() {
ensureVisible(index); ensureVisible(index);
}); });
} }