PDA

View Full Version : margins in QSimpleRichText



Pan Wojtas
9th February 2006, 22:34
Qt automaticly adds some margins to every QSimpleRichText. What can I do to avoid this behaviour?

guilugi
10th February 2006, 10:46
I think it must be related to the parent widget, containing the QSimpleRichText object.

What is exactly the parent widget ?

Guilugi.

Pan Wojtas
10th February 2006, 12:41
no, it is not connected with parent widget.
look at this code:

QSimpleRichText rich_text("<img src=image.jpg border=0>", app.font());
QRect rect(0, 0, rich_text.widthUsed(), rich_text.height());
QPixmap buffer(rect.size());
buffer.fill(Qt::red);

QPainter p( &buffer );
rich_text.draw(&p, 0, 0, rect, app.palette().active());
p.end();

QLabel *label = new QLabel(0);
label->setPixmap(buffer);
label->show();
This "image.jpg" is an green image 150px*150px.
Now look at results:
http://www.rejsymorskie.net/smieci/66.png
red borders are QSimpleRichText's margins.

Everall
10th February 2006, 16:34
There is a similar thread active about these margins :

see :
http://www.qtcentre.org/forum/showthread.php?t=511
As far as I can see there is no solution yet for QT3.