| 667 | } |
| 668 | |
| 669 | void PDFAnnotationsInfoWidget::annotationsReady(int index) |
| 670 | { |
| 671 | Q_ASSERT(_table != nullptr); |
| 672 | int i{_table->rowCount()}; |
| 673 | _table->setRowCount(static_cast<decltype(_table->rowCount())>(i + _annotWatcher.resultAt(index).count())); |
| 674 | |
| 675 | |
| 676 | foreach(QSharedPointer<Annotation::AbstractAnnotation> pdfAnnot, _annotWatcher.resultAt(index)) { |
| 677 | // we only use valid markup annotation here |
| 678 | if (!pdfAnnot || !pdfAnnot->isMarkup()) |
| 679 | continue; |
| 680 | Annotation::Markup * annot = dynamic_cast<Annotation::Markup*>(pdfAnnot.data()); |
| 681 | QSharedPointer<Backend::Page> page(annot->page().toStrongRef()); |
| 682 | if (page) |
| 683 | _table->setItem(i, 0, new QTableWidgetItem(QString::number(page->pageNum() + 1))); |
| 684 | _table->setItem(i, 1, new QTableWidgetItem(annot->subject())); |
| 685 | _table->setItem(i, 2, new QTableWidgetItem(annot->author())); |
| 686 | _table->setItem(i, 3, new QTableWidgetItem(annot->contents())); |
| 687 | ++i; |
| 688 | } |
| 689 | _table->setRowCount(i); |
| 690 | } |
| 691 | |
| 692 | void PDFAnnotationsInfoWidget::clear() |
| 693 | { |