joseph
10th July 2007, 06:19
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 ....
void ChemCanvas::printToPrinter( const RouteList *routeList )
{
// printer object
#if (QT_VERSION < 0x030000)
QPrinter printer;
#else
QPrinter printer( QPrinter::HighResolution );
#endif
// original wcOrigin, saved to be restored after printing.
QPoint originalWcOrigin = wcOrigin;
// With this set as true, objectNeedsRepainting won't
// draw while scaling to printer canvas
printing = TRUE;
// Set default printer characteristics to conform to the current
// canvas settings.
printer.setPageSize ( mappings.pageSize() );
printer.setOrientation( mappings.orientation() );
printer.setOutputFileName (
(const char *)chemGlobals->printerDefaultFilename() );
qDebug() << (const char *)chemGlobals->printerDefaultFilename();
// printer.setOutputToFile ( FALSE );
// Set full page mode, in order to have control of page size
printer.setFullPage( TRUE );
// Run the printer setup dialog, and if the user clicks 'ok' then
// do the actual printing
#if defined(_OS_WIN32_) || defined(Q_OS_WIN32)
Q_CHECK_PTR(&printer);
//if ( printer.setup( this ) )
QPrintDialog *printDialog = new QPrintDialog(&printer, this);
Q_ASSERT( printDialog );
if( printDialog->exec() == QDialog::Accepted ) // HERE IT IS CRASHING...
#else
QPrintDialog printerDialog( &printer );
printerDialog.setPrinter( &printer, TRUE );
if( printerDialog.exec() )
#endif
{
// Set the hourglass cursor
QApplication::setOverrideCursor( waitCursor );
------------------
------------------ // Other stuff for printing...
-------------------
}
}
Please tell me why it is CRASHING only in WINDOWS .
Its working in LINUX properly.
Hlep me ...!!!
thanks in advance..
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 ....
void ChemCanvas::printToPrinter( const RouteList *routeList )
{
// printer object
#if (QT_VERSION < 0x030000)
QPrinter printer;
#else
QPrinter printer( QPrinter::HighResolution );
#endif
// original wcOrigin, saved to be restored after printing.
QPoint originalWcOrigin = wcOrigin;
// With this set as true, objectNeedsRepainting won't
// draw while scaling to printer canvas
printing = TRUE;
// Set default printer characteristics to conform to the current
// canvas settings.
printer.setPageSize ( mappings.pageSize() );
printer.setOrientation( mappings.orientation() );
printer.setOutputFileName (
(const char *)chemGlobals->printerDefaultFilename() );
qDebug() << (const char *)chemGlobals->printerDefaultFilename();
// printer.setOutputToFile ( FALSE );
// Set full page mode, in order to have control of page size
printer.setFullPage( TRUE );
// Run the printer setup dialog, and if the user clicks 'ok' then
// do the actual printing
#if defined(_OS_WIN32_) || defined(Q_OS_WIN32)
Q_CHECK_PTR(&printer);
//if ( printer.setup( this ) )
QPrintDialog *printDialog = new QPrintDialog(&printer, this);
Q_ASSERT( printDialog );
if( printDialog->exec() == QDialog::Accepted ) // HERE IT IS CRASHING...
#else
QPrintDialog printerDialog( &printer );
printerDialog.setPrinter( &printer, TRUE );
if( printerDialog.exec() )
#endif
{
// Set the hourglass cursor
QApplication::setOverrideCursor( waitCursor );
------------------
------------------ // Other stuff for printing...
-------------------
}
}
Please tell me why it is CRASHING only in WINDOWS .
Its working in LINUX properly.
Hlep me ...!!!
thanks in advance..