fix flickable bounds when filtering

REVIEW: 105027
BUG: 318096
FIXED-IN: 4.10.3
This commit is contained in:
Thomas Lübking 2013-04-09 18:50:19 +02:00
parent 10002e2006
commit e7050f64a8

View file

@ -157,6 +157,8 @@ void KWinDecorationModule::init()
connect(m_ui->configureButtonsButton, SIGNAL(clicked(bool)), this, SLOT(slotConfigureButtons()));
connect(m_ui->ghnsButton, SIGNAL(clicked(bool)), SLOT(slotGHNSClicked()));
connect(m_ui->searchEdit, SIGNAL(textChanged(QString)), m_proxyModel, SLOT(setFilterFixedString(QString)));
connect(m_ui->searchEdit, SIGNAL(textChanged(QString)), m_ui->decorationList->rootObject(), SLOT(returnToBounds()), Qt::QueuedConnection);
connect(m_ui->searchEdit, SIGNAL(textChanged(QString)), SLOT(updateScrollbarRange()), Qt::QueuedConnection);
connect(m_ui->configureDecorationButton, SIGNAL(clicked(bool)), SLOT(slotConfigureDecoration()));
m_ui->decorationList->disconnect(m_ui->decorationList->verticalScrollBar());
@ -528,8 +530,10 @@ void KWinDecorationModule::updatePreviewWidth()
void KWinDecorationModule::updateScrollbarRange()
{
m_ui->decorationList->verticalScrollBar()->blockSignals(true);
const bool atMinimum = m_ui->decorationList->rootObject()->property("atYBeginning").toBool();
const int h = m_ui->decorationList->rootObject()->property("contentHeight").toInt();
m_ui->decorationList->verticalScrollBar()->setRange(0, h - m_ui->decorationList->height());
const int y = atMinimum ? m_ui->decorationList->rootObject()->property("contentY").toInt() : 0;
m_ui->decorationList->verticalScrollBar()->setRange(y, y + h - m_ui->decorationList->height());
m_ui->decorationList->verticalScrollBar()->setPageStep(m_ui->decorationList->verticalScrollBar()->maximum()/m_model->rowCount());
m_ui->decorationList->verticalScrollBar()->blockSignals(false);
}