Results 1 to 3 of 3

Thread: QText Edit help please

  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 QText Edit help please

    Hi,

    Is there a way by which we can find the minimum height of a QTextEdit such that the vertical scrollbar will not appear ?

    Alternately, is there a way to find the total number of lines of text available in QTextEdit?
    Using this info and QFontMetrics we can probably find the ideal height.

    Thanks a lot

  2. #2
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: QText Edit help please

    txtEdit->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);

    OR


    QSize size = txtEdit->minimumSize ();
    int minHeight = size.height ();

    if(txtEdit->height () == minHeight())
    {
    txtEdit->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysO ff);
    }

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QText Edit help please

    QAbstractTextLayout::documentSize() should work. You can access the layout using QTextDocument::documentLayout().

Similar Threads

  1. QPixmap +dll to installer.. to enable JPG edit
    By patrik08 in forum Installation and Deployment
    Replies: 2
    Last Post: 27th June 2006, 22:27
  2. Signal problem in Qline Edit
    By awalesminfo in forum Newbie
    Replies: 1
    Last Post: 3rd April 2006, 09:13
  3. Replies: 4
    Last Post: 24th March 2006, 22:50
  4. Replies: 1
    Last Post: 18th March 2006, 16:37

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.