Results 1 to 3 of 3

Thread: QTextEdit help pls

  1. #1
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default QTextEdit help pls

    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.

    Qt Code:
    1. QSize s = maximumViewportSize();
    2.  
    3. setFixedWidth(s.width());
    4. setFixedHeight(s.height());
    To copy to clipboard, switch view to plain text mode 

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: QTextEdit help pls

    Look what return viewport->size()
    a life without programming is like an empty bottle

  3. #3
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTextEdit help pls

    both viewport()->size() and maximumViewportSize() return the same values.

Similar Threads

  1. QTextEdit Performance handling large paragraphs
    By netuno in forum Qt Programming
    Replies: 14
    Last Post: 1st September 2010, 22:58
  2. Drawing on QTextEdit
    By jgrauman in forum Qt Programming
    Replies: 3
    Last Post: 7th February 2009, 09:40
  3. QTextEdit slow to insert text
    By thomaspu in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2008, 12:05
  4. QTextEdit API questions (plain text)
    By Gaspar in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 06:03
  5. Obtaining clean (x)html from QTextEdit
    By ccf_h in forum Qt Programming
    Replies: 1
    Last Post: 5th February 2006, 14:47

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.