[Qt-interest] Qt4.4 QTextEdit size and viewport() size
Malyushytsky, Alex
alex at wai.com
Sat Feb 7 03:49:27 CET 2009
>>MyTextEdit->document().size() doesn't return the actual size of the
'underlying widget'
Just some thoughts. I guess it depends when it is called and is this document diplayed in a several views or not.
I would expect, that if document is already displayed in the MyTextEdit, the appropriate layout is set and document().size().height() should give you an appropriate value.
If not you probably can do such initialization yourself.
But it might be just easier to call document().size() at proper time, than handle all initialization yourself.
I have not tried anything above, so I can't be sure, but this is how I expect it works:
QTextEdit invokes QAbstractTextDocumentLayout::draw to draw QTextDocument in the viewport.
According QT4 documentation QTextDocument::document().size()is equivalent to documentLayout()->documentSize();
Hope this helps,
Alex Malyushytsky
-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Josh
Sent: Friday, February 06, 2009 5:48 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Qt4.4 QTextEdit size and viewport() size
Thanks for the pointer. It looked promising, but unfortunately,
MyTextEdit->document().size() doesn't return the actual size of the
'underlying widget'.
Josh
> Josh wrote:
>
>> Hello,
>> .......
>> Thoughts? Ultimately it would be nice not just to get the size of the
>> underlying widget, but also a pointer to it itself. Thanks.
>>
>> Josh
>
> Hi Josh,
>
> Try MyTextEdit->document().size()
>
>> From your description, I think the 'underlying widget' is virtual in the
> case QTextEdit.
>
> Tony.
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.
"This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."
"Please consider our environment before printing this email."
More information about the Qt-interest-old
mailing list