Do not animate the highlight the first time the tabbox is shown
REVIEW: 104340 Acked by Martin Gräßlin (cherry picked from commit 56345a9f158790e5f7102618c55c600cc688c855) Conflicts: kwin/tabbox/declarative.cpp kwin/tabbox/declarative.h
This commit is contained in:
parent
ef71908c6a
commit
e3d2cb9a61
3 changed files with 11 additions and 3 deletions
|
@ -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<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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue