Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Zooming in QTextEdit



  • I would like to implement a zooming scale bar for QTextEdit, which will zoom everything. The zooming is for displaying only, the actual document font, image size etc should not be changed. That is, if user saves or prints the document in zoom mode, it should be saved and printed in its original size.

    Can someone give me some idea how to achieve this? Thank you.





  • Yes, I did. That seems to be changing the font size only. Another difference is that it is actually changing the document therefore printing the document is going to look different...


  • Lifetime Qt Champion

    Hi,

    Then what about using a copy of the document for printing ?



  • I rather deal with one document as user may edit the document in zoom mode... Maybe I can zoom it back to 100% before printing.

    However, for the zooming part, it seems that I need to use zoomIn and zoomOut for the text, deal with the image size myself, change the wrap size according to zoom, is that right? How about QTextTable, changing the column width and row height seem to be a lot of hassle?

    All these seems to be a lot of work, I wonder if I'm going on a wrong path. How does a web browser do the zooming? Thanks.


  • Lifetime Qt Champion

    Indeed, the documentation of the methods states explicitly that it won't touch the images.

    As for an alternative, QWeb/WebEngineView might fill the bill however I don't know exactly how the zooming might be handled.


Log in to reply