QTextBrowser help please!
Hi
Please have a look at the following 2 pieces of code.
Code:
ExplainBrowser b;//QTextBrowser
b.setText(str);
//b.show();
int eHeight = b.contentsHeight();//wrong height
int eWidth = b.contentsWidth();//wrong width
Code:
ExplainBrowser b;//QTextBrowser
b.setText(str);
b.show();
int eHeight = b.contentsHeight();//correct height
int eWidth = b.contentsWidth();//correct width
Is there a way by which I can the correct contentsHeight() and contentsWidth() without actually showing the widget?
Thanks a lot.
By the way I am using Qt 3.3.6
Re: QTextBrowser help please!
Quote:
Originally Posted by munna
By the way I am using Qt 3.3.6
If so, then no :) At least not directly.
You could try calculating the height yourself for example using QSimpleRichText. But you have to know the width, font and other things associated with the widget. And you have to be prepared that the calculation may not be precise.