Qt3 to Qt4 printer setup confusion
In QT3 the code
Code:
QPrinter myprinter;
// = new QPrinter(); myprinter.
setPageSize( QPrinter::Letter );
myprinter.
setOrientation( QPrinter::Portrait );
myprinter.
setColorMode( QPrinter::Color );
myprinter.setFullPage ( true );
ret = myprinter.setup();
if( ret == true )
{
gave the user of a program the oppurtunity to change the default perameters for a print out. Qt4 says to use "QPrintDialog printDialog" for this.
The "Detailed Description" for this function says
Quote:
Typically, QPrintDialog objects are constructed with a QPrinter object, and executed using the exec() function.
QPrintDialog printDialog(printer, parent);
if (printDialog.exec() == QDialog::Accepted) {
// print ...
}
I am a bit of a newbie in deciphering Qt4's style of documentation and with no print examples that I can find I need help.
Thanks
Re: Qt3 to Qt4 printer setup confusion
Quote:
Originally Posted by impeteperry
QPrintDialog printDialog(printer, parent);
if (printDialog.exec() == QDialog::Accepted) {
// print ...
}
It's a Qt4 equivalent of:
Code:
ret = myprinter.setup();
if( ret == true )
{
// print ...
}
The "print ..." part didn't change much in Qt4, i.e. it's something like this:
Code:
p.begin( &myprinter );
p.setPen( ... );
p.drawLine( 10, 10, 100, 100 );
...
p.end();
Re: Qt3 to Qt4 printer setup confusion
Thanks, actually I am able to print ok in Qt4, but what I wanted is to display a window similar to the one i get with
Quote:
ret = myprinter.setup();
in Qt3.
Re: Qt3 to Qt4 printer setup confusion
Quote:
Originally Posted by impeteperry
what I wanted is to display a window similar to the one i get with ret = myprinter.setup(); in Qt3.
Then try QPageSetupDialog.
Re: Qt3 to Qt4 printer setup confusion
Thanks. I am new to this and am is the learning process and am totally confused.. I would appreciate it if, using the code snippit in my original post, you wold show the code to do what the
Quote:
ret = myprinter.setup();
did in Qt3.
Thanks
pete
Re: Qt3 to Qt4 printer setup confusion
Quote:
Originally Posted by impeteperry
I am new to this and am is the learning process and am totally confused.. I would appreciate it if, using the code snippit in my original post, you wold show the code to do what the did in Qt3.
It's something like:
Code:
#include <QPageSetupDialog>
...
myprinter.
setPageSize( QPrinter::Letter );
myprinter.
setOrientation( QPrinter::Portrait );
myprinter.
setColorMode( QPrinter::Color );
myprinter.setFullPage ( true );
if( dialog.
exec() == QDialog::Accepted ) { ...
}
Re: Qt3 to Qt4 printer setup confusion
Thanks a whole lot. You gave me the clue I was lookng for. I forgot the "#include"
What I had was
Code:
if (dialog.
exec() == QDialog::Accepted)
but not the #Include.
This gives me the "dialog" I was looing for.
Life is simple when you know what you are doing. Now I can go away happy.
Thanks again.