Hi,

I am proting my application from qt3 to qt4 using Qt3Support.
My Problem is , in my PRINTING CODE ( which was working both in WINDOWS && LINUX in Qt3 ) . Now after porting to Qt4 the same PRINTING CODE is CRASHING in WINDOWS...

See the code below ....


Qt Code:
  1. void ChemCanvas::printToPrinter( const RouteList *routeList )
  2. {
  3.  
  4.  
  5. // printer object
  6. #if (QT_VERSION < 0x030000)
  7. QPrinter printer;
  8. #else
  9. QPrinter printer( QPrinter::HighResolution );
  10.  
  11. #endif
  12. // original wcOrigin, saved to be restored after printing.
  13. QPoint originalWcOrigin = wcOrigin;
  14.  
  15. // With this set as true, objectNeedsRepainting won't
  16. // draw while scaling to printer canvas
  17. printing = TRUE;
  18.  
  19. // Set default printer characteristics to conform to the current
  20. // canvas settings.
  21. printer.setPageSize ( mappings.pageSize() );
  22. printer.setOrientation( mappings.orientation() );
  23. printer.setOutputFileName (
  24. (const char *)chemGlobals->printerDefaultFilename() );
  25. qDebug() << (const char *)chemGlobals->printerDefaultFilename();
  26. // printer.setOutputToFile ( FALSE );
  27. // Set full page mode, in order to have control of page size
  28. printer.setFullPage( TRUE );
  29.  
  30. // Run the printer setup dialog, and if the user clicks 'ok' then
  31. // do the actual printing
  32. #if defined(_OS_WIN32_) || defined(Q_OS_WIN32)
  33. Q_CHECK_PTR(&printer);
  34. //if ( printer.setup( this ) )
  35. QPrintDialog *printDialog = new QPrintDialog(&printer, this);
  36. Q_ASSERT( printDialog );
  37. if( printDialog->exec() == QDialog::Accepted ) // HERE IT IS CRASHING...
  38. #else
  39. QPrintDialog printerDialog( &printer );
  40. printerDialog.setPrinter( &printer, TRUE );
  41. if( printerDialog.exec() )
  42. #endif
  43. {
  44. // Set the hourglass cursor
  45. QApplication::setOverrideCursor( waitCursor );
  46.  
  47. ------------------
  48. ------------------ // Other stuff for printing...
  49. -------------------
  50.  
  51. }
  52. }
To copy to clipboard, switch view to plain text mode 

Please tell me why it is CRASHING only in WINDOWS .
Its working in LINUX properly.


Hlep me ...!!!
thanks in advance..