Originally Posted by
Everall
So here is my dirty trick :
label->resize(1,1);//resize it to 1 by 1 pixel, which QT won't allow.
It resize this QLabel ALWAYS to minimal size, so the table is without margins, but Qt doesn't show the whole table...
label->resize(1,1);
label
->setFrameStyle
(QFrame::Plain);
label->setBackgroundMode(Qt::FixedColor);
label
->setPaletteBackgroundColor
(QColor("red"));
label->setText("<table width=\"100%\" bgcolor=white border=0 cellspacing=0 cellpadding=0><tr><td>aaa<br>ccc<br>ddd</td><td>bbb</td></tr></table>");
label->show();
QLabel *label = new QLabel(0);
label->resize(1,1);
label->setFrameStyle(QFrame::Plain);
label->setBackgroundMode(Qt::FixedColor);
label->setPaletteBackgroundColor(QColor("red"));
label->setText("<table width=\"100%\" bgcolor=white border=0 cellspacing=0 cellpadding=0><tr><td>aaa<br>ccc<br>ddd</td><td>bbb</td></tr></table>");
label->show();
To copy to clipboard, switch view to plain text mode
gives:
How does it look on Qt4?
I've seen in some sources this trick with resize(1,1), but I don't remember exacly where it was... I'll look for it.
Bookmarks