How to change the font and size of image in QTextDocument?
问题 I want to print some text and image designed by qtdesigner. How could I change font and another format in QTextDocument ? from PyQt5 import QtCore, QtGui, QtWidgets, QtPrintSupport class Ui_MainWindow(object): def handlePrint(self): dialog = QtPrintSupport.QPrintDialog() if dialog.exec_() == QtWidgets.QDialog.Accepted: self.handlePaintRequest(dialog.printer()) def handlePreview(self): dialog = QtPrintSupport.QPrintPreviewDialog() dialog.paintRequested.connect(self.handlePaintRequest) dialog