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. QTextEdit; adjustSize() not working?
Forum Updated to NodeBB v4.3 + New Features

QTextEdit; adjustSize() not working?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 3.1k 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.
  • G Offline
    G Offline
    georgesKh
    wrote on last edited by
    #1

    setting text for QTextEdit:
    te->setPlainText("Something") ;
    te->adjustSize();

    should wrap around "Something" only , instead the TextEdit is expanding to its maximum Width-Height, can't fix it..
    When I select "Something" on run time , only "Something" is highlighted, no added extra white spaces.

    Expectations: when text is small enough to fit on one Line, the text edit shouldn't expand in height, when the text needs to wrap , only the extra line width should be added not the maximum width.

    if adjustSize(); is not called , the text will wrap on the width that was set in the .ui in the Creator , wont dynamically expand horizontally nor vertically..

    Some Info:
    Horizontal Policy: Expanding
    Vertical Policy : MinimumExpanding
    minimumSize : 2x22
    maximum Size : 300x100
    lineWrapMode: WidgetWidth

    Any Idea ?

    1 Reply Last reply
    0
    • V Offline
      V Offline
      vittalonline
      wrote on last edited by
      #2

      Reimplement sizeHint() to take into consideration the size of the document and call update()

      1 Reply Last reply
      0
      • G Offline
        G Offline
        georgesKh
        wrote on last edited by
        #3

        Thanks for your help :) but I solved it by calculating width and height and setting the geometry.

        1 Reply Last reply
        0

        • Login

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