1 /************************************************************************
3 * Copyright 2011 Jonatan Liljedahl <lijon@kymatica.com>
5 * This file is part of SuperCollider Qt GUI.
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ************************************************************************/
22 #ifndef QC_PEN_PRINTER_H
23 #define QC_PEN_PRINTER_H
25 #include "../painting.h"
27 #include <QPrintDialog>
31 class QcPenPrinter
: public QObject
34 Q_PROPERTY( QRect pageRect READ pageRect
);
35 Q_PROPERTY( QRect paperRect READ paperRect
);
36 Q_PROPERTY( int fromPage READ fromPage
);
37 Q_PROPERTY( int toPage READ toPage
);
41 QcPenPrinter(): dialog(0) {}
47 QRect
pageRect() const { return printer
.pageRect(); }
48 QRect
paperRect() const { return printer
.paperRect(); }
49 int fromPage() const { return printer
.fromPage(); }
50 int toPage() const { return printer
.toPage(); }
61 dialog
= new QPrintDialog(&printer
);
62 dialog
->setWindowTitle( QString("Print Document") );
64 QAbstractPrintDialog::PrintToFile
|
65 QAbstractPrintDialog::PrintPageRange
|
66 QAbstractPrintDialog::PrintShowPageSize
68 connect( dialog
, SIGNAL(finished(int)), this, SIGNAL(dialogDone(int)) );
70 if( dialog
->isVisible() )
71 qcWarningMsg("WARNING: Print dialog already open.");
78 painter
.begin(&printer
);
79 QtCollider::beginPainting(&painter
);
80 Q_EMIT ( printFunc() );
82 QtCollider::endPainting();
95 #endif // QC_PEN_PRINTER_H