From the docs:Originally Posted by vermarajeev
My widget is not part of any layout and therefore I am getting -1 which I cannot use.int QWidget::heightForWidth ( int w ) const [virtual]
Returns the preferred height for this widget, given the width w.
If this widget has a layout, the default implementation returns the layout's preferred height. if there is no layout, the default implementation returns -1 indicating that the preferred height does not depend on the width.
Isn't there a way by which we can find the number of lines that the text are occupying and then based on the font we can calculate the approximate height ?
Thanks a lot for your help
Bookmarks