程序中数据导出是经常有的需求,今天学习把文本导出到pdf文件.主要是用QPrinter,QPainter TextEditToPdf::TextEditToPdf(QWidget *parent, Qt::WFlags flags) : QDialog(parent, flags) { ui.setupUi(this); int ret = connect(ui.m_pExportBtn,SIGNAL(clicked()),this,SLOT(exportSlot())); } TextEdit…