mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Issue #128: Create list of markup annotations
This commit is contained in:
@ -158,6 +158,7 @@ PDFSidebarWidget::PDFSidebarWidget(pdf::PDFDrawWidgetProxy* proxy,
|
||||
connect(ui->notesSearchLineEdit, &QLineEdit::editingFinished, this, &PDFSidebarWidget::onNotesSearchText);
|
||||
connect(ui->notesSearchLineEdit, &QLineEdit::textChanged, this, &PDFSidebarWidget::onNotesSearchText);
|
||||
connect(ui->notesTreeView, &QTreeView::clicked, this, &PDFSidebarWidget::onNotesItemClicked);
|
||||
connect(ui->notesTreeView, &QTreeView::customContextMenuRequested, this, &PDFSidebarWidget::onNotesTreeViewContextMenuRequested);
|
||||
|
||||
m_pageInfo[Invalid] = { nullptr, ui->emptyPage };
|
||||
m_pageInfo[OptionalContent] = { ui->optionalContentButton, ui->optionalContentPage };
|
||||
@ -1092,6 +1093,32 @@ void PDFSidebarWidget::onOutlineTreeViewContextMenuRequested(const QPoint& pos)
|
||||
contextMenu.exec(ui->outlineTreeView->mapToGlobal(pos));
|
||||
}
|
||||
|
||||
void PDFSidebarWidget::onNotesTreeViewContextMenuRequested(const QPoint& pos)
|
||||
{
|
||||
QModelIndex index = ui->notesTreeView->indexAt(pos);
|
||||
|
||||
if (index.isValid())
|
||||
{
|
||||
QVariant userData = index.data(Qt::UserRole);
|
||||
if (userData.isValid())
|
||||
{
|
||||
const int annotationIndex = userData.toInt();
|
||||
|
||||
if (annotationIndex >= 0 && annotationIndex < m_markupAnnotations.size())
|
||||
{
|
||||
const auto& annotationItem = m_markupAnnotations[annotationIndex];
|
||||
QPoint globalPos = ui->notesTreeView->viewport()->mapToGlobal(pos);
|
||||
|
||||
pdf::PDFObjectReference annotationReference = annotationItem.first;
|
||||
pdf::PDFObjectReference pageReference = m_document->getCatalog()->getPage(annotationItem.second)->getPageReference();
|
||||
|
||||
m_proxy->goToPage(annotationItem.second);
|
||||
m_proxy->getAnnotationManager()->showAnnotationMenu(annotationReference, pageReference, globalPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PDFSidebarWidget::onOutlineItemsChanged()
|
||||
{
|
||||
if (m_document)
|
||||
|
@ -120,8 +120,9 @@ private:
|
||||
void onThumbnailsSizeChanged(int size);
|
||||
void onAttachmentCustomContextMenuRequested(const QPoint& pos);
|
||||
void onThumbnailClicked(const QModelIndex& index);
|
||||
void onSignatureCustomContextMenuRequested(const QPoint &pos);
|
||||
void onOutlineTreeViewContextMenuRequested(const QPoint &pos);
|
||||
void onSignatureCustomContextMenuRequested(const QPoint& pos);
|
||||
void onOutlineTreeViewContextMenuRequested(const QPoint& pos);
|
||||
void onNotesTreeViewContextMenuRequested(const QPoint& pos);
|
||||
void onOutlineItemsChanged();
|
||||
void onBookmarkActivated(int index, PDFBookmarkManager::Bookmark bookmark);
|
||||
void onBookmarsCurrentIndexChanged(const QModelIndex& current, const QModelIndex& previous);
|
||||
|
@ -539,7 +539,14 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeView" name="notesTreeView"/>
|
||||
<widget class="QTreeView" name="notesTreeView">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
Reference in New Issue
Block a user