1 Attachment(s)
QTextBrowser/QTextEdit html block width issue
Hi folks,
I observe an issue with the rendering of html block elements (with Qt 4.5.3 & 4.6.1 / WinXP):
http://www.qtcentre.org/attachment.p...achmentid=4198
1. The "Title" 1&2 formats differ only by the appended '<br>' tag, and without it the center alignment is not working. What is wrong here ? How can this be fixed without this extra tag ? (insertBlock() won't help)
2. But this hack does not work for in frame html any more. As you can see in the code for H2 "Frame #1/2 header". Here the '<br>' tag positioned in front makes the hack ?!?
So what do I the wrong way? How is the correct way to declare a frame-wide html block without some hooks ?
Code:
// _doc is a QTextDocument*;
c.insertHtml("<div align=\"center\"><h1>Title.</h1></div><br>");
c.insertBlock();
c.insertHtml("<div align=\"center\"><h1>Title 2.</h1></div>");
providerFrame.setBorder( 1.0);
providerFrame.setWidth(200.0);
c.insertHtml("<h2>Frame #1 header.</h2><br>"
"<p>content 1</p>"
"<p>content 2</p>");
c= root->lastCursorPosition();
c.insertBlock();
c.insertHtml("<br><h2>Frame #2 header.</h2>"
"<p>content 1</p>"
"<p>content 2</p>");
c= root->lastCursorPosition();
c.insertHtml("<p>end</p>");
H2 css:
Code:
h2 { font-size: 120%; font-weight: bold; background: lightgray; }
>This< seems to be a related post, but unfortunately not solved :(
Regards,
lexar
Re: QTextBrowser/QTextEdit html block width issue
Hi
I am not sure this will help you but why dn't you try QWebView class for setting up html data ?
Re: QTextBrowser/QTextEdit html block width issue
I don't need the full power of a web renderer. And tried the text-browser first in hope it will consume fewer resources...
Seems that the insertHtml()/html-rendering functionality is definitely broken. Have found additional positioning/layout issues in between. Hope Qt will document the engine constraints and fix the bugs, some day...