diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2011-01-22 18:59:55 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2011-01-22 18:59:55 +0100 |
commit | 3300735fe4710d7cf9d4fedbc965a80c56721f1a (patch) | |
tree | 9ef235f16bf25467f6abe4d11ee5ba6caa74bd29 | |
parent | If showDeveloperTools is disabled, hide the development entries in the rekonq... (diff) | |
download | rekonq-3300735fe4710d7cf9d4fedbc965a80c56721f1a.tar.xz |
Fix tab preview flickering on mouse hover.
Patch by Furkan Uzumcu, cleaned up and reviewed by me
-rw-r--r-- | src/tabbar.cpp | 12 | ||||
-rw-r--r-- | src/tabbar.h | 1 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/tabbar.cpp b/src/tabbar.cpp index fcc7b789..7a8419a3 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -54,6 +54,7 @@ #include <QtGui/QMouseEvent> #include <QtGui/QToolButton> + #define BASE_WIDTH_DIVISOR 4 #define MIN_WIDTH_DIVISOR 8 @@ -62,6 +63,7 @@ TabBar::TabBar(QWidget *parent) : KTabBar(parent) , m_actualIndex(-1) , m_currentTabPreviewIndex(-1) + , m_isFirstTimeOnTab(true) { setElideMode(Qt::ElideRight); @@ -146,6 +148,9 @@ void TabBar::detachTab() void TabBar::showTabPreview() { + if(m_isFirstTimeOnTab) + m_isFirstTimeOnTab = false; + //delete previous tab preview delete m_previewPopup.data(); m_previewPopup.clear(); @@ -232,7 +237,11 @@ void TabBar::mouseMoveEvent(QMouseEvent *event) ) { m_currentTabPreviewIndex = tabIndex; - QTimer::singleShot(200, this, SLOT( showTabPreview() ) ); + + // if first time over tab, apply a small delay. If not, show it now! + m_isFirstTimeOnTab + ? QTimer::singleShot(200, this, SLOT(showTabPreview())) + : showTabPreview(); } // if current tab or not found then hide previous tab preview @@ -258,6 +267,7 @@ void TabBar::leaveEvent(QEvent *event) m_previewPopup.data()->hide(); } m_currentTabPreviewIndex = -1; + m_isFirstTimeOnTab = true; } KTabBar::leaveEvent(event); diff --git a/src/tabbar.h b/src/tabbar.h index 41707865..b505f78b 100644 --- a/src/tabbar.h +++ b/src/tabbar.h @@ -103,6 +103,7 @@ private: * the index of the tab preview shown */ int m_currentTabPreviewIndex; + bool m_isFirstTimeOnTab; }; #endif |