QVariant KPrSlidesSorterDocumentModel::data(const QModelIndex &index, int role) const { if (! index.isValid() || !m_document) { return QVariant(); } Q_ASSERT(index.model() == this); KoPAPageBase *page = pageByIndex(index); switch (role) { case Qt::DisplayRole: { QString name = i18n("Unknown"); if (page) { name = page->name(); if (name.isEmpty()) { //Default case name = i18n("Slide %1", m_document->pageIndex(page) + 1); } } return name; } case Qt::DecorationRole: { return QIcon(page->thumbnail(m_viewModeSlidesSorter->iconSize())); } case Qt::EditRole: { return page->name(); } default: return QVariant(); } }
void KoPADocument::paintContent(QPainter &painter, const QRect &rect) { KoPAPage * page = pageByIndex(0, false); Q_ASSERT(page); QPixmap thumbnail(pageThumbnail(page, rect.size())); painter.drawPixmap(rect, thumbnail); }