munna
29th April 2006, 08:09
Hi,
I want to change the height and width of the text edit as user types in it. To do that i use maximumViewportSize() and then I set the height and width accordingly. Also, I have set the scroll bar policy to always off for both the scrollbars. I am not getting the expected results.
On every key event i do the following.
QSize s = maximumViewportSize();
setFixedWidth(s.width());
setFixedHeight(s.height());
Everytime I call this the maximumViewportSize() decreses but it should increase when some text is added. Eventually the size becomes negative and i get the following message in my debugger.
QWidget::setMinimumSize: The smallest allowed size is (0,0)
QWidget::setMaximumSize: (/QTextEdit) Negative sizes (49,-4) are not possible
Can someone please tell me where am i going wrong ?
Thanks a lot.
I want to change the height and width of the text edit as user types in it. To do that i use maximumViewportSize() and then I set the height and width accordingly. Also, I have set the scroll bar policy to always off for both the scrollbars. I am not getting the expected results.
On every key event i do the following.
QSize s = maximumViewportSize();
setFixedWidth(s.width());
setFixedHeight(s.height());
Everytime I call this the maximumViewportSize() decreses but it should increase when some text is added. Eventually the size becomes negative and i get the following message in my debugger.
QWidget::setMinimumSize: The smallest allowed size is (0,0)
QWidget::setMaximumSize: (/QTextEdit) Negative sizes (49,-4) are not possible
Can someone please tell me where am i going wrong ?
Thanks a lot.