qprinter

QPrinter When click button my program crashes Why?

≯℡__Kan透↙ 提交于 2019-12-25 19:07:16
问题 When i click the button, the program crashes. I will post my code: void Test1::on_pushButton_1_clicked() // print the information { QPrinter printer(QPrinter::HighResolution); printer.setCreator("Me"); printer.setDocName("Print"); printer.setPaperSize(QPrinter::A4); QPrintPreviewDialog *pd = new QPrintPreviewDialog(&printer); connect(pd,SIGNAL(paintRequested(QPrinter*)),this,SLOT(print(QPrinter*))); pd->exec(); } void Test1::print(QPrinter *p) { QPainter painter(p); painter.setPen(Qt::blue);

Issues building PyQt5 for Python3.4 in Ubuntu 14.04 caused by qprinter.h not found then pyuic5 error

江枫思渺然 提交于 2019-12-11 07:05:45
问题 After installing the latest SIP, and the latest Qt5, I tried to build the latest PyQt5 for python 3.4. I launched pyqt5 configure like this: python3 configure.py --qmake=/opt/Qt/5.3/gcc_64/bin/qmake Then make and sudo make install. During sudo make install I obtain this error: cd QtWebKitWidgets/ && ( test -e Makefile || /opt/Qt/5.3/gcc_64/bin/qmake /home/me/Downloads/PyQt-gpl-5.3.2/QtWebKitWidgets/QtWebKitWidgets.pro -o Makefile ) && make -f Makefile install make[1]: Entering directory `

printing from main page in pyqt5

梦想与她 提交于 2019-12-11 06:54:39
问题 i write some code in pyqt5 that create a table in main main: class Ui_MainWindow(object): def setupUi(self, MainWindow): ... def retranslateUi(self, MainWindow):... self.pushButton.setText(_translate("MainWindow", "print")) self.pushButton.clicked.connect(self.printer) def printer(self):... and use this class by: app = QtWidgets.QApplication(sys.argv) MainWindow = QtWidgets.QMainWindow() ui = Ui_MainWindow() ui.setupUi(MainWindow) MainWindow.show() sys.exit(app.exec_()) i wanna know how can i

page x of y using QPrinter

谁都会走 提交于 2019-12-10 10:56:48
问题 im generating a pdf file from html code using qt: QTextDocument *document = new QTextDocument(); document->setHtml(htmlContent); QPrinter printer(QPrinter::HighResolution); printer.setPageSize(QPrinter::A4); printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName("filename.pdf"); document->print(printer); Is it possible to have the page information "Page X of Y" instead of only the page number? If yes, how? 回答1: The solution I propose is based on this code. I have added the

QT5.0中关于QPrinter等类的变更

一个人想着一个人 提交于 2019-12-10 07:32:27
QT5中将QPrinter等类归入到了printsupport模块中,如果在项目中引入了有关的头文件,需要在工程文件.pro文件中加入“QT += printsupport”,否则编译会产生“undefined ...”错误。 参考:http://www.linkedin.com/groups/QPrinter-problem-in-Qt5-1531497.S.200834103 来源: oschina 链接: https://my.oschina.net/u/590849/blog/118052

How to convert webpage into PDF by using Python

梦想与她 提交于 2019-11-26 03:06:32
问题 I was finding solution to print webpage into local file PDF, using Python. one of the good solution is to use Qt, found here, https://bharatikunal.wordpress.com/2010/01/. It didn\'t work at the beginning as I had problem with the installation of PyQt4 because it gave error messages such as \'ImportError: No module named PyQt4.QtCore\', and \'ImportError: No module named PyQt4.QtCore\'. It was because PyQt4\'s not installed properly. I used to have the libraries located at C:\\Python27\\Lib