no simple way to print a QTextDocument in KDE(?)
Andreas Hartmetz
ahartmetz at gmail.com
Wed Jul 25 03:12:06 BST 2007
On Wednesday 25 July 2007 03:44:43 Kelly wrote:
> On Tuesday, July 24, 2007 8:40 pm Andreas Hartmetz wrote:
> > Can somebody familiar with the matter think of a solution that works
> > now, or how much stuff would need to be changed to make it work?
> > One solution might be a KTextDocument that just reimplements print(),
> > for example. Or KPrinter::printTextDocument() [...]
>
> Couldn't you just create a class that inherits KPrinter and keeps a
> QPrinter variable or vice versa or something like that? I'd suggest
> inheriting both, but I'm willing to bet there'll be naming conflicts.
Well, both are *big* classes interacting with ten different things each, and
KPrinter has many methods conflicting with QPrinter because it was made as a
drop-in replacement for QPrinter. They are much more than little utility
classes. KPrinter does use a QPrinter internally, though.
There is so much stuff to printing - paper size, page setup, choosing a paper
tray (yes!), driver options, fonts (use printer fonts or not), rasterization,
the connection may break, the user may abort, there migh be a paper jam etc
etc...
Most of this stuff is well encapsulated by both *Printer classes, just
the "print this QTextDocument good enough with minimal effort [it even adds
page numbers]" function is apparently not available with KPrinter.
--
It's the rubber pants commando!
More information about the kde-core-devel
mailing list