C++ (Qt)QPrinter printer;QPrintPreviewDialog *preview = new QPrintPreviewDialog(&printer,this); connect(preview, SIGNAL(paintRequested(QPrinter*)),this, SLOT(printPreview(QPrinter*)));preview->exec();