From e3d2cb9a6197f216bfc1c2f97070d51a6005aa51 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Tue, 20 Mar 2012 23:58:04 +0100 Subject: [PATCH] Do not animate the highlight the first time the tabbox is shown MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit REVIEW: 104340 Acked by Martin Gräßlin (cherry picked from commit 56345a9f158790e5f7102618c55c600cc688c855) Conflicts: kwin/tabbox/declarative.cpp kwin/tabbox/declarative.h --- tabbox/declarative.cpp | 10 +++++++++- tabbox/declarative.h | 2 +- tabbox/tabboxhandler.cpp | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/tabbox/declarative.cpp b/tabbox/declarative.cpp index a470fe83fe..b579298ce8 100644 --- a/tabbox/declarative.cpp +++ b/tabbox/declarative.cpp @@ -273,13 +273,21 @@ void DeclarativeView::slotUpdateGeometry() } } -void DeclarativeView::setCurrentIndex(const QModelIndex &index) +void DeclarativeView::setCurrentIndex(const QModelIndex &index, bool disableAnimation) { if (tabBox->config().tabBoxMode() != m_mode) { return; } if (QObject *item = rootObject()->findChild("listView")) { + QVariant durationRestore; + if (disableAnimation) { + durationRestore = item->property("highlightMoveDuration"); + item->setProperty("highlightMoveDuration", QVariant(1)); + } item->setProperty("currentIndex", index.row()); + if (disableAnimation) { + item->setProperty("highlightMoveDuration", durationRestore); + } } } diff --git a/tabbox/declarative.h b/tabbox/declarative.h index 28b8a74739..0de08ba168 100644 --- a/tabbox/declarative.h +++ b/tabbox/declarative.h @@ -56,7 +56,7 @@ public: DeclarativeView(QAbstractItemModel *model, TabBoxConfig::TabBoxMode mode, QWidget *parent = NULL); virtual void showEvent(QShowEvent *event); virtual void resizeEvent(QResizeEvent *event); - void setCurrentIndex(const QModelIndex &index); + void setCurrentIndex(const QModelIndex &index, bool disableAnimation = false); protected: virtual void hideEvent(QHideEvent *event); diff --git a/tabbox/tabboxhandler.cpp b/tabbox/tabboxhandler.cpp index e91ea71da0..6dea794add 100644 --- a/tabbox/tabboxhandler.cpp +++ b/tabbox/tabboxhandler.cpp @@ -235,7 +235,7 @@ void TabBoxHandler::show() d->m_declarativeView = new DeclarativeView(d->clientModel(), TabBoxConfig::ClientTabBox); } d->m_declarativeView->show(); - d->m_declarativeView->setCurrentIndex(d->index); + d->m_declarativeView->setCurrentIndex(d->index, true); } else { if (!d->m_declarativeDesktopView) { d->m_declarativeDesktopView = new DeclarativeView(d->desktopModel(), TabBoxConfig::DesktopTabBox);