我正用 PyQt4 和 python-popplerqt4 制作一个 PDF 阅读器。 PDF 页面( QPixmaps) 显示在QLable 中, 垂直显示在 QFrame 中。 QFrame 放置在 QScrollArea 中 。
QMainWindow
|_ QScrollArea
|_ QFrame (Document: stretch)
|_ QLabel (Page: fixed size)
| |_ QPixmap (stretch)
|_ QLabel
| |_ QPixmap
|_ etc.
文档的大小由 QLabels 的固定大小决定。 QPixmap 设置为相应的伸展, 而 QFrame 周围的页面会自然调整其大小 。
当我要求缩放时, 页面( Qlabels) 会用 < codeLabel. setFixedSize () 重新缩放。 效果是 < em> dispecting : 重新缩放文档时, 看起来像是摇摆和闪烁。 在 Evince 或 Mendeley 的缩放非常顺利 。
我在其他地方读到过,在缩放前拨打
How can I scale the document in the QScrollArea and produce a smooth zoom effect?
PS: The images of the Poppler.Pages are drawn for the visible QLabel recipients only. i.e. resizing a document of 700 pages does not involve resizing as many images. It will in fact resize 2 to 4 images at the maximum (and the more, the less the resolution). Resizing the Document object then consists merely in resizing QLabels, for the most part empty.