[Interest] QStaticText's size

Igor Mironchik igor.mironchik at gmail.com
Tue Jan 16 11:13:24 CET 2018


Solution is simple:

QTextDocument doc;
doc.setHtml( d->staticText.text() );
doc.setTextWidth( width );
doc.setDefaultTextOption( d->staticText.textOption() );

auto size = doc.size();

But this is a bug seems... Bug was reported for Qt4 and closed as Qt5 
already was in mainstream. Does anybody know is this bug reopened for Qt5?

Thank you.


16-Jan-18 12:40, Igor Mironchik пишет:
> https://bugreports.qt.io/browse/QTBUG-26768
>
>
> 16-Jan-18 12:03, Igor Mironchik пишет:
>> Hello,
>>
>> Is it possible to obtain correct size of the QStaticText with set width?
>>
>> I use:
>>
>> QStaticText st( "Some text..." );
>> st.setTextWidth( width );
>>
>> and st.size() returns always the same size, what width I wouldn't set.
>>
>> Thank you.
>>
>




More information about the Interest mailing list