MCPcopy Create free account
hub / github.com/TeXworks/texworks / reinitializeScene

Method reinitializeScene

modules/QtPDF/src/PDFDocumentScene.cpp:295–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

293}
294
295void PDFDocumentScene::reinitializeScene()
296{
297 // Remove the _unlockProxy from the scene (if applicable) to avoid it being
298 // destroyed automatically by the subsequent call to clear()
299 if (_unlockProxy->scene() == this)
300 removeItem(_unlockProxy);
301 clear();
302 _pages.clear();
303 _pageLayout.clearPages();
304
305 _lastPage = _doc->numPages();
306 if (!_doc->isValid())
307 return;
308 if (_doc->isLocked()) {
309 // FIXME: Deactivate "normal" user interaction, e.g., zooming, panning, etc.
310 addItem(_unlockProxy);
311 setSceneRect(QRectF());
312 }
313 else {
314 // Create a `PDFPageGraphicsItem` for each page in the PDF document and let
315 // them be layed out by a `PDFPageLayout` instance.
316 if (_shownPageIdx >= _lastPage)
317 _shownPageIdx = _lastPage - 1;
318
319 for (size_type i = 0; i < _lastPage; ++i)
320 {
321 PDFPageGraphicsItem * pagePtr = new PDFPageGraphicsItem(_doc->page(i), _dpiX, _dpiY);
322 pagePtr->setVisible(i == _shownPageIdx || _shownPageIdx == -2);
323 _pages.append(pagePtr);
324 addItem(pagePtr);
325 _pageLayout.addPage(pagePtr);
326 }
327 _pageLayout.relayout();
328 }
329}
330
331void PDFDocumentScene::finishUnlock()
332{

Callers

nothing calls this directly

Calls 8

addPageMethod · 0.80
relayoutMethod · 0.80
clearMethod · 0.45
clearPagesMethod · 0.45
numPagesMethod · 0.45
isValidMethod · 0.45
isLockedMethod · 0.45
pageMethod · 0.45

Tested by

no test coverage detected