Mankua
12th May 2011, 18:32
Hello!
Is it possible to compute the width and height of the text in a QLabel? This size depends on the string contents and the font(s) used in QLabel.
I am adding a dynamic toolbar to my application, and all controls have a QLabel with the name of the tool, and then the control itself... for example:
Brightness: [ 0.0 ] Contrast: [ 0.0 ]
And I need to find the exact size in pixels of the "Brightness:" and "Contrast:" text as shown in screen to know how big my QLabel needs to be. Right now I'm doing this using trial and error.
Any ideas?
Thanks!
Is it possible to compute the width and height of the text in a QLabel? This size depends on the string contents and the font(s) used in QLabel.
I am adding a dynamic toolbar to my application, and all controls have a QLabel with the name of the tool, and then the control itself... for example:
Brightness: [ 0.0 ] Contrast: [ 0.0 ]
And I need to find the exact size in pixels of the "Brightness:" and "Contrast:" text as shown in screen to know how big my QLabel needs to be. Right now I'm doing this using trial and error.
Any ideas?
Thanks!