Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to set fixed width in qtextdocument?
Forum Updated to NodeBB v4.3 + New Features

How to set fixed width in qtextdocument?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 636 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    qwe3
    wrote on last edited by qwe3
    #1

    Hi,

    I have QTextEdit object. It is not editable, readonly etc.

    I don't know what text I will have on it, but I would like to have fixed width and change only height.

    I tried with qtextdocument:

    textEdit->document()-> something
    textEdit->resize(something);
    

    but with no good results.

    JonBJ raven-worxR 2 Replies Last reply
    0
    • Q qwe3

      Hi,

      I have QTextEdit object. It is not editable, readonly etc.

      I don't know what text I will have on it, but I would like to have fixed width and change only height.

      I tried with qtextdocument:

      textEdit->document()-> something
      textEdit->resize(something);
      

      but with no good results.

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

      @qwe3
      What about QWidget::setFixedWidth(int w) ?

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        qwe3
        wrote on last edited by
        #3

        @JonB I tried it. But I don't know which height I have to set to don't need vertical scroll bar but get minimum needed height.

        1 Reply Last reply
        0
        • Q qwe3

          Hi,

          I have QTextEdit object. It is not editable, readonly etc.

          I don't know what text I will have on it, but I would like to have fixed width and change only height.

          I tried with qtextdocument:

          textEdit->document()-> something
          textEdit->resize(something);
          

          but with no good results.

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          @qwe3
          try
          https://doc.qt.io/qt-5/qtextdocument.html#textWidth-prop

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved