void KTextDocumentLayout::setLayout(LayoutState *layout) { Q_ASSERT(layout); delete m_state; m_state = layout; scheduleLayout(); }
void PlayListGalleryView::setPlayListRecords(QList<PlayListRecord *> records) { clear(); incrItemsToLoad(records.count()); for (int i = 0; i < records.count(); ++i) { PlayListGalleryItem *item = new PlayListGalleryItem(records[i], rendererFactory()); addItem(item); } scheduleLayout(); }
void KTextDocumentLayout::documentChanged(int position, int charsRemoved, int charsAdded) { Q_UNUSED(charsRemoved); if (shapes().count() == 0) // nothing to do. return; /* switch (document()->documentLayout()->property("KoTextRelayoutForPage").toInt()) { case KTextShapeData::NormalState: kDebug() << "KoTextRelayoutForPage in NormalState"; break; case KTextShapeData::LayoutCopyShape: kDebug() << "KoTextRelayoutForPage in LayoutCopyShape"; break; case KTextShapeData::LayoutOrig: kDebug() << "KoTextRelayoutForPage in LayoutOrig, skipping relayout"; break; } */ if (document()->documentLayout()->property("KoTextRelayoutForPage").toInt() == KTextShapeData::LayoutOrig) { // don't refresh if we relayout after a relayout-for-page return; } int from = position; const int to = from + charsAdded; while (from < to) { // find blocks that have been added QTextBlock block = document()->findBlock(from); if (! block.isValid()) break; if (from == block.position() && block.textList()) { KTextBlockData *data = dynamic_cast<KTextBlockData*>(block.userData()); if (data) data->setCounterWidth(-1); // invalidate whole list. } from = block.position() + block.length(); } foreach (KShape *shape, shapes()) { KTextShapeData *data = qobject_cast<KTextShapeData*>(shape->userData()); Q_ASSERT(data); if (data && data->position() <= position && data->endPosition() >= position) { // found our (first) shape to re-layout data->foul(); m_state->interrupted = true; scheduleLayout(); return; } }