Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.3.2
-
None
Description
When using <br> inside richtext tabels the <br> tag correctly breaks the line into two, but the width of the cell does not seem to be calculated properly and is the width of both lines.
This is true for some widgets like QTextbrowser and QTextedit, QLabel seems to display correctly.
Using <p> produces cells of the correct width.
See the following sample:
#include <QApplication>
#include <QDialog>
#include <QTextbrowser>
#include <QTextedit>
#include <QLabel>
#include <QHBoxLayout>
int main(int argc, char **argv)
{
QApplication a(argc, argv);
QString s =
" using p this table is ok:"
"<table border=2>\n"
"<tr>\n"
"<td>\n"
// "<p><img src=\"x.png\"></p><p><img src=\"x.png\"></p>\n"
"</td><td>\n"
"<p>Some</p><p> text.</p>\n"
"</td>\n"
"</tr>\n"
"</table>\n"
"using br this table is too wide in some Widgets"
"<table border=1>\n"
"<tr>\n"
"<td>\n"
// "<img src=\"x.png\"><br><img src=\"x.png\">\n"
"</td><td>\n"
"Some<br>text.\n"
"</td>\n"
"</tr>\n"
"</table>\n"
;
QTextBrowser *browser = new QTextBrowser;
browser->setHtml(s);
QTextEdit *editor = new QTextEdit;
editor->setHtml(s);
QLabel *label = new QLabel;
label->setText(s);
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(browser);
layout->addWidget(editor);
layout->addWidget(label);
QDialog *dia = new QDialog();
dia->setLayout(layout);
dia->show();
return a.exec();
}