mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Editor plugin: Edit text
This commit is contained in:
@ -151,7 +151,7 @@ void EditorPlugin::setWidget(pdf::PDFWidget* widget)
|
||||
connect(&m_scene, &pdf::PDFPageContentScene::selectionChanged, this, &EditorPlugin::onSceneSelectionChanged);
|
||||
connect(&m_scene, &pdf::PDFPageContentScene::editElementRequest, this, &EditorPlugin::onSceneEditElement);
|
||||
connect(clearAction, &QAction::triggered, &m_scene, &pdf::PDFPageContentScene::clear);
|
||||
connect(activateAction, &QAction::triggered, this, &EditorPlugin::setActive);
|
||||
connect(activateAction, &QAction::triggered, this, &EditorPlugin::onSetActive);
|
||||
connect(m_widget->getDrawWidgetProxy(), &pdf::PDFDrawWidgetProxy::drawSpaceChanged, this, &EditorPlugin::onDrawSpaceChanged);
|
||||
|
||||
updateActions();
|
||||
@ -200,7 +200,7 @@ bool EditorPlugin::save()
|
||||
const pdf::PDFPage* page = m_document->getCatalog()->getPage(pageIndex);
|
||||
const pdf::PDFEditedPageContent& editedPageContent = m_editedPageContent.at(pageIndex);
|
||||
|
||||
pdf::PDFPageContentEditorContentStreamBuilder contentStreamBuilder;
|
||||
pdf::PDFPageContentEditorContentStreamBuilder contentStreamBuilder(m_document);
|
||||
contentStreamBuilder.setFontDictionary(editedPageContent.getFontDictionary());
|
||||
|
||||
auto it = elementsByPage.find(pageIndex);
|
||||
@ -477,6 +477,17 @@ void EditorPlugin::setActive(bool active)
|
||||
}
|
||||
}
|
||||
|
||||
void EditorPlugin::onSetActive(bool active)
|
||||
{
|
||||
if (!active && !save())
|
||||
{
|
||||
updateActions();
|
||||
return;
|
||||
}
|
||||
|
||||
setActive(active);
|
||||
}
|
||||
|
||||
void EditorPlugin::updateActions()
|
||||
{
|
||||
m_actions[Activate]->setEnabled(m_document);
|
||||
|
Reference in New Issue
Block a user