Logo Search packages:      
Sourcecode: kbarcode version File versions  Download package

DSRichText Class Reference

#include <dsrichtext.h>

List of all members.


Detailed Description

A richtext rendering class, which draws a piece of HTML formated richtext on any QPainter. This class works with all printer resolutions compared to the buggy QSimpleRichText

rendering the richtext happens in 3 steps:

Printing to the screen is easy and the usage does not differ from QSimpleRichText. Drawing on QPrinter is a little bit more complicated. The most important thing is that you may not use QPainter::scale(). A small example on how to print on a QPrinter:

  QPrinter printer( QPrinter::HighResolution );
  QPainter painter( &printer );
  QPaintDeviceMetrics metrics( &printer );
  double scalex = (double)metrics.logicalDpiX() / (double)QPaintDevice::x11AppDpiX();
  double scaley = (double)metrics.logicalDpiY() / (double)QPaintDevice::x11AppDpiY();

  DSRichText dsr( "&lt;html&gt;&lt;p&gt;Hallo World&lt;/p&gt;&lt;/html&gt;" );
  dsr.setWidth( 200 ); // in screenresolution coordinates
  dsr.setHeight( 80 );  // in screenresolution coordinates
  painter.translate( 10 * scalex, 10 * scaley ); // draw at 10, 10 instead of 0, 0
  dsr.scale( scalex, scaley );
  dsr.draw( &painter );
 

Author:
Dominik Seichter

Definition at line 109 of file dsrichtext.h.


Public Member Functions

void draw (QPainter *p)
 DSRichText (const QString &t)
void setHeight (int height)
void setScale (double x, double y)
void setWidth (int width)

Private Member Functions

void drawJustified (formated_line *line)
void fillLines ()
void initFormat (formated_word *f, int alignment)
void initLine (QValueList< formated_line > *l)
QString parse (const QString &t, const QString &find, const QString &end, int start)
int parseAlignment (const QString &align)
bool parseParagraph ()
QString parseParagraphTag (const QString &t, int *alignment)
QFont parseStyle (const QString &s, QColor *color)
void parseWords (const QString &t, formated_word *w, WordList *words)
QString replaceEscapeSequences (const QString &t)
void updateSpacing (QValueList< formated_line > *l, QFontMetrics *fm)
int yDeviation (const formated_line *line)

Private Attributes

int end
int h
QValueList< LineList > line_p
QFont m_base
QColor m_color
QPainter * painter
int pos
int start
double sx
double sy
QString text
int w
QValueList< WordList > word_p
int x
int y

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index