Printing a file

David Boddie davidb at mcs.st-and.ac.uk
Fri Mar 3 06:43:42 EST 2006


Fabian Steiner wrote:
> David Boddie wrote:

> > In Qt 4, the demos/textedit demo does this with a lot less code.
> >
> > Or are you think of something else?
>
> Thank you very much for this hint! Thanks to this example I was able to
> print out my first pages :)

That's good to hear. :-)

> But some questions still remain. At the moment I am using
> QSimpleRichtext and a personal HTML-File. I had a look at the
> example.html of textedit.cpp (/usr/share/doc/qt-4.1.1/demos/textedit)
> and found out that it contains quite a lot of proprietary HTML elements,
> attributes and CSS style definitions. So far I didn't even know that
> QSimpleRichText even supports CSS since I couldn't find anything related
> to this point in the official docs (--> e.g. QStylesheet).

I think I may have confused you by mentioning Qt 4. Since you are using
QSimpleRichText, you must be using Qt 3, so you should probably ignore
what I said about the /usr/share/doc/qt-4.1.1/demos/textedit demo. :-/

> Is there any tool out there with which I can write those special HTML
> files? I am quite familiar with HTML and CSS but I don't want to waste
> my time with that.

You don't need to include all those style attributes in the HTML.
Anyway, that's a different version of Qt to the one you are using, so
you can safely ignore it. You should probably look at the text drawing
part of the demo included in Qt 3 (examples/demo/textdrawing) and see
how printing is done for the rich text editor there (in the
TextEdit::filePrint() function). Translating it to Python _shouldn't_
be a problem.

I hope I didn't confuse you too much by talking about two different
versions of Qt at the same time.

Let us know how it goes.

David




More information about the Python-list mailing list