fork download
  1. #include <QApplication>
  2. #include <QPrinter>
  3. #include <QPrintDialog>
  4. #include <QPainter>
  5.  
  6. int main(int argc, char *argv[])
  7. {
  8. QApplication a(argc, argv);
  9.  
  10. QPrinter prn(QPrinter::HighResolution);
  11. prn.setPageMargins(20,20,20,20,QPrinter::Millimeter);
  12. prn.setPageSize(QPrinter::A4);
  13. QPrintDialog pd(&prn, 0);
  14. if(pd.exec()==QPrintDialog::Accepted){
  15. QPainter p(&prn);
  16. p.setPen(QPen(Qt::black, 2));
  17. p.drawRect(prn.pageRect());
  18. p.end();
  19. }
  20.  
  21. return 0;
  22. }
  23.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:24: fatal error: QApplication: No such file or directory
 #include <QApplication>
                        ^
compilation terminated.
stdout
Standard output is empty