void TabDialog::print(){ int ret; printer->setPageSize(QPrinter::A4); printer->setOrientation(QPrinter::Portrait); printer->setFullPage( TRUE ); ret=printer->setup(this); QString s,s1; s=lmodif->text(); s1=RS("Текст заявки \n\n\n");s=s1+s; if (ret) { QPainter p; if( !p.begin( printer ) ) { return; } QPaintDeviceMetrics metrics( p.device() ); int dpiy = metrics.logicalDpiY(); int margin = (int) ( (2/2.54)*dpiy ); // 2 cm margins QRect r( margin, margin, metrics.width() - 2*margin, metrics.height() - 2*margin ); p.drawText(r,Qt::PlainText ,s); p.end(); }}
QStyleSheet::convertFromPlainText(textEdit->text())