[Qt-interest] Calculating text size in QLineEdit

Matthias Paul slayer81 at gmx.de
Tue Mar 8 10:06:28 CET 2011


Hello!

I created a QLineEdit subclass, which automatically displays a truncated text if the original text is too long for the widget's size, so that there's no need to scroll for the user. Instead a tooltip with full text is displayed.

QFontMetrics calculates the size required for the displayed text based on QWidget's size() (provided by ResizeEvent). Still, I cannot figure out how to get the the text label size _minus_ widget's borders and margins. Guess I have to use QStyle somehow, so can someone give me a hint please?

Thank you,
Paule
-- 
NEU: FreePhone - kostenlos mobil telefonieren und surfen!			
Jetzt informieren: http://www.gmx.net/de/go/freephone



More information about the Qt-interest-old mailing list