summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <tsdgeos@terra.es>2012-03-20 22:58:04 (GMT)
committerAlbert Astals Cid <tsdgeos@terra.es>2012-03-20 22:58:43 (GMT)
commit56345a9f158790e5f7102618c55c600cc688c855 (patch)
treea0d2434ff5f0565dc75861b8f3f6703e3d5d1d5a
parent00e6efad519f7d1063c0504758a44138aa408b7e (diff)
Do not animate the highlight the first time the tabbox is shown
REVIEW: 104340 Acked by Martin Gräßlin
-rw-r--r--kwin/tabbox/declarative.cpp10
-rw-r--r--kwin/tabbox/declarative.h2
-rw-r--r--kwin/tabbox/tabboxhandler.cpp2
3 files changed, 11 insertions, 3 deletions
diff --git a/kwin/tabbox/declarative.cpp b/kwin/tabbox/declarative.cpp
index f7a9c98..f9d4647 100644
--- a/kwin/tabbox/declarative.cpp
+++ b/kwin/tabbox/declarative.cpp
@@ -174,10 +174,18 @@ void DeclarativeView::slotUpdateGeometry()
width, height);
}
-void DeclarativeView::setCurrentIndex(const QModelIndex &index)
+void DeclarativeView::setCurrentIndex(const QModelIndex &index, bool disableAnimation)
{
if (QObject *item = rootObject()->findChild<QObject*>("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/kwin/tabbox/declarative.h b/kwin/tabbox/declarative.h
index 5674054..6108abe 100644
--- a/kwin/tabbox/declarative.h
+++ b/kwin/tabbox/declarative.h
@@ -55,7 +55,7 @@ public:
DeclarativeView(QAbstractItemModel *model, 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);
QModelIndex indexAt(const QPoint &pos) const;
public Q_SLOTS:
diff --git a/kwin/tabbox/tabboxhandler.cpp b/kwin/tabbox/tabboxhandler.cpp
index 0e8ad89..8a1f50f 100644
--- a/kwin/tabbox/tabboxhandler.cpp
+++ b/kwin/tabbox/tabboxhandler.cpp
@@ -417,7 +417,7 @@ void TabBoxHandler::show()
d->m_declarativeView = new DeclarativeView(d->clientModel());
}
d->m_declarativeView->show();
- d->m_declarativeView->setCurrentIndex(d->index);
+ d->m_declarativeView->setCurrentIndex(d->index, true);
} else {
if (!d->view) {
d->createView();