Important: Please read the Qt Code of Conduct -

Problem in text browser

  • Hello

    I have problem as below when I click arrow button in text browser's scroll bar.

    I don't want to cut the text. Is there any solution?

  • What is it you don't like/want in the picture? You want to make the window higher so that more is shown? You don't like that scrolling might cause a line to be shown cut in half vertically? You want to control the scrolling so that it only scrolls a complete line at a time? Do you store HTML in the QTextBrowser or only plain text?

  • Thank you for reply.

    I want that when I clicked arrow button like this arrow.PNG , the text line should not cut vertically.
    I need to output 3 plain text lines in the text browser.

  • Lifetime Qt Champion


    Do you mean you want to scroll per line or per three lines ?

  • Hello,

    Thank you for reply.
    I mean I want to scroll per 1 line.

  • Moderators

    I'm not sure how to do this with QTextEdit, but if it's just plain text (like in your example) you can consider using QPlainTextEdit instead. This AFAIK scrolls by lines only by default.

  • @hihanna14
    If you can change like @kkoehne said that's easiest.

    Otherwise, you'll have to catch the scrollbar command. And then I imagine, because QTextBrowser accepts HTML not just plain text (I asked you earlier about this), you'll have to do something like measure the font's line height and multiple by 3 to get what you want (or be lazy and hard-code a figure!).

  • I changed 'Textbrowser' to 'PlainTextEdit'.
    It works!!. Thank you, @JonB & @kkoehne .
    Merry Christmas!!

Log in to reply