Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is almost exactly like a question I answer the other day about making a QTextEdit adjust its height in reponse to content changes: <a href="https://stackoverflow.com/questions/11677499/pyside-qt-auto-vertical-growth-for-textedit-widget-and-spacing-between-widgets/11764475#11764475">PySide Qt: Auto vertical growth for TextEdit Widget</a></p> <p>I am answering instead of marking a duplicate as I suspect its possible you want a variation on this. Let me know if you want me to expand this answer:</p> <p>The other question had multiple parts. Here is the excerpt of the growing height widget:</p> <pre><code>class Window(QtGui.QDialog): def __init__(self): super(Window, self).__init__() self.resize(600,400) self.mainLayout = QtGui.QVBoxLayout(self) self.mainLayout.setMargin(10) self.scroll = QtGui.QScrollArea() self.scroll.setWidgetResizable(True) self.scroll.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) self.mainLayout.addWidget(self.scroll) scrollContents = QtGui.QWidget() self.scroll.setWidget(scrollContents) self.textLayout = QtGui.QVBoxLayout(scrollContents) self.textLayout.setMargin(10) for _ in xrange(5): text = GrowingTextEdit() text.setMinimumHeight(50) self.textLayout.addWidget(text) class GrowingTextEdit(QtGui.QTextEdit): def __init__(self, *args, **kwargs): super(GrowingTextEdit, self).__init__(*args, **kwargs) self.document().contentsChanged.connect(self.sizeChange) self.heightMin = 0 self.heightMax = 65000 def sizeChange(self): docHeight = self.document().size().height() if self.heightMin &lt;= docHeight &lt;= self.heightMax: self.setMinimumHeight(docHeight) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload