- const KItemListStyleOption& option = styleOption();
- m_modelRolesUpdater->setIconSize(QSize(option.iconSize, option.iconSize));
-
- if (m_updateVisibleIndexRangeTimer->isActive()) {
- // If the visibility-index-range update is pending do an immediate update
- // of the range before unpausing m_modelRolesUpdater. This prevents
- // an unnecessary expensive recreation of all previews afterwards.
- m_updateVisibleIndexRangeTimer->stop();
- const int index = firstVisibleIndex();
- const int count = lastVisibleIndex() - index + 1;
- m_modelRolesUpdater->setVisibleIndexRange(index, count);
- }
-
- m_modelRolesUpdater->setPaused(isTransactionActive());
- updateTimersInterval();
-}
-
-QSizeF KFileItemListView::visibleRoleSizeHint(int index, const QByteArray& role) const
-{
- const KItemListStyleOption& option = styleOption();
-
- qreal width = m_minimumRolesWidths.value(role, 0);
- const qreal height = option.margin * 2 + option.fontMetrics.height();
-
- const QHash<QByteArray, QVariant> values = model()->data(index);
- const QString text = KFileItemListWidget::roleText(role, values);
- if (!text.isEmpty()) {
- const qreal columnMargin = option.margin * 3;
- width = qMax(width, qreal(2 * columnMargin + option.fontMetrics.width(text)));
- }
-
- if (role == "name") {
- // Increase the width by the expansion-toggle and the current expansion level
- const int expansionLevel = values.value("expansionLevel", 0).toInt();
- width += option.margin + expansionLevel * itemSize().height() + KIconLoader::SizeSmall;
-
- // Increase the width by the required space for the icon
- width += option.margin * 2 + option.iconSize;
- }
-
- return QSizeF(width, height);
-}
-
-void KFileItemListView::updateLayoutOfVisibleItems()
-{
- if (!model()) {
- return;
- }
-
- foreach (KItemListWidget* widget, visibleItemListWidgets()) {
- initializeItemListWidget(widget);
- }
- triggerVisibleIndexRangeUpdate();
-}