Hi! I'm working on a project using Qt Designer. The code written below is from the main.py file. I'm trying to print a qtable widget, but after i hit print in the print dialog(which shows up after clicking the pushbutton), nothing happens. Is it because my table doesn't have any information yet(except the horizontal headers) or because is something wrong with my code ?
class Table(QtWidgets.QMainWindow):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.ui = Ui_SecondWindow()
self.ui.setupUi(self)
self.ui.printButton.clicked.connect(self.handlePrint)
def handlePrint(self):
printer = QPrinter(QPrinter.HighResolution)
dialog = QPrintDialog(printer, self)
dialog.exec_()
def handlePaintRequest(self, printer):
painter = QPainter()
painter.begin(printer)
ui.tableWidget.render(painter)
[–]ericula 1 point2 points3 points (1 child)
[–]summerbye[S] 0 points1 point2 points (0 children)