summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-03-21 22:26:48 +0100
committerAndrea Diamantini <adjam7@gmail.com>2011-03-21 22:40:25 +0100
commit8946eecd22b4810dea452dafa4e0e2f8e55c573c (patch)
tree34afbfa1d441165ada729a30767838fa2a2c4979
parentReally hiding the tabbar... (diff)
downloadrekonq-8946eecd22b4810dea452dafa4e0e2f8e55c573c.tar.xz
Workaround the troubles with the tabbar highlight feature.
Another fantastic patch by Johannes Trosher. Thanks :) CCBUG:267234
-rw-r--r--src/mainview.cpp7
-rw-r--r--src/tabbar.cpp15
-rw-r--r--src/tabbar.h1
-rw-r--r--src/tabhighlighteffect.cpp3
4 files changed, 14 insertions, 12 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp
index bf99010e..a0f05ccd 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -56,6 +56,8 @@
#include <QtGui/QMovie>
#include <QtGui/QToolButton>
+//Hack:
+QString temporaryUglyHackString = "";
MainView::MainView(MainWindow *parent)
: KTabWidget(parent)
@@ -310,11 +312,13 @@ WebTab *MainView::newWebTab(bool focused)
if (ReKonfig::openTabsNearCurrent())
{
insertTab(currentIndex() + 1, tab, i18n("(Untitled)"));
+ temporaryUglyHackString = tabText(currentIndex() + 1);
m_widgetBar->insertWidget(currentIndex() + 1, tab->urlBar());
}
else
{
addTab(tab, i18n("(Untitled)"));
+ temporaryUglyHackString = tabText(count() - 1);
m_widgetBar->addWidget(tab->urlBar());
}
updateTabBar();
@@ -589,7 +593,8 @@ void MainView::webViewTitleChanged(const QString &title)
}
else
{
- tabBar()->setTabHighlighted(index);
+ if (tabTitle != temporaryUglyHackString)
+ tabBar()->setTabHighlighted(index);
}
rApp->historyManager()->updateHistoryEntry(tab->url(), tabTitle);
if (ReKonfig::hoveringTabOption() == 1)
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
index 557fae96..1ab357f2 100644
--- a/src/tabbar.cpp
+++ b/src/tabbar.cpp
@@ -365,15 +365,6 @@ void TabBar::tabRemoved(int index)
if (ReKonfig::animatedTabHighlighting())
removeAnimation(index);
-
- m_tabHighlightEffect->update();
-}
-
-
-void TabBar::tabInserted(int index)
-{
- Q_UNUSED(index);
- m_tabHighlightEffect->update();
}
@@ -424,8 +415,9 @@ void TabBar::setTabHighlighted(int index)
if (tabTextColor(index) != highlightColor)
{
- if (ReKonfig::animatedTabHighlighting)
+ if (ReKonfig::animatedTabHighlighting())
{
+ m_tabHighlightEffect->setEnabled(true);
m_tabHighlightEffect->setProperty(propertyName, qreal(0.9));
QPropertyAnimation *anim = new QPropertyAnimation(m_tabHighlightEffect, propertyName);
m_highlightAnimation.insert(propertyName, anim);
@@ -463,6 +455,9 @@ void TabBar::removeAnimation(int index)
QPropertyAnimation *anim = m_highlightAnimation.take(propertyName);
m_animationMapper->removeMappings(anim);
delete anim;
+
+ if (m_highlightAnimation.isEmpty())
+ m_tabHighlightEffect->setEnabled(false);
}
diff --git a/src/tabbar.h b/src/tabbar.h
index 0137065d..c7bf88e6 100644
--- a/src/tabbar.h
+++ b/src/tabbar.h
@@ -84,7 +84,6 @@ protected:
virtual void mousePressEvent(QMouseEvent *event);
virtual void tabRemoved(int index);
- virtual void tabInserted(int index);
private slots:
void cloneTab();
diff --git a/src/tabhighlighteffect.cpp b/src/tabhighlighteffect.cpp
index b2d1e0df..b92017cf 100644
--- a/src/tabhighlighteffect.cpp
+++ b/src/tabhighlighteffect.cpp
@@ -63,6 +63,9 @@ void TabHighlightEffect::draw(QPainter *painter)
qreal opacity = property(propertyName).toReal();
QRect textRect = m_tabBar->tabTextRect(index);
+ if (!boundingRect().contains(textRect))
+ continue;
+
QString tabText = m_tabBar->fontMetrics().elidedText(m_tabBar->tabText(index), Qt::ElideRight,
textRect.width(), Qt::TextShowMnemonic);