How to print the current tab on pressing a Push Button?
-
Hi
You can use the print class for that
http://doc.qt.io/qt-5/qprinter.htmlexample of use
https://stackoverflow.com/questions/45467942/how-can-i-print-a-qwidget-in-qt -
Hi
You can use the print class for that
http://doc.qt.io/qt-5/qprinter.htmlexample of use
https://stackoverflow.com/questions/45467942/how-can-i-print-a-qwidget-in-qt -
@mrjj Thanks for the help. I am unable to print the whole QDialog in a single page. In fact I have changed the orientation, margins and fullpage.
-
@Piyush
ok, is that a question or ?You can scale it to fit one page. or that is to compressed to read ?
Its hard(er) to print image over multiple pages.
-
@mrjj I need to print a whole tab in a single A4 page. But the printer is giving print displaying partial tab. So How can I do it?
-
@mrjj Hi,
I tried doing it, but still there is only partial print of tab. Is there any way by which I can pass the current tab in the print function? This is the code I am using:
printer = QtPrintSupport.QPrinter()
printer.setPageOrientation(1)
printer.PrinterMode(2)
printer.Unit(0)
#printer.setFullPage(True)
printer.setPageMargins(0,0,0,0,printer.Millimeter)
painter = QtGui.QPainter()
painter.begin(printer)
screen = self.grab()
painter.drawPixmap(0,0, screen)
painter.end() -
@mrjj Hi,
I tried doing it, but still there is only partial print of tab. Is there any way by which I can pass the current tab in the print function? This is the code I am using:
printer = QtPrintSupport.QPrinter()
printer.setPageOrientation(1)
printer.PrinterMode(2)
printer.Unit(0)
#printer.setFullPage(True)
printer.setPageMargins(0,0,0,0,printer.Millimeter)
painter = QtGui.QPainter()
painter.begin(printer)
screen = self.grab()
painter.drawPixmap(0,0, screen)
painter.end()Hi
I dont see any scaling ?painter.drawPixmap(0,0, screen) just seem to draw the image as is.
if you do
painter.drawPixmap(0,0, screen.scaled(screen.width()/2, screen.height() /2 ) )
it should draw in half the size
its c++ syntax. im not python user but should be pretty close.