This is a small ROOT macro to use Qt 3.3 class: QPrinter to setup the printer via Qt "setup printer dialog" See: Printer setup dialog box and print out the ROOT TCanvas object either via the "can" pointer provided or the current one.
To use, invoke ACLiC from the ROOT prompt:
root [] .x QtPrintDialog.C++
To use it with no ACLiC, omit the trailing "++"
root [] .x QtPrintDialog.C
The full list of the Qt classes available from Cint is defined by by $ROOTSYS/cint/lib/qtclasses.h
All Qt classes can be used from ACLiC though.
# include <QPrintDialog>
# include <QPrinter>
# include <QPainter>
# include <QPixmap>
# include <TGQt.h>
if (pd) {
QPrinter p;
QPrintDialog printDialog(&p);
if (printDialog.exec() == QDialog::Accepted) {
QPixmap *pix = (QPixmap *)(TGQt::iwid(id));
QPainter pnt(&p);
pnt.drawPixmap(0,0,*pix);
}
} else {
printf(" No TCanvas has been selected yet! \n");
}
}
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual Int_t GetPixmapID() const =0
static TVirtualPad *& Pad()
Return the current pad for the current thread.
- Author
- Valeri Fine 23/03/2006
Definition in file QtPrintDialog.C.